azure_mgmt_sql 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +63 -6
  3. data/lib/generated/azure_mgmt_sql/databases.rb +2170 -0
  4. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +950 -0
  5. data/lib/generated/azure_mgmt_sql/models/column.rb +90 -0
  6. data/lib/generated/azure_mgmt_sql/models/create_mode.rb +21 -0
  7. data/lib/generated/azure_mgmt_sql/models/database.rb +366 -0
  8. data/lib/generated/azure_mgmt_sql/models/database_editions.rb +22 -0
  9. data/lib/generated/azure_mgmt_sql/models/database_list_result.rb +53 -0
  10. data/lib/generated/azure_mgmt_sql/models/database_metric.rb +100 -0
  11. data/lib/generated/azure_mgmt_sql/models/database_metric_list_result.rb +53 -0
  12. data/lib/generated/azure_mgmt_sql/models/elastic_pool.rb +158 -0
  13. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity.rb +257 -0
  14. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb +54 -0
  15. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb +249 -0
  16. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb +54 -0
  17. data/lib/generated/azure_mgmt_sql/models/elastic_pool_editions.rb +17 -0
  18. data/lib/generated/azure_mgmt_sql/models/elastic_pool_list_result.rb +53 -0
  19. data/lib/generated/azure_mgmt_sql/models/{state.rb → elastic_pool_state.rb} +5 -5
  20. data/lib/generated/azure_mgmt_sql/models/operation_impact.rb +80 -0
  21. data/lib/generated/azure_mgmt_sql/models/recommended_database_properties.rb +68 -0
  22. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool.rb +216 -0
  23. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb +54 -0
  24. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb +54 -0
  25. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb +65 -0
  26. data/lib/generated/azure_mgmt_sql/models/recommended_index.rb +260 -0
  27. data/lib/generated/azure_mgmt_sql/models/recommended_index_actions.rb +17 -0
  28. data/lib/generated/azure_mgmt_sql/models/recommended_index_states.rb +25 -0
  29. data/lib/generated/azure_mgmt_sql/models/recommended_index_types.rb +18 -0
  30. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +149 -0
  31. data/lib/generated/azure_mgmt_sql/models/replication_link_list_result.rb +54 -0
  32. data/lib/generated/azure_mgmt_sql/models/replication_role.rb +19 -0
  33. data/lib/generated/azure_mgmt_sql/models/replication_state.rb +18 -0
  34. data/lib/generated/azure_mgmt_sql/models/restore_point.rb +117 -0
  35. data/lib/generated/azure_mgmt_sql/models/restore_point_list_result.rb +54 -0
  36. data/lib/generated/azure_mgmt_sql/models/restore_point_types.rb +16 -0
  37. data/lib/generated/azure_mgmt_sql/models/schema.rb +98 -0
  38. data/lib/generated/azure_mgmt_sql/models/{server_security_alert_policy.rb → server.rb} +32 -37
  39. data/lib/generated/azure_mgmt_sql/models/server_firewall_rule.rb +95 -0
  40. data/lib/generated/azure_mgmt_sql/models/server_firewall_rule_list_result.rb +53 -0
  41. data/lib/generated/azure_mgmt_sql/models/server_list_result.rb +52 -0
  42. data/lib/generated/azure_mgmt_sql/models/server_metric.rb +100 -0
  43. data/lib/generated/azure_mgmt_sql/models/server_metric_list_result.rb +53 -0
  44. data/lib/generated/azure_mgmt_sql/models/server_version.rb +16 -0
  45. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +107 -0
  46. data/lib/generated/azure_mgmt_sql/models/service_objective_list_result.rb +54 -0
  47. data/lib/generated/azure_mgmt_sql/models/service_objective_name.rb +22 -0
  48. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +282 -0
  49. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb +53 -0
  50. data/lib/generated/azure_mgmt_sql/models/slo_usage_metric.rb +111 -0
  51. data/lib/generated/azure_mgmt_sql/models/sql_sub_resource.rb +56 -0
  52. data/lib/generated/azure_mgmt_sql/models/table.rb +131 -0
  53. data/lib/generated/azure_mgmt_sql/models/table_type.rb +16 -0
  54. data/lib/generated/azure_mgmt_sql/models/target_database_editions.rb +20 -0
  55. data/lib/generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb +17 -0
  56. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +63 -0
  57. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +74 -0
  58. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb +55 -0
  59. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_states.rb +16 -0
  60. data/lib/generated/azure_mgmt_sql/models/{email_account_admins.rb → transparent_data_encryption_states.rb} +3 -3
  61. data/lib/generated/azure_mgmt_sql/models/upgrade_hint.rb +99 -0
  62. data/lib/generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb +132 -0
  63. data/lib/generated/azure_mgmt_sql/module_definition.rb +1 -1
  64. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +555 -0
  65. data/lib/generated/azure_mgmt_sql/servers.rb +1233 -0
  66. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +31 -10
  67. data/lib/generated/azure_mgmt_sql/version.rb +2 -2
  68. metadata +66 -9
  69. data/lib/generated/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb +0 -85
  70. data/lib/generated/azure_mgmt_sql/security_alert_policy.rb +0 -296
