azure_mgmt_mariadb 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb.rb +76 -0
  4. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/check_name_availability.rb +123 -0
  5. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/configurations.rb +393 -0
  6. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/databases.rb +538 -0
  7. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/firewall_rules.rb +538 -0
  8. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/location_based_performance_tier.rb +113 -0
  9. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/log_files.rb +123 -0
  10. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/maria_dbmanagement_client.rb +168 -0
  11. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/configuration.rb +132 -0
  12. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/configuration_list_result.rb +55 -0
  13. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/database.rb +84 -0
  14. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/database_list_result.rb +55 -0
  15. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/firewall_rule.rb +92 -0
  16. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/firewall_rule_list_result.rb +55 -0
  17. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/geo_redundant_backup.rb +16 -0
  18. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/log_file.rb +120 -0
  19. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/log_file_list_result.rb +55 -0
  20. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/name_availability.rb +68 -0
  21. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/name_availability_request.rb +57 -0
  22. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/operation.rb +95 -0
  23. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/operation_display.rb +83 -0
  24. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/operation_list_result.rb +55 -0
  25. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/operation_origin.rb +17 -0
  26. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/performance_tier_list_result.rb +56 -0
  27. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/performance_tier_properties.rb +67 -0
  28. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/performance_tier_service_level_objectives.rb +126 -0
  29. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/proxy_resource.rb +71 -0
  30. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server.rb +183 -0
  31. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_for_create.rb +92 -0
  32. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_list_result.rb +55 -0
  33. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_properties_for_create.rb +85 -0
  34. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_properties_for_default_create.rb +100 -0
  35. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_properties_for_geo_restore.rb +88 -0
  36. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_properties_for_restore.rb +99 -0
  37. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_security_alert_policy.rb +166 -0
  38. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_security_alert_policy_state.rb +16 -0
  39. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_state.rb +17 -0
  40. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_update_parameters.rb +115 -0
  41. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/server_version.rb +16 -0
  42. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/sku.rb +97 -0
  43. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/sku_tier.rb +17 -0
  44. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/ssl_enforcement_enum.rb +16 -0
  45. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/storage_profile.rb +69 -0
  46. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/tracked_resource.rb +93 -0
  47. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/virtual_network_rule.rb +99 -0
  48. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/virtual_network_rule_list_result.rb +100 -0
  49. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/models/virtual_network_rule_state.rb +19 -0
  50. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/module_definition.rb +9 -0
  51. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/operations.rb +107 -0
  52. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/server_security_alert_policies.rb +287 -0
  53. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/servers.rb +772 -0
  54. data/lib/2018-06-01-preview/generated/azure_mgmt_mariadb/virtual_network_rules.rb +663 -0
  55. data/lib/2018-06-01/generated/azure_mgmt_mariadb.rb +78 -0
  56. data/lib/2018-06-01/generated/azure_mgmt_mariadb/check_name_availability.rb +123 -0
  57. data/lib/2018-06-01/generated/azure_mgmt_mariadb/configurations.rb +393 -0
  58. data/lib/2018-06-01/generated/azure_mgmt_mariadb/databases.rb +538 -0
  59. data/lib/2018-06-01/generated/azure_mgmt_mariadb/firewall_rules.rb +538 -0
  60. data/lib/2018-06-01/generated/azure_mgmt_mariadb/location_based_performance_tier.rb +113 -0
  61. data/lib/2018-06-01/generated/azure_mgmt_mariadb/log_files.rb +123 -0
  62. data/lib/2018-06-01/generated/azure_mgmt_mariadb/maria_dbmanagement_client.rb +172 -0
  63. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/configuration.rb +132 -0
  64. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/configuration_list_result.rb +55 -0
  65. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/database.rb +84 -0
  66. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/database_list_result.rb +55 -0
  67. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/firewall_rule.rb +92 -0
  68. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/firewall_rule_list_result.rb +55 -0
  69. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/geo_redundant_backup.rb +16 -0
  70. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/log_file.rb +120 -0
  71. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/log_file_list_result.rb +55 -0
  72. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/name_availability.rb +68 -0
  73. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/name_availability_request.rb +57 -0
  74. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/operation.rb +95 -0
  75. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/operation_display.rb +83 -0
  76. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/operation_list_result.rb +55 -0
  77. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/operation_origin.rb +17 -0
  78. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/performance_tier_list_result.rb +56 -0
  79. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/performance_tier_properties.rb +67 -0
  80. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/performance_tier_service_level_objectives.rb +126 -0
  81. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/proxy_resource.rb +71 -0
  82. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server.rb +220 -0
  83. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_for_create.rb +92 -0
  84. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_list_result.rb +55 -0
  85. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_properties_for_create.rb +86 -0
  86. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_properties_for_default_create.rb +100 -0
  87. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_properties_for_geo_restore.rb +88 -0
  88. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_properties_for_replica.rb +87 -0
  89. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_properties_for_restore.rb +99 -0
  90. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_security_alert_policy.rb +166 -0
  91. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_security_alert_policy_state.rb +16 -0
  92. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_state.rb +17 -0
  93. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_update_parameters.rb +126 -0
  94. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/server_version.rb +16 -0
  95. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/sku.rb +97 -0
  96. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/sku_tier.rb +17 -0
  97. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/ssl_enforcement_enum.rb +16 -0
  98. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/storage_profile.rb +69 -0
  99. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/tracked_resource.rb +93 -0
  100. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/virtual_network_rule.rb +99 -0
  101. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/virtual_network_rule_list_result.rb +100 -0
  102. data/lib/2018-06-01/generated/azure_mgmt_mariadb/models/virtual_network_rule_state.rb +19 -0
  103. data/lib/2018-06-01/generated/azure_mgmt_mariadb/module_definition.rb +9 -0
  104. data/lib/2018-06-01/generated/azure_mgmt_mariadb/operations.rb +107 -0
  105. data/lib/2018-06-01/generated/azure_mgmt_mariadb/replicas.rb +123 -0
  106. data/lib/2018-06-01/generated/azure_mgmt_mariadb/server_security_alert_policies.rb +287 -0
  107. data/lib/2018-06-01/generated/azure_mgmt_mariadb/servers.rb +901 -0
  108. data/lib/2018-06-01/generated/azure_mgmt_mariadb/virtual_network_rules.rb +663 -0
  109. data/lib/azure_mgmt_mariadb.rb +7 -0
  110. data/lib/module_definition.rb +9 -0
  111. data/lib/profiles/latest/mariadb_latest_profile_client.rb +40 -0
  112. data/lib/profiles/latest/mariadb_module_definition.rb +8 -0
  113. data/lib/profiles/latest/modules/mariadb_profile_module.rb +241 -0
  114. data/lib/version.rb +7 -0
  115. metadata +231 -0
