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,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_preview
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_preview::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_preview::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_preview::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_preview::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,772 @@
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_preview
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_preview::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_preview::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_preview::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_preview::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_preview::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
+ # Creates a new server or updates an existing server. The update action will
446
+ # overwrite the existing server.
447
+ #
448
+ # @param resource_group_name [String] The name of the resource group that
449
+ # contains the resource. You can obtain this value from the Azure Resource
450
+ # Manager API or the portal.
451
+ # @param server_name [String] The name of the server.
452
+ # @param parameters [ServerForCreate] The required parameters for creating or
453
+ # updating a server.
454
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
455
+ # will be added to the HTTP request.
456
+ #
457
+ # @return [Server] operation results.
458
+ #
459
+ def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
460
+ response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
461
+ response.body unless response.nil?
462
+ end
463
+
464
+ #
465
+ # Creates a new server or updates an existing server. The update action will
466
+ # overwrite the existing server.
467
+ #
468
+ # @param resource_group_name [String] The name of the resource group that
469
+ # contains the resource. You can obtain this value from the Azure Resource
470
+ # Manager API or the portal.
471
+ # @param server_name [String] The name of the server.
472
+ # @param parameters [ServerForCreate] The required parameters for creating or
473
+ # updating a server.
474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
475
+ # will be added to the HTTP request.
476
+ #
477
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
478
+ #
479
+ def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
480
+ begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
481
+ end
482
+
483
+ #
484
+ # Creates a new server or updates an existing server. The update action will
485
+ # overwrite the existing server.
486
+ #
487
+ # @param resource_group_name [String] The name of the resource group that
488
+ # contains the resource. You can obtain this value from the Azure Resource
489
+ # Manager API or the portal.
490
+ # @param server_name [String] The name of the server.
491
+ # @param parameters [ServerForCreate] The required parameters for creating or
492
+ # updating a server.
493
+ # @param [Hash{String => String}] A hash of custom headers that will be added
494
+ # to the HTTP request.
495
+ #
496
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
497
+ #
498
+ def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil)
499
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
500
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
501
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
502
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
503
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
504
+
505
+
506
+ request_headers = {}
507
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
508
+
509
+ # Set Headers
510
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
511
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
512
+
513
+ # Serialize Request
514
+ request_mapper = Azure::MariaDB::Mgmt::V2018_06_01_preview::Models::ServerForCreate.mapper()
515
+ request_content = @client.serialize(request_mapper, parameters)
516
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
517
+
518
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
519
+
520
+ request_url = @base_url || @client.base_url
521
+
522
+ options = {
523
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
524
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
525
+ query_params: {'api-version' => @client.api_version},
526
+ body: request_content,
527
+ headers: request_headers.merge(custom_headers || {}),
528
+ base_url: request_url
529
+ }
530
+ promise = @client.make_request_async(:put, path_template, options)
531
+
532
+ promise = promise.then do |result|
533
+ http_response = result.response
534
+ status_code = http_response.status
535
+ response_content = http_response.body
536
+ unless status_code == 200 || status_code == 201 || status_code == 202
537
+ error_model = JSON.load(response_content)
538
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
539
+ end
540
+
541
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
542
+ # Deserialize Response
543
+ if status_code == 200
544
+ begin
545
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
546
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01_preview::Models::Server.mapper()
547
+ result.body = @client.deserialize(result_mapper, parsed_response)
548
+ rescue Exception => e
549
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
550
+ end
551
+ end
552
+ # Deserialize Response
553
+ if status_code == 201
554
+ begin
555
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
556
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01_preview::Models::Server.mapper()
557
+ result.body = @client.deserialize(result_mapper, parsed_response)
558
+ rescue Exception => e
559
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
560
+ end
561
+ end
562
+
563
+ result
564
+ end
565
+
566
+ promise.execute
567
+ end
568
+
569
+ #
570
+ # Updates an existing server. The request body can contain one to many of the
571
+ # properties present in the normal server definition.
572
+ #
573
+ # @param resource_group_name [String] The name of the resource group that
574
+ # contains the resource. You can obtain this value from the Azure Resource
575
+ # Manager API or the portal.
576
+ # @param server_name [String] The name of the server.
577
+ # @param parameters [ServerUpdateParameters] The required parameters for
578
+ # updating a server.
579
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
580
+ # will be added to the HTTP request.
581
+ #
582
+ # @return [Server] operation results.
583
+ #
584
+ def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
585
+ response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
586
+ response.body unless response.nil?
587
+ end
588
+
589
+ #
590
+ # Updates an existing server. The request body can contain one to many of the
591
+ # properties present in the normal server definition.
592
+ #
593
+ # @param resource_group_name [String] The name of the resource group that
594
+ # contains the resource. You can obtain this value from the Azure Resource
595
+ # Manager API or the portal.
596
+ # @param server_name [String] The name of the server.
597
+ # @param parameters [ServerUpdateParameters] The required parameters for
598
+ # updating a server.
599
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
600
+ # will be added to the HTTP request.
601
+ #
602
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
603
+ #
604
+ def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
605
+ begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
606
+ end
607
+
608
+ #
609
+ # Updates an existing server. The request body can contain one to many of the
610
+ # properties present in the normal server definition.
611
+ #
612
+ # @param resource_group_name [String] The name of the resource group that
613
+ # contains the resource. You can obtain this value from the Azure Resource
614
+ # Manager API or the portal.
615
+ # @param server_name [String] The name of the server.
616
+ # @param parameters [ServerUpdateParameters] The required parameters for
617
+ # updating a server.
618
+ # @param [Hash{String => String}] A hash of custom headers that will be added
619
+ # to the HTTP request.
620
+ #
621
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
622
+ #
623
+ def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
624
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
625
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
626
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
627
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
628
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
629
+
630
+
631
+ request_headers = {}
632
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
633
+
634
+ # Set Headers
635
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
636
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
637
+
638
+ # Serialize Request
639
+ request_mapper = Azure::MariaDB::Mgmt::V2018_06_01_preview::Models::ServerUpdateParameters.mapper()
640
+ request_content = @client.serialize(request_mapper, parameters)
641
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
642
+
643
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
644
+
645
+ request_url = @base_url || @client.base_url
646
+
647
+ options = {
648
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
649
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
650
+ query_params: {'api-version' => @client.api_version},
651
+ body: request_content,
652
+ headers: request_headers.merge(custom_headers || {}),
653
+ base_url: request_url
654
+ }
655
+ promise = @client.make_request_async(:patch, path_template, options)
656
+
657
+ promise = promise.then do |result|
658
+ http_response = result.response
659
+ status_code = http_response.status
660
+ response_content = http_response.body
661
+ unless status_code == 200 || status_code == 202
662
+ error_model = JSON.load(response_content)
663
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
664
+ end
665
+
666
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
667
+ # Deserialize Response
668
+ if status_code == 200
669
+ begin
670
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
671
+ result_mapper = Azure::MariaDB::Mgmt::V2018_06_01_preview::Models::Server.mapper()
672
+ result.body = @client.deserialize(result_mapper, parsed_response)
673
+ rescue Exception => e
674
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
675
+ end
676
+ end
677
+
678
+ result
679
+ end
680
+
681
+ promise.execute
682
+ end
683
+
684
+ #
685
+ # Deletes a server.
686
+ #
687
+ # @param resource_group_name [String] The name of the resource group that
688
+ # contains the resource. You can obtain this value from the Azure Resource
689
+ # Manager API or the portal.
690
+ # @param server_name [String] The name of the server.
691
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
692
+ # will be added to the HTTP request.
693
+ #
694
+ #
695
+ def begin_delete(resource_group_name, server_name, custom_headers:nil)
696
+ response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
697
+ nil
698
+ end
699
+
700
+ #
701
+ # Deletes a server.
702
+ #
703
+ # @param resource_group_name [String] The name of the resource group that
704
+ # contains the resource. You can obtain this value from the Azure Resource
705
+ # Manager API or the portal.
706
+ # @param server_name [String] The name of the server.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
711
+ #
712
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
713
+ begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
714
+ end
715
+
716
+ #
717
+ # Deletes a server.
718
+ #
719
+ # @param resource_group_name [String] The name of the resource group that
720
+ # contains the resource. You can obtain this value from the Azure Resource
721
+ # Manager API or the portal.
722
+ # @param server_name [String] The name of the server.
723
+ # @param [Hash{String => String}] A hash of custom headers that will be added
724
+ # to the HTTP request.
725
+ #
726
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
727
+ #
728
+ def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
729
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
730
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
731
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
732
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
733
+
734
+
735
+ request_headers = {}
736
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
737
+
738
+ # Set Headers
739
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
740
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
741
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}'
742
+
743
+ request_url = @base_url || @client.base_url
744
+
745
+ options = {
746
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
747
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
748
+ query_params: {'api-version' => @client.api_version},
749
+ headers: request_headers.merge(custom_headers || {}),
750
+ base_url: request_url
751
+ }
752
+ promise = @client.make_request_async(:delete, path_template, options)
753
+
754
+ promise = promise.then do |result|
755
+ http_response = result.response
756
+ status_code = http_response.status
757
+ response_content = http_response.body
758
+ unless status_code == 200 || status_code == 202 || status_code == 204
759
+ error_model = JSON.load(response_content)
760
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
761
+ end
762
+
763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
764
+
765
+ result
766
+ end
767
+
768
+ promise.execute
769
+ end
770
+
771
+ end
772
+ end