@@ -0,0 +1,950 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::SQL
7
+ #
8
+ # The Azure SQL Database management API provides a RESTful set of web
9
+ # services that interact with Azure SQL Database services to manage your
10
+ # databases. The API enables you to create, retrieve, update, and delete
11
+ # databases.
12
+ #
13
+ class ElasticPools
14
+ include Azure::ARM::SQL::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ElasticPools class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return [SqlManagementClient] reference to the SqlManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # Creates a new Azure SQL elastic pool or updates an existing Azure SQL elastic
30
+ # pool.
31
+ #
32
+ # @param resource_group_name [String] The name of the resource group that
33
+ # contains the resource. You can obtain this value from the Azure Resource
34
+ # Manager API or the portal.
35
+ # @param server_name [String] The name of the Azure SQL server.
36
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
37
+ # be operated on (Updated or created).
38
+ # @param parameters [ElasticPool] The required parameters for creating or
39
+ # updating an Elastic Pool.
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [ElasticPool] operation results.
44
+ #
45
+ def create_or_update(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers = nil)
46
+ response = create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group that
52
+ # contains the resource. You can obtain this value from the Azure Resource
53
+ # Manager API or the portal.
54
+ # @param server_name [String] The name of the Azure SQL server.
55
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
56
+ # be operated on (Updated or created).
57
+ # @param parameters [ElasticPool] The required parameters for creating or
58
+ # updating an Elastic Pool.
59
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
60
+ # will be added to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] promise which provides async access to http
63
+ # response.
64
+ #
65
+ def create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers = nil)
66
+ # Send request
67
+ promise = begin_create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers)
68
+
69
+ promise = promise.then do |response|
70
+ # Defining deserialization method.
71
+ deserialize_method = lambda do |parsed_response|
72
+ result_mapper = ElasticPool.mapper()
73
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
74
+ end
75
+
76
+ # Waiting for response.
77
+ @client.get_long_running_operation_result(response, deserialize_method)
78
+ end
79
+
80
+ promise
81
+ end
82
+
83
+ #
84
+ # Deletes the Azure SQL elastic pool.
85
+ #
86
+ # @param resource_group_name [String] The name of the resource group that
87
+ # contains the resource. You can obtain this value from the Azure Resource
88
+ # Manager API or the portal.
89
+ # @param server_name [String] The name of the Azure SQL server.
90
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
91
+ # be deleted.
92
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
93
+ # will be added to the HTTP request.
94
+ #
95
+ #
96
+ def delete(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
97
+ response = delete_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
98
+ nil
99
+ end
100
+
101
+ #
102
+ # Deletes the Azure SQL elastic pool.
103
+ #
104
+ # @param resource_group_name [String] The name of the resource group that
105
+ # contains the resource. You can obtain this value from the Azure Resource
106
+ # Manager API or the portal.
107
+ # @param server_name [String] The name of the Azure SQL server.
108
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
109
+ # be deleted.
110
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
111
+ # will be added to the HTTP request.
112
+ #
113
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
114
+ #
115
+ def delete_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
116
+ delete_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
117
+ end
118
+
119
+ #
120
+ # Deletes the Azure SQL elastic pool.
121
+ #
122
+ # @param resource_group_name [String] The name of the resource group that
123
+ # contains the resource. You can obtain this value from the Azure Resource
124
+ # Manager API or the portal.
125
+ # @param server_name [String] The name of the Azure SQL server.
126
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
127
+ # be deleted.
128
+ # @param [Hash{String => String}] A hash of custom headers that will be added
129
+ # to the HTTP request.
130
+ #
131
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
132
+ #
133
+ def delete_async(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
134
+ api_version = '2014-04-01'
135
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
136
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
137
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
138
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
139
+
140
+
141
+ request_headers = {}
142
+
143
+ # Set Headers
144
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
145
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
146
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'
147
+
148
+ request_url = @base_url || @client.base_url
149
+
150
+ options = {
151
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
152
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
153
+ query_params: {'api-version' => api_version},
154
+ headers: request_headers.merge(custom_headers || {}),
155
+ base_url: request_url
156
+ }
157
+ promise = @client.make_request_async(:delete, path_template, options)
158
+
159
+ promise = promise.then do |result|
160
+ http_response = result.response
161
+ status_code = http_response.status
162
+ response_content = http_response.body
163
+ unless status_code == 200 || status_code == 204
164
+ error_model = JSON.load(response_content)
165
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
166
+ end
167
+
168
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
169
+
170
+ result
171
+ end
172
+
173
+ promise.execute
174
+ end
175
+
176
+ #
177
+ # Gets information about an Azure SQL elastic pool.
178
+ #
179
+ # @param resource_group_name [String] The name of the resource group that
180
+ # contains the resource. You can obtain this value from the Azure Resource
181
+ # Manager API or the portal.
182
+ # @param server_name [String] The name of the Azure SQL server.
183
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
184
+ # be retrieved.
185
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
186
+ # will be added to the HTTP request.
187
+ #
188
+ # @return [ElasticPool] operation results.
189
+ #
190
+ def get(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
191
+ response = get_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
192
+ response.body unless response.nil?
193
+ end
194
+
195
+ #
196
+ # Gets information about an Azure SQL elastic pool.
197
+ #
198
+ # @param resource_group_name [String] The name of the resource group that
199
+ # contains the resource. You can obtain this value from the Azure Resource
200
+ # Manager API or the portal.
201
+ # @param server_name [String] The name of the Azure SQL server.
202
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
203
+ # be retrieved.
204
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
205
+ # will be added to the HTTP request.
206
+ #
207
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
208
+ #
209
+ def get_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
210
+ get_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
211
+ end
212
+
213
+ #
214
+ # Gets information about an Azure SQL elastic pool.
215
+ #
216
+ # @param resource_group_name [String] The name of the resource group that
217
+ # contains the resource. You can obtain this value from the Azure Resource
218
+ # Manager API or the portal.
219
+ # @param server_name [String] The name of the Azure SQL server.
220
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
221
+ # be retrieved.
222
+ # @param [Hash{String => String}] A hash of custom headers that will be added
223
+ # to the HTTP request.
224
+ #
225
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
226
+ #
227
+ def get_async(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
228
+ api_version = '2014-04-01'
229
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
230
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
231
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
232
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
233
+
234
+
235
+ request_headers = {}
236
+
237
+ # Set Headers
238
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
239
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
240
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'
241
+
242
+ request_url = @base_url || @client.base_url
243
+
244
+ options = {
245
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
246
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
247
+ query_params: {'api-version' => api_version},
248
+ headers: request_headers.merge(custom_headers || {}),
249
+ base_url: request_url
250
+ }
251
+ promise = @client.make_request_async(:get, path_template, options)
252
+
253
+ promise = promise.then do |result|
254
+ http_response = result.response
255
+ status_code = http_response.status
256
+ response_content = http_response.body
257
+ unless status_code == 200
258
+ error_model = JSON.load(response_content)
259
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
260
+ end
261
+
262
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
263
+ # Deserialize Response
264
+ if status_code == 200
265
+ begin
266
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
267
+ result_mapper = ElasticPool.mapper()
268
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
269
+ rescue Exception => e
270
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
271
+ end
272
+ end
273
+
274
+ result
275
+ end
276
+
277
+ promise.execute
278
+ end
279
+
280
+ #
281
+ # Returns information about Azure SQL elastic pools.
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group that
284
+ # contains the resource. You can obtain this value from the Azure Resource
285
+ # Manager API or the portal.
286
+ # @param server_name [String] The name of the Azure SQL server.
287
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
288
+ # will be added to the HTTP request.
289
+ #
290
+ # @return [ElasticPoolListResult] operation results.
291
+ #
292
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
293
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
294
+ response.body unless response.nil?
295
+ end
296
+
297
+ #
298
+ # Returns information about Azure SQL elastic pools.
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 server_name [String] The name of the Azure SQL server.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
308
+ #
309
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
310
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
311
+ end
312
+
313
+ #
314
+ # Returns information about Azure SQL elastic pools.
315
+ #
316
+ # @param resource_group_name [String] The name of the resource group that
317
+ # contains the resource. You can obtain this value from the Azure Resource
318
+ # Manager API or the portal.
319
+ # @param server_name [String] The name of the Azure SQL server.
320
+ # @param [Hash{String => String}] A hash of custom headers that will be added
321
+ # to the HTTP request.
322
+ #
323
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
324
+ #
325
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
326
+ api_version = '2014-04-01'
327
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
328
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
329
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
330
+
331
+
332
+ request_headers = {}
333
+
334
+ # Set Headers
335
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
336
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
337
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools'
338
+
339
+ request_url = @base_url || @client.base_url
340
+
341
+ options = {
342
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
343
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
344
+ query_params: {'api-version' => api_version},
345
+ headers: request_headers.merge(custom_headers || {}),
346
+ base_url: request_url
347
+ }
348
+ promise = @client.make_request_async(:get, path_template, options)
349
+
350
+ promise = promise.then do |result|
351
+ http_response = result.response
352
+ status_code = http_response.status
353
+ response_content = http_response.body
354
+ unless status_code == 200
355
+ error_model = JSON.load(response_content)
356
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
357
+ end
358
+
359
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
360
+ # Deserialize Response
361
+ if status_code == 200
362
+ begin
363
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
364
+ result_mapper = ElasticPoolListResult.mapper()
365
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
366
+ rescue Exception => e
367
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
368
+ end
369
+ end
370
+
371
+ result
372
+ end
373
+
374
+ promise.execute
375
+ end
376
+
377
+ #
378
+ # Returns information about Azure SQL elastic pool activities.
379
+ #
380
+ # @param resource_group_name [String] The name of the resource group that
381
+ # contains the resource. You can obtain this value from the Azure Resource
382
+ # Manager API or the portal.
383
+ # @param server_name [String] The name of the Azure SQL server.
384
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool for
385
+ # which to get the current activity.
386
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
387
+ # will be added to the HTTP request.
388
+ #
389
+ # @return [ElasticPoolActivityListResult] operation results.
390
+ #
391
+ def list_activity(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
392
+ response = list_activity_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
393
+ response.body unless response.nil?
394
+ end
395
+
396
+ #
397
+ # Returns information about Azure SQL elastic pool activities.
398
+ #
399
+ # @param resource_group_name [String] The name of the resource group that
400
+ # contains the resource. You can obtain this value from the Azure Resource
401
+ # Manager API or the portal.
402
+ # @param server_name [String] The name of the Azure SQL server.
403
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool for
404
+ # which to get the current activity.
405
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
406
+ # will be added to the HTTP request.
407
+ #
408
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
409
+ #
410
+ def list_activity_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
411
+ list_activity_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
412
+ end
413
+
414
+ #
415
+ # Returns information about Azure SQL elastic pool activities.
416
+ #
417
+ # @param resource_group_name [String] The name of the resource group that
418
+ # contains the resource. You can obtain this value from the Azure Resource
419
+ # Manager API or the portal.
420
+ # @param server_name [String] The name of the Azure SQL server.
421
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool for
422
+ # which to get the current activity.
423
+ # @param [Hash{String => String}] A hash of custom headers that will be added
424
+ # to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
427
+ #
428
+ def list_activity_async(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
429
+ api_version = '2014-04-01'
430
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
431
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
432
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
433
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
434
+
435
+
436
+ request_headers = {}
437
+
438
+ # Set Headers
439
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
440
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
441
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity'
442
+
443
+ request_url = @base_url || @client.base_url
444
+
445
+ options = {
446
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
447
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
448
+ query_params: {'api-version' => api_version},
449
+ headers: request_headers.merge(custom_headers || {}),
450
+ base_url: request_url
451
+ }
452
+ promise = @client.make_request_async(:get, path_template, options)
453
+
454
+ promise = promise.then do |result|
455
+ http_response = result.response
456
+ status_code = http_response.status
457
+ response_content = http_response.body
458
+ unless status_code == 200
459
+ error_model = JSON.load(response_content)
460
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
461
+ end
462
+
463
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
464
+ # Deserialize Response
465
+ if status_code == 200
466
+ begin
467
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
468
+ result_mapper = ElasticPoolActivityListResult.mapper()
469
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
470
+ rescue Exception => e
471
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
472
+ end
473
+ end
474
+
475
+ result
476
+ end
477
+
478
+ promise.execute
479
+ end
480
+
481
+ #
482
+ # Returns information about activity on Azure SQL databases inside of an Azure
483
+ # SQL elastic pool.
484
+ #
485
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool.
486
+ # @param resource_group_name [String] The name of the resource group that
487
+ # contains the resource. You can obtain this value from the Azure Resource
488
+ # Manager API or the portal.
489
+ # @param server_name [String] The name of the Azure SQL server.
490
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
491
+ # will be added to the HTTP request.
492
+ #
493
+ # @return [ElasticPoolDatabaseActivityListResult] operation results.
494
+ #
495
+ def list_database_activity(elastic_pool_name, resource_group_name, server_name, custom_headers = nil)
496
+ response = list_database_activity_async(elastic_pool_name, resource_group_name, server_name, custom_headers).value!
497
+ response.body unless response.nil?
498
+ end
499
+
500
+ #
501
+ # Returns information about activity on Azure SQL databases inside of an Azure
502
+ # SQL elastic pool.
503
+ #
504
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool.
505
+ # @param resource_group_name [String] The name of the resource group that
506
+ # contains the resource. You can obtain this value from the Azure Resource
507
+ # Manager API or the portal.
508
+ # @param server_name [String] The name of the Azure SQL server.
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
513
+ #
514
+ def list_database_activity_with_http_info(elastic_pool_name, resource_group_name, server_name, custom_headers = nil)
515
+ list_database_activity_async(elastic_pool_name, resource_group_name, server_name, custom_headers).value!
516
+ end
517
+
518
+ #
519
+ # Returns information about activity on Azure SQL databases inside of an Azure
520
+ # SQL elastic pool.
521
+ #
522
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool.
523
+ # @param resource_group_name [String] The name of the resource group that
524
+ # contains the resource. You can obtain this value from the Azure Resource
525
+ # Manager API or the portal.
526
+ # @param server_name [String] The name of the Azure SQL server.
527
+ # @param [Hash{String => String}] A hash of custom headers that will be added
528
+ # to the HTTP request.
529
+ #
530
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
531
+ #
532
+ def list_database_activity_async(elastic_pool_name, resource_group_name, server_name, custom_headers = nil)
533
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
534
+ api_version = '2014-04-01'
535
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
536
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
537
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
538
+
539
+
540
+ request_headers = {}
541
+
542
+ # Set Headers
543
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
544
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
545
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity'
546
+
547
+ request_url = @base_url || @client.base_url
548
+
549
+ options = {
550
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
551
+ path_params: {'elasticPoolName' => elastic_pool_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
552
+ query_params: {'api-version' => api_version},
553
+ headers: request_headers.merge(custom_headers || {}),
554
+ base_url: request_url
555
+ }
556
+ promise = @client.make_request_async(:get, path_template, options)
557
+
558
+ promise = promise.then do |result|
559
+ http_response = result.response
560
+ status_code = http_response.status
561
+ response_content = http_response.body
562
+ unless status_code == 200
563
+ error_model = JSON.load(response_content)
564
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
565
+ end
566
+
567
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
568
+ # Deserialize Response
569
+ if status_code == 200
570
+ begin
571
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
572
+ result_mapper = ElasticPoolDatabaseActivityListResult.mapper()
573
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
574
+ rescue Exception => e
575
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
576
+ end
577
+ end
578
+
579
+ result
580
+ end
581
+
582
+ promise.execute
583
+ end
584
+
585
+ #
586
+ # Gets information about an Azure SQL database inside of an Azure SQL elastic
587
+ # pool.
588
+ #
589
+ # @param resource_group_name [String] The name of the resource group that
590
+ # contains the resource. You can obtain this value from the Azure Resource
591
+ # Manager API or the portal.
592
+ # @param server_name [String] The name of the Azure SQL server.
593
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
594
+ # be retrieved.
595
+ # @param database_name [String] The name of the Azure SQL database to be
596
+ # retrieved.
597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
598
+ # will be added to the HTTP request.
599
+ #
600
+ # @return [Database] operation results.
601
+ #
602
+ def get_database(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers = nil)
603
+ response = get_database_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers).value!
604
+ response.body unless response.nil?
605
+ end
606
+
607
+ #
608
+ # Gets information about an Azure SQL database inside of an Azure SQL elastic
609
+ # pool.
610
+ #
611
+ # @param resource_group_name [String] The name of the resource group that
612
+ # contains the resource. You can obtain this value from the Azure Resource
613
+ # Manager API or the portal.
614
+ # @param server_name [String] The name of the Azure SQL server.
615
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
616
+ # be retrieved.
617
+ # @param database_name [String] The name of the Azure SQL database to be
618
+ # retrieved.
619
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
620
+ # will be added to the HTTP request.
621
+ #
622
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
623
+ #
624
+ def get_database_with_http_info(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers = nil)
625
+ get_database_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers).value!
626
+ end
627
+
628
+ #
629
+ # Gets information about an Azure SQL database inside of an Azure SQL elastic
630
+ # pool.
631
+ #
632
+ # @param resource_group_name [String] The name of the resource group that
633
+ # contains the resource. You can obtain this value from the Azure Resource
634
+ # Manager API or the portal.
635
+ # @param server_name [String] The name of the Azure SQL server.
636
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
637
+ # be retrieved.
638
+ # @param database_name [String] The name of the Azure SQL database to be
639
+ # retrieved.
640
+ # @param [Hash{String => String}] A hash of custom headers that will be added
641
+ # to the HTTP request.
642
+ #
643
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
644
+ #
645
+ def get_database_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers = nil)
646
+ api_version = '2014-04-01'
647
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
648
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
649
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
650
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
651
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
652
+
653
+
654
+ request_headers = {}
655
+
656
+ # Set Headers
657
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
658
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
659
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}'
660
+
661
+ request_url = @base_url || @client.base_url
662
+
663
+ options = {
664
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
665
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name,'databaseName' => database_name},
666
+ query_params: {'api-version' => api_version},
667
+ headers: request_headers.merge(custom_headers || {}),
668
+ base_url: request_url
669
+ }
670
+ promise = @client.make_request_async(:get, path_template, options)
671
+
672
+ promise = promise.then do |result|
673
+ http_response = result.response
674
+ status_code = http_response.status
675
+ response_content = http_response.body
676
+ unless status_code == 200
677
+ error_model = JSON.load(response_content)
678
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
679
+ end
680
+
681
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
682
+ # Deserialize Response
683
+ if status_code == 200
684
+ begin
685
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
686
+ result_mapper = Database.mapper()
687
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
688
+ rescue Exception => e
689
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
690
+ end
691
+ end
692
+
693
+ result
694
+ end
695
+
696
+ promise.execute
697
+ end
698
+
699
+ #
700
+ # Returns information about an Azure SQL database inside of an Azure SQL
701
+ # elastic pool.
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 Azure SQL server.
707
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
708
+ # be retrieved.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ # @return [DatabaseListResult] operation results.
713
+ #
714
+ def list_databases(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
715
+ response = list_databases_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
716
+ response.body unless response.nil?
717
+ end
718
+
719
+ #
720
+ # Returns information about an Azure SQL database inside of an Azure SQL
721
+ # elastic pool.
722
+ #
723
+ # @param resource_group_name [String] The name of the resource group that
724
+ # contains the resource. You can obtain this value from the Azure Resource
725
+ # Manager API or the portal.
726
+ # @param server_name [String] The name of the Azure SQL server.
727
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
728
+ # be retrieved.
729
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
730
+ # will be added to the HTTP request.
731
+ #
732
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
733
+ #
734
+ def list_databases_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
735
+ list_databases_async(resource_group_name, server_name, elastic_pool_name, custom_headers).value!
736
+ end
737
+
738
+ #
739
+ # Returns information about an Azure SQL database inside of an Azure SQL
740
+ # elastic pool.
741
+ #
742
+ # @param resource_group_name [String] The name of the resource group that
743
+ # contains the resource. You can obtain this value from the Azure Resource
744
+ # Manager API or the portal.
745
+ # @param server_name [String] The name of the Azure SQL server.
746
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
747
+ # be retrieved.
748
+ # @param [Hash{String => String}] A hash of custom headers that will be added
749
+ # to the HTTP request.
750
+ #
751
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
752
+ #
753
+ def list_databases_async(resource_group_name, server_name, elastic_pool_name, custom_headers = nil)
754
+ api_version = '2014-04-01'
755
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
756
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
757
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
758
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
759
+
760
+
761
+ request_headers = {}
762
+
763
+ # Set Headers
764
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
765
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
766
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'
767
+
768
+ request_url = @base_url || @client.base_url
769
+
770
+ options = {
771
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
772
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
773
+ query_params: {'api-version' => api_version},
774
+ headers: request_headers.merge(custom_headers || {}),
775
+ base_url: request_url
776
+ }
777
+ promise = @client.make_request_async(:get, path_template, options)
778
+
779
+ promise = promise.then do |result|
780
+ http_response = result.response
781
+ status_code = http_response.status
782
+ response_content = http_response.body
783
+ unless status_code == 200
784
+ error_model = JSON.load(response_content)
785
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
786
+ end
787
+
788
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
789
+ # Deserialize Response
790
+ if status_code == 200
791
+ begin
792
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
793
+ result_mapper = DatabaseListResult.mapper()
794
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
795
+ rescue Exception => e
796
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
797
+ end
798
+ end
799
+
800
+ result
801
+ end
802
+
803
+ promise.execute
804
+ end
805
+
806
+ #
807
+ # Creates a new Azure SQL elastic pool or updates an existing Azure SQL elastic
808
+ # pool.
809
+ #
810
+ # @param resource_group_name [String] The name of the resource group that
811
+ # contains the resource. You can obtain this value from the Azure Resource
812
+ # Manager API or the portal.
813
+ # @param server_name [String] The name of the Azure SQL server.
814
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
815
+ # be operated on (Updated or created).
816
+ # @param parameters [ElasticPool] The required parameters for creating or
817
+ # updating an Elastic Pool.
818
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
819
+ # will be added to the HTTP request.
820
+ #
821
+ # @return [ElasticPool] operation results.
822
+ #
823
+ def begin_create_or_update(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers = nil)
824
+ response = begin_create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers).value!
825
+ response.body unless response.nil?
826
+ end
827
+
828
+ #
829
+ # Creates a new Azure SQL elastic pool or updates an existing Azure SQL elastic
830
+ # pool.
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 Azure SQL server.
836
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
837
+ # be operated on (Updated or created).
838
+ # @param parameters [ElasticPool] The required parameters for creating or
839
+ # updating an Elastic Pool.
840
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
841
+ # will be added to the HTTP request.
842
+ #
843
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
844
+ #
845
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers = nil)
846
+ begin_create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers).value!
847
+ end
848
+
849
+ #
850
+ # Creates a new Azure SQL elastic pool or updates an existing Azure SQL elastic
851
+ # pool.
852
+ #
853
+ # @param resource_group_name [String] The name of the resource group that
854
+ # contains the resource. You can obtain this value from the Azure Resource
855
+ # Manager API or the portal.
856
+ # @param server_name [String] The name of the Azure SQL server.
857
+ # @param elastic_pool_name [String] The name of the Azure SQL Elastic Pool to
858
+ # be operated on (Updated or created).
859
+ # @param parameters [ElasticPool] The required parameters for creating or
860
+ # updating an Elastic Pool.
861
+ # @param [Hash{String => String}] A hash of custom headers that will be added
862
+ # to the HTTP request.
863
+ #
864
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
865
+ #
866
+ def begin_create_or_update_async(resource_group_name, server_name, elastic_pool_name, parameters, custom_headers = nil)
867
+ api_version = '2014-04-01'
868
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
869
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
870
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
871
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
872
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
873
+
874
+
875
+ request_headers = {}
876
+
877
+ # Set Headers
878
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
879
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
880
+
881
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
882
+
883
+ # Serialize Request
884
+ request_mapper = ElasticPool.mapper()
885
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
886
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
887
+
888
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'
889
+
890
+ request_url = @base_url || @client.base_url
891
+
892
+ options = {
893
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
894
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name},
895
+ query_params: {'api-version' => api_version},
896
+ body: request_content,
897
+ headers: request_headers.merge(custom_headers || {}),
898
+ base_url: request_url
899
+ }
900
+ promise = @client.make_request_async(:put, path_template, options)
901
+
902
+ promise = promise.then do |result|
903
+ http_response = result.response
904
+ status_code = http_response.status
905
+ response_content = http_response.body
906
+ unless status_code == 200 || status_code == 201 || status_code == 202
907
+ error_model = JSON.load(response_content)
908
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
909
+ end
910
+
911
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
912
+ # Deserialize Response
913
+ if status_code == 200
914
+ begin
915
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
916
+ result_mapper = ElasticPool.mapper()
917
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
918
+ rescue Exception => e
919
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
920
+ end
921
+ end
922
+ # Deserialize Response
923
+ if status_code == 201
924
+ begin
925
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
926
+ result_mapper = ElasticPool.mapper()
927
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
928
+ rescue Exception => e
929
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
930
+ end
931
+ end
932
+ # Deserialize Response
933
+ if status_code == 202
934
+ begin
935
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
936
+ result_mapper = ElasticPool.mapper()
937
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
938
+ rescue Exception => e
939
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
940
+ end
941
+ end
942
+
943
+ result
944
+ end
945
+
946
+ promise.execute
947
+ end
948
+
949
+ end
950
+ end