@@ -0,0 +1,123 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::MariaDB::Mgmt::V2018_06_01
7
+ #
8
+ # MariaDB Client
9
+ #
10
+ class Replicas
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Replicas class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MariaDBManagementClient] reference to the MariaDBManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List all the replicas for a given server.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group that
28
+ # contains the resource. You can obtain this value from the Azure Resource
29
+ # Manager API or the portal.
30
+ # @param server_name [String] The name of the server.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ServerListResult] operation results.
35
+ #
36
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
37
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # List all the replicas for a given server.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group that
45
+ # contains the resource. You can obtain this value from the Azure Resource
46
+ # Manager API or the portal.
47
+ # @param server_name [String] The name of the server.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
54
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # List all the replicas for a given server.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group that
61
+ # contains the resource. You can obtain this value from the Azure Resource
62
+ # Manager API or the portal.
63
+ # @param server_name [String] The name of the server.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
70
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
71
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/replicas'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerListResult.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ end
123
+ end
@@ -0,0 +1,287 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::MariaDB::Mgmt::V2018_06_01
7
+ #
8
+ # MariaDB Client
9
+ #
10
+ class ServerSecurityAlertPolicies
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ServerSecurityAlertPolicies class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MariaDBManagementClient] reference to the MariaDBManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get a server's security alert policy.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group that
28
+ # contains the resource. You can obtain this value from the Azure Resource
29
+ # Manager API or the portal.
30
+ # @param server_name [String] The name of the server.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ServerSecurityAlertPolicy] operation results.
35
+ #
36
+ def get(resource_group_name, server_name, custom_headers:nil)
37
+ response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Get a server's security alert policy.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group that
45
+ # contains the resource. You can obtain this value from the Azure Resource
46
+ # Manager API or the portal.
47
+ # @param server_name [String] The name of the server.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
54
+ get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Get a server's security alert policy.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group that
61
+ # contains the resource. You can obtain this value from the Azure Resource
62
+ # Manager API or the portal.
63
+ # @param server_name [String] The name of the server.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def get_async(resource_group_name, server_name, custom_headers:nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
72
+ security_alert_policy_name = 'Default'
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ # Deserialize Response
107
+ if status_code == 200
108
+ begin
109
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
110
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerSecurityAlertPolicy.mapper()
111
+ result.body = @client.deserialize(result_mapper, parsed_response)
112
+ rescue Exception => e
113
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
+ end
115
+ end
116
+
117
+ result
118
+ end
119
+
120
+ promise.execute
121
+ end
122
+
123
+ #
124
+ # Creates or updates a threat detection policy.
125
+ #
126
+ # @param resource_group_name [String] The name of the resource group that
127
+ # contains the resource. You can obtain this value from the Azure Resource
128
+ # Manager API or the portal.
129
+ # @param server_name [String] The name of the server.
130
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
131
+ # policy.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [ServerSecurityAlertPolicy] operation results.
136
+ #
137
+ def create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
138
+ response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group that
144
+ # contains the resource. You can obtain this value from the Azure Resource
145
+ # Manager API or the portal.
146
+ # @param server_name [String] The name of the server.
147
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
148
+ # policy.
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] promise which provides async access to http
153
+ # response.
154
+ #
155
+ def create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
156
+ # Send request
157
+ promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
158
+
159
+ promise = promise.then do |response|
160
+ # Defining deserialization method.
161
+ deserialize_method = lambda do |parsed_response|
162
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerSecurityAlertPolicy.mapper()
163
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
164
+ end
165
+
166
+ # Waiting for response.
167
+ @client.get_long_running_operation_result(response, deserialize_method)
168
+ end
169
+
170
+ promise
171
+ end
172
+
173
+ #
174
+ # Creates or updates a threat detection policy.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group that
177
+ # contains the resource. You can obtain this value from the Azure Resource
178
+ # Manager API or the portal.
179
+ # @param server_name [String] The name of the server.
180
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
181
+ # policy.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [ServerSecurityAlertPolicy] operation results.
186
+ #
187
+ def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
188
+ response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
189
+ response.body unless response.nil?
190
+ end
191
+
192
+ #
193
+ # Creates or updates a threat detection policy.
194
+ #
195
+ # @param resource_group_name [String] The name of the resource group that
196
+ # contains the resource. You can obtain this value from the Azure Resource
197
+ # Manager API or the portal.
198
+ # @param server_name [String] The name of the server.
199
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
200
+ # policy.
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
205
+ #
206
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
207
+ begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
208
+ end
209
+
210
+ #
211
+ # Creates or updates a threat detection policy.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group that
214
+ # contains the resource. You can obtain this value from the Azure Resource
215
+ # Manager API or the portal.
216
+ # @param server_name [String] The name of the server.
217
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
218
+ # policy.
219
+ # @param [Hash{String => String}] A hash of custom headers that will be added
220
+ # to the HTTP request.
221
+ #
222
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
223
+ #
224
+ def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
225
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
226
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
227
+ security_alert_policy_name = 'Default'
228
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
229
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
230
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
231
+
232
+
233
+ request_headers = {}
234
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
235
+
236
+ # Set Headers
237
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
238
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
239
+
240
+ # Serialize Request
241
+ request_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerSecurityAlertPolicy.mapper()
242
+ request_content = @client.serialize(request_mapper, parameters)
243
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
244
+
245
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
246
+
247
+ request_url = @base_url || @client.base_url
248
+
249
+ options = {
250
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
251
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
252
+ query_params: {'api-version' => @client.api_version},
253
+ body: request_content,
254
+ headers: request_headers.merge(custom_headers || {}),
255
+ base_url: request_url
256
+ }
257
+ promise = @client.make_request_async(:put, path_template, options)
258
+
259
+ promise = promise.then do |result|
260
+ http_response = result.response
261
+ status_code = http_response.status
262
+ response_content = http_response.body
263
+ unless status_code == 200 || status_code == 202
264
+ error_model = JSON.load(response_content)
265
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
266
+ end
267
+
268
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
269
+ # Deserialize Response
270
+ if status_code == 200
271
+ begin
272
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
273
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerSecurityAlertPolicy.mapper()
274
+ result.body = @client.deserialize(result_mapper, parsed_response)
275
+ rescue Exception => e
276
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
277
+ end
278
+ end
279
+
280
+ result
281
+ end
282
+
283
+ promise.execute
284
+ end
285
+
286
+ end
287
+ end
@@ -0,0 +1,901 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::MariaDB::Mgmt::V2018_06_01
7
+ #
8
+ # MariaDB Client
9
+ #
10
+ class Servers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Servers class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MariaDBManagementClient] reference to the MariaDBManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates a new server or updates an existing server. The update action will
26
+ # overwrite the existing server.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group that
29
+ # contains the resource. You can obtain this value from the Azure Resource
30
+ # Manager API or the portal.
31
+ # @param server_name [String] The name of the server.
32
+ # @param parameters [ServerForCreate] The required parameters for creating or
33
+ # updating a server.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Server] operation results.
38
+ #
39
+ def create(resource_group_name, server_name, parameters, custom_headers:nil)
40
+ response = create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # @param resource_group_name [String] The name of the resource group that
46
+ # contains the resource. You can obtain this value from the Azure Resource
47
+ # Manager API or the portal.
48
+ # @param server_name [String] The name of the server.
49
+ # @param parameters [ServerForCreate] The required parameters for creating or
50
+ # updating a server.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [Concurrent::Promise] promise which provides async access to http
55
+ # response.
56
+ #
57
+ def create_async(resource_group_name, server_name, parameters, custom_headers:nil)
58
+ # Send request
59
+ promise = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
60
+
61
+ promise = promise.then do |response|
62
+ # Defining deserialization method.
63
+ deserialize_method = lambda do |parsed_response|
64
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
65
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
66
+ end
67
+
68
+ # Waiting for response.
69
+ @client.get_long_running_operation_result(response, deserialize_method)
70
+ end
71
+
72
+ promise
73
+ end
74
+
75
+ #
76
+ # Updates an existing server. The request body can contain one to many of the
77
+ # properties present in the normal server definition.
78
+ #
79
+ # @param resource_group_name [String] The name of the resource group that
80
+ # contains the resource. You can obtain this value from the Azure Resource
81
+ # Manager API or the portal.
82
+ # @param server_name [String] The name of the server.
83
+ # @param parameters [ServerUpdateParameters] The required parameters for
84
+ # updating a server.
85
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
86
+ # will be added to the HTTP request.
87
+ #
88
+ # @return [Server] operation results.
89
+ #
90
+ def update(resource_group_name, server_name, parameters, custom_headers:nil)
91
+ response = update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
92
+ response.body unless response.nil?
93
+ end
94
+
95
+ #
96
+ # @param resource_group_name [String] The name of the resource group that
97
+ # contains the resource. You can obtain this value from the Azure Resource
98
+ # Manager API or the portal.
99
+ # @param server_name [String] The name of the server.
100
+ # @param parameters [ServerUpdateParameters] The required parameters for
101
+ # updating a server.
102
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
103
+ # will be added to the HTTP request.
104
+ #
105
+ # @return [Concurrent::Promise] promise which provides async access to http
106
+ # response.
107
+ #
108
+ def update_async(resource_group_name, server_name, parameters, custom_headers:nil)
109
+ # Send request
110
+ promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
111
+
112
+ promise = promise.then do |response|
113
+ # Defining deserialization method.
114
+ deserialize_method = lambda do |parsed_response|
115
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
116
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
117
+ end
118
+
119
+ # Waiting for response.
120
+ @client.get_long_running_operation_result(response, deserialize_method)
121
+ end
122
+
123
+ promise
124
+ end
125
+
126
+ #
127
+ # Deletes a server.
128
+ #
129
+ # @param resource_group_name [String] The name of the resource group that
130
+ # contains the resource. You can obtain this value from the Azure Resource
131
+ # Manager API or the portal.
132
+ # @param server_name [String] The name of the server.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ def delete(resource_group_name, server_name, custom_headers:nil)
137
+ response = delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
138
+ nil
139
+ end
140
+
141
+ #
142
+ # @param resource_group_name [String] The name of the resource group that
143
+ # contains the resource. You can obtain this value from the Azure Resource
144
+ # Manager API or the portal.
145
+ # @param server_name [String] The name of the server.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] promise which provides async access to http
150
+ # response.
151
+ #
152
+ def delete_async(resource_group_name, server_name, custom_headers:nil)
153
+ # Send request
154
+ promise = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers)
155
+
156
+ promise = promise.then do |response|
157
+ # Defining deserialization method.
158
+ deserialize_method = lambda do |parsed_response|
159
+ end
160
+
161
+ # Waiting for response.
162
+ @client.get_long_running_operation_result(response, deserialize_method)
163
+ end
164
+
165
+ promise
166
+ end
167
+
168
+ #
169
+ # Gets information about a server.
170
+ #
171
+ # @param resource_group_name [String] The name of the resource group that
172
+ # contains the resource. You can obtain this value from the Azure Resource
173
+ # Manager API or the portal.
174
+ # @param server_name [String] The name of the server.
175
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
176
+ # will be added to the HTTP request.
177
+ #
178
+ # @return [Server] operation results.
179
+ #
180
+ def get(resource_group_name, server_name, custom_headers:nil)
181
+ response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
182
+ response.body unless response.nil?
183
+ end
184
+
185
+ #
186
+ # Gets information about a server.
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group that
189
+ # contains the resource. You can obtain this value from the Azure Resource
190
+ # Manager API or the portal.
191
+ # @param server_name [String] The name of the server.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
196
+ #
197
+ def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
198
+ get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
199
+ end
200
+
201
+ #
202
+ # Gets information about a server.
203
+ #
204
+ # @param resource_group_name [String] The name of the resource group that
205
+ # contains the resource. You can obtain this value from the Azure Resource
206
+ # Manager API or the portal.
207
+ # @param server_name [String] The name of the server.
208
+ # @param [Hash{String => String}] A hash of custom headers that will be added
209
+ # to the HTTP request.
210
+ #
211
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
212
+ #
213
+ def get_async(resource_group_name, server_name, custom_headers:nil)
214
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
215
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
216
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
217
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
218
+
219
+
220
+ request_headers = {}
221
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
222
+
223
+ # Set Headers
224
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
225
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
226
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
227
+
228
+ request_url = @base_url || @client.base_url
229
+
230
+ options = {
231
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
232
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
233
+ query_params: {'api-version' => @client.api_version},
234
+ headers: request_headers.merge(custom_headers || {}),
235
+ base_url: request_url
236
+ }
237
+ promise = @client.make_request_async(:get, path_template, options)
238
+
239
+ promise = promise.then do |result|
240
+ http_response = result.response
241
+ status_code = http_response.status
242
+ response_content = http_response.body
243
+ unless status_code == 200
244
+ error_model = JSON.load(response_content)
245
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
246
+ end
247
+
248
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
249
+ # Deserialize Response
250
+ if status_code == 200
251
+ begin
252
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
253
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
254
+ result.body = @client.deserialize(result_mapper, parsed_response)
255
+ rescue Exception => e
256
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
257
+ end
258
+ end
259
+
260
+ result
261
+ end
262
+
263
+ promise.execute
264
+ end
265
+
266
+ #
267
+ # List all the servers in a given resource group.
268
+ #
269
+ # @param resource_group_name [String] The name of the resource group that
270
+ # contains the resource. You can obtain this value from the Azure Resource
271
+ # Manager API or the portal.
272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
273
+ # will be added to the HTTP request.
274
+ #
275
+ # @return [ServerListResult] operation results.
276
+ #
277
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
278
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
279
+ response.body unless response.nil?
280
+ end
281
+
282
+ #
283
+ # List all the servers in a given resource group.
284
+ #
285
+ # @param resource_group_name [String] The name of the resource group that
286
+ # contains the resource. You can obtain this value from the Azure Resource
287
+ # Manager API or the portal.
288
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
289
+ # will be added to the HTTP request.
290
+ #
291
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
292
+ #
293
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
294
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
295
+ end
296
+
297
+ #
298
+ # List all the servers in a given resource group.
299
+ #
300
+ # @param resource_group_name [String] The name of the resource group that
301
+ # contains the resource. You can obtain this value from the Azure Resource
302
+ # Manager API or the portal.
303
+ # @param [Hash{String => String}] A hash of custom headers that will be added
304
+ # to the HTTP request.
305
+ #
306
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
307
+ #
308
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
309
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
310
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
311
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
312
+
313
+
314
+ request_headers = {}
315
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers'
321
+
322
+ request_url = @base_url || @client.base_url
323
+
324
+ options = {
325
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
326
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
327
+ query_params: {'api-version' => @client.api_version},
328
+ headers: request_headers.merge(custom_headers || {}),
329
+ base_url: request_url
330
+ }
331
+ promise = @client.make_request_async(:get, path_template, options)
332
+
333
+ promise = promise.then do |result|
334
+ http_response = result.response
335
+ status_code = http_response.status
336
+ response_content = http_response.body
337
+ unless status_code == 200
338
+ error_model = JSON.load(response_content)
339
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
340
+ end
341
+
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ # Deserialize Response
344
+ if status_code == 200
345
+ begin
346
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
347
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerListResult.mapper()
348
+ result.body = @client.deserialize(result_mapper, parsed_response)
349
+ rescue Exception => e
350
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
351
+ end
352
+ end
353
+
354
+ result
355
+ end
356
+
357
+ promise.execute
358
+ end
359
+
360
+ #
361
+ # List all the servers in a given subscription.
362
+ #
363
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
364
+ # will be added to the HTTP request.
365
+ #
366
+ # @return [ServerListResult] operation results.
367
+ #
368
+ def list(custom_headers:nil)
369
+ response = list_async(custom_headers:custom_headers).value!
370
+ response.body unless response.nil?
371
+ end
372
+
373
+ #
374
+ # List all the servers in a given subscription.
375
+ #
376
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
377
+ # will be added to the HTTP request.
378
+ #
379
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
380
+ #
381
+ def list_with_http_info(custom_headers:nil)
382
+ list_async(custom_headers:custom_headers).value!
383
+ end
384
+
385
+ #
386
+ # List all the servers in a given subscription.
387
+ #
388
+ # @param [Hash{String => String}] A hash of custom headers that will be added
389
+ # to the HTTP request.
390
+ #
391
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
392
+ #
393
+ def list_async(custom_headers:nil)
394
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
395
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
396
+
397
+
398
+ request_headers = {}
399
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
400
+
401
+ # Set Headers
402
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
403
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
404
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/servers'
405
+
406
+ request_url = @base_url || @client.base_url
407
+
408
+ options = {
409
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
410
+ path_params: {'subscriptionId' => @client.subscription_id},
411
+ query_params: {'api-version' => @client.api_version},
412
+ headers: request_headers.merge(custom_headers || {}),
413
+ base_url: request_url
414
+ }
415
+ promise = @client.make_request_async(:get, path_template, options)
416
+
417
+ promise = promise.then do |result|
418
+ http_response = result.response
419
+ status_code = http_response.status
420
+ response_content = http_response.body
421
+ unless status_code == 200
422
+ error_model = JSON.load(response_content)
423
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
424
+ end
425
+
426
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
427
+ # Deserialize Response
428
+ if status_code == 200
429
+ begin
430
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
431
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerListResult.mapper()
432
+ result.body = @client.deserialize(result_mapper, parsed_response)
433
+ rescue Exception => e
434
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
435
+ end
436
+ end
437
+
438
+ result
439
+ end
440
+
441
+ promise.execute
442
+ end
443
+
444
+ #
445
+ # Restarts a server.
446
+ #
447
+ # @param resource_group_name [String] The name of the resource group that
448
+ # contains the resource. You can obtain this value from the Azure Resource
449
+ # Manager API or the portal.
450
+ # @param server_name [String] The name of the server.
451
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
452
+ # will be added to the HTTP request.
453
+ #
454
+ def restart(resource_group_name, server_name, custom_headers:nil)
455
+ response = restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
456
+ nil
457
+ end
458
+
459
+ #
460
+ # @param resource_group_name [String] The name of the resource group that
461
+ # contains the resource. You can obtain this value from the Azure Resource
462
+ # Manager API or the portal.
463
+ # @param server_name [String] The name of the server.
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ # @return [Concurrent::Promise] promise which provides async access to http
468
+ # response.
469
+ #
470
+ def restart_async(resource_group_name, server_name, custom_headers:nil)
471
+ # Send request
472
+ promise = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers)
473
+
474
+ promise = promise.then do |response|
475
+ # Defining deserialization method.
476
+ deserialize_method = lambda do |parsed_response|
477
+ end
478
+
479
+ # Waiting for response.
480
+ @client.get_long_running_operation_result(response, deserialize_method)
481
+ end
482
+
483
+ promise
484
+ end
485
+
486
+ #
487
+ # Creates a new server or updates an existing server. The update action will
488
+ # overwrite the existing server.
489
+ #
490
+ # @param resource_group_name [String] The name of the resource group that
491
+ # contains the resource. You can obtain this value from the Azure Resource
492
+ # Manager API or the portal.
493
+ # @param server_name [String] The name of the server.
494
+ # @param parameters [ServerForCreate] The required parameters for creating or
495
+ # updating a server.
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [Server] operation results.
500
+ #
501
+ def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
502
+ response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
503
+ response.body unless response.nil?
504
+ end
505
+
506
+ #
507
+ # Creates a new server or updates an existing server. The update action will
508
+ # overwrite the existing server.
509
+ #
510
+ # @param resource_group_name [String] The name of the resource group that
511
+ # contains the resource. You can obtain this value from the Azure Resource
512
+ # Manager API or the portal.
513
+ # @param server_name [String] The name of the server.
514
+ # @param parameters [ServerForCreate] The required parameters for creating or
515
+ # updating a server.
516
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
517
+ # will be added to the HTTP request.
518
+ #
519
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
520
+ #
521
+ def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
522
+ begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
523
+ end
524
+
525
+ #
526
+ # Creates a new server or updates an existing server. The update action will
527
+ # overwrite the existing server.
528
+ #
529
+ # @param resource_group_name [String] The name of the resource group that
530
+ # contains the resource. You can obtain this value from the Azure Resource
531
+ # Manager API or the portal.
532
+ # @param server_name [String] The name of the server.
533
+ # @param parameters [ServerForCreate] The required parameters for creating or
534
+ # updating a server.
535
+ # @param [Hash{String => String}] A hash of custom headers that will be added
536
+ # to the HTTP request.
537
+ #
538
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
539
+ #
540
+ def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil)
541
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
542
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
543
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
544
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
545
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
546
+
547
+
548
+ request_headers = {}
549
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
550
+
551
+ # Set Headers
552
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
553
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
554
+
555
+ # Serialize Request
556
+ request_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerForCreate.mapper()
557
+ request_content = @client.serialize(request_mapper, parameters)
558
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
559
+
560
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
561
+
562
+ request_url = @base_url || @client.base_url
563
+
564
+ options = {
565
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
566
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
567
+ query_params: {'api-version' => @client.api_version},
568
+ body: request_content,
569
+ headers: request_headers.merge(custom_headers || {}),
570
+ base_url: request_url
571
+ }
572
+ promise = @client.make_request_async(:put, path_template, options)
573
+
574
+ promise = promise.then do |result|
575
+ http_response = result.response
576
+ status_code = http_response.status
577
+ response_content = http_response.body
578
+ unless status_code == 200 || status_code == 201 || status_code == 202
579
+ error_model = JSON.load(response_content)
580
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
581
+ end
582
+
583
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
584
+ # Deserialize Response
585
+ if status_code == 200
586
+ begin
587
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
588
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
589
+ result.body = @client.deserialize(result_mapper, parsed_response)
590
+ rescue Exception => e
591
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
592
+ end
593
+ end
594
+ # Deserialize Response
595
+ if status_code == 201
596
+ begin
597
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
598
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
599
+ result.body = @client.deserialize(result_mapper, parsed_response)
600
+ rescue Exception => e
601
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
602
+ end
603
+ end
604
+
605
+ result
606
+ end
607
+
608
+ promise.execute
609
+ end
610
+
611
+ #
612
+ # Updates an existing server. The request body can contain one to many of the
613
+ # properties present in the normal server definition.
614
+ #
615
+ # @param resource_group_name [String] The name of the resource group that
616
+ # contains the resource. You can obtain this value from the Azure Resource
617
+ # Manager API or the portal.
618
+ # @param server_name [String] The name of the server.
619
+ # @param parameters [ServerUpdateParameters] The required parameters for
620
+ # updating a server.
621
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
622
+ # will be added to the HTTP request.
623
+ #
624
+ # @return [Server] operation results.
625
+ #
626
+ def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
627
+ response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
628
+ response.body unless response.nil?
629
+ end
630
+
631
+ #
632
+ # Updates an existing server. The request body can contain one to many of the
633
+ # properties present in the normal server definition.
634
+ #
635
+ # @param resource_group_name [String] The name of the resource group that
636
+ # contains the resource. You can obtain this value from the Azure Resource
637
+ # Manager API or the portal.
638
+ # @param server_name [String] The name of the server.
639
+ # @param parameters [ServerUpdateParameters] The required parameters for
640
+ # updating a server.
641
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
642
+ # will be added to the HTTP request.
643
+ #
644
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
645
+ #
646
+ def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
647
+ begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
648
+ end
649
+
650
+ #
651
+ # Updates an existing server. The request body can contain one to many of the
652
+ # properties present in the normal server definition.
653
+ #
654
+ # @param resource_group_name [String] The name of the resource group that
655
+ # contains the resource. You can obtain this value from the Azure Resource
656
+ # Manager API or the portal.
657
+ # @param server_name [String] The name of the server.
658
+ # @param parameters [ServerUpdateParameters] The required parameters for
659
+ # updating a server.
660
+ # @param [Hash{String => String}] A hash of custom headers that will be added
661
+ # to the HTTP request.
662
+ #
663
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
664
+ #
665
+ def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
666
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
667
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
668
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
669
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
670
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
671
+
672
+
673
+ request_headers = {}
674
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
675
+
676
+ # Set Headers
677
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
678
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
679
+
680
+ # Serialize Request
681
+ request_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::ServerUpdateParameters.mapper()
682
+ request_content = @client.serialize(request_mapper, parameters)
683
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
684
+
685
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
686
+
687
+ request_url = @base_url || @client.base_url
688
+
689
+ options = {
690
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
691
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
692
+ query_params: {'api-version' => @client.api_version},
693
+ body: request_content,
694
+ headers: request_headers.merge(custom_headers || {}),
695
+ base_url: request_url
696
+ }
697
+ promise = @client.make_request_async(:patch, path_template, options)
698
+
699
+ promise = promise.then do |result|
700
+ http_response = result.response
701
+ status_code = http_response.status
702
+ response_content = http_response.body
703
+ unless status_code == 200 || status_code == 202
704
+ error_model = JSON.load(response_content)
705
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
706
+ end
707
+
708
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
709
+ # Deserialize Response
710
+ if status_code == 200
711
+ begin
712
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
713
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01::Models::Server.mapper()
714
+ result.body = @client.deserialize(result_mapper, parsed_response)
715
+ rescue Exception => e
716
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
717
+ end
718
+ end
719
+
720
+ result
721
+ end
722
+
723
+ promise.execute
724
+ end
725
+
726
+ #
727
+ # Deletes a server.
728
+ #
729
+ # @param resource_group_name [String] The name of the resource group that
730
+ # contains the resource. You can obtain this value from the Azure Resource
731
+ # Manager API or the portal.
732
+ # @param server_name [String] The name of the server.
733
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
734
+ # will be added to the HTTP request.
735
+ #
736
+ #
737
+ def begin_delete(resource_group_name, server_name, custom_headers:nil)
738
+ response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
739
+ nil
740
+ end
741
+
742
+ #
743
+ # Deletes a server.
744
+ #
745
+ # @param resource_group_name [String] The name of the resource group that
746
+ # contains the resource. You can obtain this value from the Azure Resource
747
+ # Manager API or the portal.
748
+ # @param server_name [String] The name of the server.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
753
+ #
754
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
755
+ begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
756
+ end
757
+
758
+ #
759
+ # Deletes a server.
760
+ #
761
+ # @param resource_group_name [String] The name of the resource group that
762
+ # contains the resource. You can obtain this value from the Azure Resource
763
+ # Manager API or the portal.
764
+ # @param server_name [String] The name of the server.
765
+ # @param [Hash{String => String}] A hash of custom headers that will be added
766
+ # to the HTTP request.
767
+ #
768
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
769
+ #
770
+ def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
771
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
772
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
773
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
774
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
775
+
776
+
777
+ request_headers = {}
778
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
779
+
780
+ # Set Headers
781
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
782
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
783
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
784
+
785
+ request_url = @base_url || @client.base_url
786
+
787
+ options = {
788
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
789
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
790
+ query_params: {'api-version' => @client.api_version},
791
+ headers: request_headers.merge(custom_headers || {}),
792
+ base_url: request_url
793
+ }
794
+ promise = @client.make_request_async(:delete, path_template, options)
795
+
796
+ promise = promise.then do |result|
797
+ http_response = result.response
798
+ status_code = http_response.status
799
+ response_content = http_response.body
800
+ unless status_code == 200 || status_code == 202 || status_code == 204
801
+ error_model = JSON.load(response_content)
802
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
803
+ end
804
+
805
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
806
+
807
+ result
808
+ end
809
+
810
+ promise.execute
811
+ end
812
+
813
+ #
814
+ # Restarts a server.
815
+ #
816
+ # @param resource_group_name [String] The name of the resource group that
817
+ # contains the resource. You can obtain this value from the Azure Resource
818
+ # Manager API or the portal.
819
+ # @param server_name [String] The name of the server.
820
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
821
+ # will be added to the HTTP request.
822
+ #
823
+ #
824
+ def begin_restart(resource_group_name, server_name, custom_headers:nil)
825
+ response = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
826
+ nil
827
+ end
828
+
829
+ #
830
+ # Restarts a server.
831
+ #
832
+ # @param resource_group_name [String] The name of the resource group that
833
+ # contains the resource. You can obtain this value from the Azure Resource
834
+ # Manager API or the portal.
835
+ # @param server_name [String] The name of the server.
836
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
837
+ # will be added to the HTTP request.
838
+ #
839
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
840
+ #
841
+ def begin_restart_with_http_info(resource_group_name, server_name, custom_headers:nil)
842
+ begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
843
+ end
844
+
845
+ #
846
+ # Restarts a server.
847
+ #
848
+ # @param resource_group_name [String] The name of the resource group that
849
+ # contains the resource. You can obtain this value from the Azure Resource
850
+ # Manager API or the portal.
851
+ # @param server_name [String] The name of the server.
852
+ # @param [Hash{String => String}] A hash of custom headers that will be added
853
+ # to the HTTP request.
854
+ #
855
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
856
+ #
857
+ def begin_restart_async(resource_group_name, server_name, custom_headers:nil)
858
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
859
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
860
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
861
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
862
+
863
+
864
+ request_headers = {}
865
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
866
+
867
+ # Set Headers
868
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
869
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
870
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/restart'
871
+
872
+ request_url = @base_url || @client.base_url
873
+
874
+ options = {
875
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
876
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
877
+ query_params: {'api-version' => @client.api_version},
878
+ headers: request_headers.merge(custom_headers || {}),
879
+ base_url: request_url
880
+ }
881
+ promise = @client.make_request_async(:post, path_template, options)
882
+
883
+ promise = promise.then do |result|
884
+ http_response = result.response
885
+ status_code = http_response.status
886
+ response_content = http_response.body
887
+ unless status_code == 200 || status_code == 202
888
+ error_model = JSON.load(response_content)
889
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
890
+ end
891
+
892
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
893
+
894
+ result
895
+ end
896
+
897
+ promise.execute
898
+ end
899
+
900
+ end
901
+ end