azure_mgmt_sql 0.15.2 → 0.16.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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2014-04-01/generated/azure_mgmt_sql.rb +77 -63
  3. data/lib/2014-04-01/generated/azure_mgmt_sql/backup_long_term_retention_policies.rb +118 -16
  4. data/lib/2014-04-01/generated/azure_mgmt_sql/backup_long_term_retention_vaults.rb +114 -16
  5. data/lib/2014-04-01/generated/azure_mgmt_sql/capabilities.rb +6 -5
  6. data/lib/2014-04-01/generated/azure_mgmt_sql/data_masking_policies.rb +12 -12
  7. data/lib/2014-04-01/generated/azure_mgmt_sql/data_masking_rules.rb +12 -12
  8. data/lib/2014-04-01/generated/azure_mgmt_sql/database_advisors.rb +18 -17
  9. data/lib/2014-04-01/generated/azure_mgmt_sql/database_connection_policies.rb +12 -12
  10. data/lib/2014-04-01/generated/azure_mgmt_sql/database_table_auditing_policies.rb +18 -17
  11. data/lib/2014-04-01/generated/azure_mgmt_sql/database_threat_detection_policies.rb +12 -12
  12. data/lib/2014-04-01/generated/azure_mgmt_sql/database_usages.rb +6 -5
  13. data/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb +649 -643
  14. data/lib/2014-04-01/generated/azure_mgmt_sql/disaster_recovery_configurations.rb +830 -0
  15. data/lib/2014-04-01/generated/azure_mgmt_sql/elastic_pool_activities.rb +6 -5
  16. data/lib/2014-04-01/generated/azure_mgmt_sql/elastic_pool_database_activities.rb +6 -5
  17. data/lib/2014-04-01/generated/azure_mgmt_sql/elastic_pools.rb +216 -213
  18. data/lib/2014-04-01/generated/azure_mgmt_sql/extensions.rb +130 -0
  19. data/lib/2014-04-01/generated/azure_mgmt_sql/firewall_rules.rb +24 -22
  20. data/lib/2014-04-01/generated/azure_mgmt_sql/geo_backup_policies.rb +18 -17
  21. data/lib/2014-04-01/generated/azure_mgmt_sql/models/backup_long_term_retention_policy_list_result.rb +56 -0
  22. data/lib/2014-04-01/generated/azure_mgmt_sql/models/backup_long_term_retention_vault_list_result.rb +56 -0
  23. data/lib/2014-04-01/generated/azure_mgmt_sql/models/database.rb +43 -10
  24. data/lib/2014-04-01/generated/azure_mgmt_sql/models/database_edition.rb +1 -0
  25. data/lib/2014-04-01/generated/azure_mgmt_sql/models/database_update.rb +43 -10
  26. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration.rb +164 -0
  27. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration_auto_failover.rb +16 -0
  28. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration_failover_policy.rb +16 -0
  29. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration_list_result.rb +57 -0
  30. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration_role.rb +17 -0
  31. data/lib/2014-04-01/generated/azure_mgmt_sql/models/disaster_recovery_configuration_status.rb +18 -0
  32. data/lib/2014-04-01/generated/azure_mgmt_sql/models/edition_capability.rb +13 -0
  33. data/lib/2014-04-01/generated/azure_mgmt_sql/models/elastic_pool.rb +13 -0
  34. data/lib/2014-04-01/generated/azure_mgmt_sql/models/elastic_pool_edition_capability.rb +13 -0
  35. data/lib/2014-04-01/generated/azure_mgmt_sql/models/elastic_pool_update.rb +13 -0
  36. data/lib/2014-04-01/generated/azure_mgmt_sql/models/extension_list_result.rb +54 -0
  37. data/lib/2014-04-01/generated/azure_mgmt_sql/models/import_request.rb +12 -4
  38. data/lib/2014-04-01/generated/azure_mgmt_sql/models/query_text.rb +72 -0
  39. data/lib/2014-04-01/generated/azure_mgmt_sql/models/query_text_list_result.rb +55 -0
  40. data/lib/2014-04-01/generated/azure_mgmt_sql/models/service_objective_name.rb +52 -2
  41. data/lib/2014-04-01/generated/azure_mgmt_sql/models/slo_usage_metric.rb +10 -3
  42. data/lib/2014-04-01/generated/azure_mgmt_sql/operations.rb +6 -5
  43. data/lib/2014-04-01/generated/azure_mgmt_sql/queries.rb +6 -5
  44. data/lib/2014-04-01/generated/azure_mgmt_sql/query_statistics.rb +6 -5
  45. data/lib/2014-04-01/generated/azure_mgmt_sql/query_texts.rb +134 -0
  46. data/lib/2014-04-01/generated/azure_mgmt_sql/recommended_elastic_pools.rb +18 -15
  47. data/lib/2014-04-01/generated/azure_mgmt_sql/recoverable_databases.rb +12 -10
  48. data/lib/2014-04-01/generated/azure_mgmt_sql/replication_links.rb +38 -33
  49. data/lib/2014-04-01/generated/azure_mgmt_sql/restorable_dropped_databases.rb +12 -10
  50. data/lib/2014-04-01/generated/azure_mgmt_sql/restore_points.rb +6 -5
  51. data/lib/2014-04-01/generated/azure_mgmt_sql/server_azure_adadministrators.rb +32 -30
  52. data/lib/2014-04-01/generated/azure_mgmt_sql/server_communication_links.rb +28 -26
  53. data/lib/2014-04-01/generated/azure_mgmt_sql/server_connection_policies.rb +12 -12
  54. data/lib/2014-04-01/generated/azure_mgmt_sql/server_table_auditing_policies.rb +18 -17
  55. data/lib/2014-04-01/generated/azure_mgmt_sql/server_usages.rb +6 -5
  56. data/lib/2014-04-01/generated/azure_mgmt_sql/servers.rb +134 -133
  57. data/lib/2014-04-01/generated/azure_mgmt_sql/service_objectives.rb +12 -10
  58. data/lib/2014-04-01/generated/azure_mgmt_sql/service_tier_advisors.rb +12 -10
  59. data/lib/2014-04-01/generated/azure_mgmt_sql/sql_management_client.rb +32 -17
  60. data/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb +6 -5
  61. data/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_configurations.rb +6 -5
  62. data/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryptions.rb +12 -12
  63. data/lib/2015-05-01-preview/generated/azure_mgmt_sql.rb +22 -19
  64. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/database_advisors.rb +18 -17
  65. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/database_blob_auditing_policies.rb +12 -12
  66. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/database_recommended_actions.rb +18 -17
  67. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/encryption_protectors.rb +31 -29
  68. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb +71 -67
  69. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/models/subscription_usage.rb +110 -0
  70. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/models/subscription_usage_list_result.rb +100 -0
  71. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/operations.rb +15 -13
  72. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/server_advisors.rb +18 -17
  73. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/server_keys.rb +41 -38
  74. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/servers.rb +66 -62
  75. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/sql_management_client.rb +8 -1
  76. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/subscription_usages.rb +324 -0
  77. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb +62 -56
  78. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb +118 -107
  79. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_members.rb +76 -71
  80. data/lib/2015-05-01-preview/generated/azure_mgmt_sql/virtual_network_rules.rb +41 -38
  81. data/lib/2017-03-01-preview/generated/azure_mgmt_sql.rb +30 -1
  82. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/database_operations.rb +21 -18
  83. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/database_restore_points.rb +527 -0
  84. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb +1599 -0
  85. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/arm_sku.rb +92 -0
  86. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/automatic_tuning_option_mode_actual.rb +16 -0
  87. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/automatic_tuning_option_mode_desired.rb +17 -0
  88. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/automatic_tuning_server_mode.rb +17 -0
  89. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/automatic_tuning_server_options.rb +90 -0
  90. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/automatic_tuning_server_reason.rb +17 -0
  91. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/catalog_collation_type.rb +16 -0
  92. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/create_database_restore_point_definition.rb +47 -0
  93. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/create_mode.rb +23 -0
  94. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/database.rb +393 -0
  95. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/database_list_result.rb +100 -0
  96. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/database_restore_point.rb +124 -0
  97. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/database_restore_point_list_result.rb +100 -0
  98. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/database_update.rb +348 -0
  99. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/import_export_database_definition.rb +145 -0
  100. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/import_export_operation_result.rb +170 -0
  101. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/resource_move_definition.rb +46 -0
  102. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/restore_point_type.rb +16 -0
  103. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sample_name.rb +17 -0
  104. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/server_automatic_tuning.rb +110 -0
  105. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/server_dns_alias.rb +74 -0
  106. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/server_dns_alias_acquisition.rb +47 -0
  107. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/server_dns_alias_list_result.rb +100 -0
  108. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/status.rb +32 -0
  109. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/tracked_resource.rb +92 -0
  110. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_automatic_tuning_operations.rb +238 -0
  111. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/server_dns_aliases.rb +805 -0
  112. data/lib/2017-03-01-preview/generated/azure_mgmt_sql/sql_management_client.rb +21 -1
  113. data/lib/profiles/latest/modules/sql_profile_module.rb +912 -749
  114. data/lib/profiles/latest/sql_latest_profile_client.rb +28 -9
  115. data/lib/profiles/latest/sql_module_definition.rb +0 -1
  116. data/lib/version.rb +1 -1
  117. metadata +49 -3
@@ -32,8 +32,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
32
32
  #
33
33
  # @return [Array<Server>] operation results.
34
34
  #
35
- def list(custom_headers = nil)
36
- first_page = list_as_lazy(custom_headers)
35
+ def list(custom_headers:nil)
36
+ first_page = list_as_lazy(custom_headers:custom_headers)
37
37
  first_page.get_all_items
38
38
  end
39
39
 
@@ -45,8 +45,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
45
45
  #
46
46
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
47
  #
48
- def list_with_http_info(custom_headers = nil)
49
- list_async(custom_headers).value!
48
+ def list_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
50
  end
51
51
 
52
52
  #
@@ -57,12 +57,13 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
57
57
  #
58
58
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
59
  #
60
- def list_async(custom_headers = nil)
60
+ def list_async(custom_headers:nil)
61
61
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
62
62
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
63
63
 
64
64
 
65
65
  request_headers = {}
66
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
67
 
67
68
  # Set Headers
68
69
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -118,8 +119,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
118
119
  #
119
120
  # @return [Array<Server>] operation results.
120
121
  #
121
- def list_by_resource_group(resource_group_name, custom_headers = nil)
122
- first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
122
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
123
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
123
124
  first_page.get_all_items
124
125
  end
125
126
 
@@ -134,8 +135,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
134
135
  #
135
136
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
136
137
  #
137
- def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
138
- list_by_resource_group_async(resource_group_name, custom_headers).value!
138
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
139
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
139
140
  end
140
141
 
141
142
  #
@@ -149,13 +150,14 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
149
150
  #
150
151
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
151
152
  #
152
- def list_by_resource_group_async(resource_group_name, custom_headers = nil)
153
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
153
154
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
154
155
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
155
156
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
156
157
 
157
158
 
158
159
  request_headers = {}
160
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
159
161
 
160
162
  # Set Headers
161
163
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -212,8 +214,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
212
214
  #
213
215
  # @return [Server] operation results.
214
216
  #
215
- def get(resource_group_name, server_name, custom_headers = nil)
216
- response = get_async(resource_group_name, server_name, custom_headers).value!
217
+ def get(resource_group_name, server_name, custom_headers:nil)
218
+ response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
217
219
  response.body unless response.nil?
218
220
  end
219
221
 
@@ -229,8 +231,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
229
231
  #
230
232
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
231
233
  #
232
- def get_with_http_info(resource_group_name, server_name, custom_headers = nil)
233
- get_async(resource_group_name, server_name, custom_headers).value!
234
+ def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
235
+ get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
234
236
  end
235
237
 
236
238
  #
@@ -245,7 +247,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
245
247
  #
246
248
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
247
249
  #
248
- def get_async(resource_group_name, server_name, custom_headers = nil)
250
+ def get_async(resource_group_name, server_name, custom_headers:nil)
249
251
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
250
252
  fail ArgumentError, 'server_name is nil' if server_name.nil?
251
253
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -253,6 +255,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
253
255
 
254
256
 
255
257
  request_headers = {}
258
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
256
259
 
257
260
  # Set Headers
258
261
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -310,8 +313,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
310
313
  #
311
314
  # @return [Server] operation results.
312
315
  #
313
- def create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
314
- response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
316
+ def create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
317
+ response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
315
318
  response.body unless response.nil?
316
319
  end
317
320
 
@@ -327,9 +330,9 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
327
330
  # @return [Concurrent::Promise] promise which provides async access to http
328
331
  # response.
329
332
  #
330
- def create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
333
+ def create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
331
334
  # Send request
332
- promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers)
335
+ promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
333
336
 
334
337
  promise = promise.then do |response|
335
338
  # Defining deserialization method.
@@ -355,8 +358,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
355
358
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
356
359
  # will be added to the HTTP request.
357
360
  #
358
- def delete(resource_group_name, server_name, custom_headers = nil)
359
- response = delete_async(resource_group_name, server_name, custom_headers).value!
361
+ def delete(resource_group_name, server_name, custom_headers:nil)
362
+ response = delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
360
363
  nil
361
364
  end
362
365
 
@@ -371,9 +374,9 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
371
374
  # @return [Concurrent::Promise] promise which provides async access to http
372
375
  # response.
373
376
  #
374
- def delete_async(resource_group_name, server_name, custom_headers = nil)
377
+ def delete_async(resource_group_name, server_name, custom_headers:nil)
375
378
  # Send request
376
- promise = begin_delete_async(resource_group_name, server_name, custom_headers)
379
+ promise = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers)
377
380
 
378
381
  promise = promise.then do |response|
379
382
  # Defining deserialization method.
@@ -400,8 +403,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
400
403
  #
401
404
  # @return [Server] operation results.
402
405
  #
403
- def update(resource_group_name, server_name, parameters, custom_headers = nil)
404
- response = update_async(resource_group_name, server_name, parameters, custom_headers).value!
406
+ def update(resource_group_name, server_name, parameters, custom_headers:nil)
407
+ response = update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
405
408
  response.body unless response.nil?
406
409
  end
407
410
 
@@ -417,9 +420,9 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
417
420
  # @return [Concurrent::Promise] promise which provides async access to http
418
421
  # response.
419
422
  #
420
- def update_async(resource_group_name, server_name, parameters, custom_headers = nil)
423
+ def update_async(resource_group_name, server_name, parameters, custom_headers:nil)
421
424
  # Send request
422
- promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers)
425
+ promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
423
426
 
424
427
  promise = promise.then do |response|
425
428
  # Defining deserialization method.
@@ -448,8 +451,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
448
451
  #
449
452
  # @return [Server] operation results.
450
453
  #
451
- def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
452
- response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
454
+ def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
455
+ response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
453
456
  response.body unless response.nil?
454
457
  end
455
458
 
@@ -466,8 +469,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
466
469
  #
467
470
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
468
471
  #
469
- def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
470
- begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
472
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
473
+ begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
471
474
  end
472
475
 
473
476
  #
@@ -483,7 +486,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
483
486
  #
484
487
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
485
488
  #
486
- def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
489
+ def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
487
490
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
488
491
  fail ArgumentError, 'server_name is nil' if server_name.nil?
489
492
  fail ArgumentError, 'parameters is nil' if parameters.nil?
@@ -492,13 +495,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
492
495
 
493
496
 
494
497
  request_headers = {}
498
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
495
499
 
496
500
  # Set Headers
497
501
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
498
502
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
499
503
 
500
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
501
-
502
504
  # Serialize Request
503
505
  request_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::Server.mapper()
504
506
  request_content = @client.serialize(request_mapper, parameters)
@@ -566,8 +568,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
566
568
  # will be added to the HTTP request.
567
569
  #
568
570
  #
569
- def begin_delete(resource_group_name, server_name, custom_headers = nil)
570
- response = begin_delete_async(resource_group_name, server_name, custom_headers).value!
571
+ def begin_delete(resource_group_name, server_name, custom_headers:nil)
572
+ response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
571
573
  nil
572
574
  end
573
575
 
@@ -583,8 +585,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
583
585
  #
584
586
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
587
  #
586
- def begin_delete_with_http_info(resource_group_name, server_name, custom_headers = nil)
587
- begin_delete_async(resource_group_name, server_name, custom_headers).value!
588
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
589
+ begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
588
590
  end
589
591
 
590
592
  #
@@ -599,7 +601,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
599
601
  #
600
602
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
601
603
  #
602
- def begin_delete_async(resource_group_name, server_name, custom_headers = nil)
604
+ def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
603
605
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
604
606
  fail ArgumentError, 'server_name is nil' if server_name.nil?
605
607
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -607,6 +609,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
607
609
 
608
610
 
609
611
  request_headers = {}
612
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
610
613
 
611
614
  # Set Headers
612
615
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -654,8 +657,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
654
657
  #
655
658
  # @return [Server] operation results.
656
659
  #
657
- def begin_update(resource_group_name, server_name, parameters, custom_headers = nil)
658
- response = begin_update_async(resource_group_name, server_name, parameters, custom_headers).value!
660
+ def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
661
+ response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
659
662
  response.body unless response.nil?
660
663
  end
661
664
 
@@ -672,8 +675,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
672
675
  #
673
676
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
674
677
  #
675
- def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
676
- begin_update_async(resource_group_name, server_name, parameters, custom_headers).value!
678
+ def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
679
+ begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
677
680
  end
678
681
 
679
682
  #
@@ -689,7 +692,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
689
692
  #
690
693
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
691
694
  #
692
- def begin_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
695
+ def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
693
696
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
694
697
  fail ArgumentError, 'server_name is nil' if server_name.nil?
695
698
  fail ArgumentError, 'parameters is nil' if parameters.nil?
@@ -698,13 +701,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
698
701
 
699
702
 
700
703
  request_headers = {}
704
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
701
705
 
702
706
  # Set Headers
703
707
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
704
708
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
705
709
 
706
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
707
-
708
710
  # Serialize Request
709
711
  request_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::ServerUpdate.mapper()
710
712
  request_content = @client.serialize(request_mapper, parameters)
@@ -761,8 +763,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
761
763
  #
762
764
  # @return [ServerListResult] operation results.
763
765
  #
764
- def list_next(next_page_link, custom_headers = nil)
765
- response = list_next_async(next_page_link, custom_headers).value!
766
+ def list_next(next_page_link, custom_headers:nil)
767
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
766
768
  response.body unless response.nil?
767
769
  end
768
770
 
@@ -776,8 +778,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
776
778
  #
777
779
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
778
780
  #
779
- def list_next_with_http_info(next_page_link, custom_headers = nil)
780
- list_next_async(next_page_link, custom_headers).value!
781
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
782
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
781
783
  end
782
784
 
783
785
  #
@@ -790,11 +792,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
790
792
  #
791
793
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
792
794
  #
793
- def list_next_async(next_page_link, custom_headers = nil)
795
+ def list_next_async(next_page_link, custom_headers:nil)
794
796
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
795
797
 
796
798
 
797
799
  request_headers = {}
800
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
798
801
 
799
802
  # Set Headers
800
803
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -848,8 +851,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
848
851
  #
849
852
  # @return [ServerListResult] operation results.
850
853
  #
851
- def list_by_resource_group_next(next_page_link, custom_headers = nil)
852
- response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
854
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
855
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
853
856
  response.body unless response.nil?
854
857
  end
855
858
 
@@ -863,8 +866,8 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
863
866
  #
864
867
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
865
868
  #
866
- def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
867
- list_by_resource_group_next_async(next_page_link, custom_headers).value!
869
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
870
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
868
871
  end
869
872
 
870
873
  #
@@ -877,11 +880,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
877
880
  #
878
881
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
879
882
  #
880
- def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
883
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
881
884
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
882
885
 
883
886
 
884
887
  request_headers = {}
888
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
885
889
 
886
890
  # Set Headers
887
891
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
@@ -934,12 +938,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
934
938
  # @return [ServerListResult] which provide lazy access to pages of the
935
939
  # response.
936
940
  #
937
- def list_as_lazy(custom_headers = nil)
938
- response = list_async(custom_headers).value!
941
+ def list_as_lazy(custom_headers:nil)
942
+ response = list_async(custom_headers:custom_headers).value!
939
943
  unless response.nil?
940
944
  page = response.body
941
945
  page.next_method = Proc.new do |next_page_link|
942
- list_next_async(next_page_link, custom_headers)
946
+ list_next_async(next_page_link, custom_headers:custom_headers)
943
947
  end
944
948
  page
945
949
  end
@@ -957,12 +961,12 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
957
961
  # @return [ServerListResult] which provide lazy access to pages of the
958
962
  # response.
959
963
  #
960
- def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
961
- response = list_by_resource_group_async(resource_group_name, custom_headers).value!
964
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
965
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
962
966
  unless response.nil?
963
967
  page = response.body
964
968
  page.next_method = Proc.new do |next_page_link|
965
- list_by_resource_group_next_async(next_page_link, custom_headers)
969
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
966
970
  end
967
971
  page
968
972
  end
@@ -71,6 +71,9 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
71
71
  # @return [SyncMembers] sync_members
72
72
  attr_reader :sync_members
73
73
 
74
+ # @return [SubscriptionUsages] subscription_usages
75
+ attr_reader :subscription_usages
76
+
74
77
  # @return [VirtualNetworkRules] virtual_network_rules
75
78
  attr_reader :virtual_network_rules
76
79
 
@@ -99,6 +102,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
99
102
  @sync_agents = SyncAgents.new(self)
100
103
  @sync_groups = SyncGroups.new(self)
101
104
  @sync_members = SyncMembers.new(self)
105
+ @subscription_usages = SubscriptionUsages.new(self)
102
106
  @virtual_network_rules = VirtualNetworkRules.new(self)
103
107
  @api_version = '2015-05-01-preview'
104
108
  @accept_language = 'en-US'
@@ -153,6 +157,9 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
153
157
  fail ArgumentError, 'path is nil' if path.nil?
154
158
 
155
159
  request_url = options[:base_url] || @base_url
160
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
161
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
162
+ end
156
163
 
157
164
  request_headers = @request_headers
158
165
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
@@ -169,7 +176,7 @@ module Azure::SQL::Mgmt::V2015_05_01_preview
169
176
  #
170
177
  def add_telemetry
171
178
  sdk_information = 'azure_mgmt_sql'
172
- sdk_information = "#{sdk_information}/0.15.2"
179
+ sdk_information = "#{sdk_information}/0.16.0"
173
180
  add_user_agent_information(sdk_information)
174
181
  end
175
182
  end
@@ -0,0 +1,324 @@
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::SQL::Mgmt::V2015_05_01_preview
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 SubscriptionUsages
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the SubscriptionUsages class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SqlManagementClient] reference to the SqlManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets all subscription usage metrics in a given location.
29
+ #
30
+ # @param location_name [String] The name of the region where the resource is
31
+ # located.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<SubscriptionUsage>] operation results.
36
+ #
37
+ def list_by_location(location_name, custom_headers:nil)
38
+ first_page = list_by_location_as_lazy(location_name, custom_headers:custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Gets all subscription usage metrics in a given location.
44
+ #
45
+ # @param location_name [String] The name of the region where the resource is
46
+ # located.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def list_by_location_with_http_info(location_name, custom_headers:nil)
53
+ list_by_location_async(location_name, custom_headers:custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Gets all subscription usage metrics in a given location.
58
+ #
59
+ # @param location_name [String] The name of the region where the resource is
60
+ # located.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_by_location_async(location_name, custom_headers:nil)
67
+ fail ArgumentError, 'location_name is nil' if location_name.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+
71
+
72
+ request_headers = {}
73
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages'
79
+
80
+ request_url = @base_url || @client.base_url
81
+
82
+ options = {
83
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
84
+ path_params: {'locationName' => location_name,'subscriptionId' => @client.subscription_id},
85
+ query_params: {'api-version' => @client.api_version},
86
+ headers: request_headers.merge(custom_headers || {}),
87
+ base_url: request_url
88
+ }
89
+ promise = @client.make_request_async(:get, path_template, options)
90
+
91
+ promise = promise.then do |result|
92
+ http_response = result.response
93
+ status_code = http_response.status
94
+ response_content = http_response.body
95
+ unless status_code == 200
96
+ error_model = JSON.load(response_content)
97
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
98
+ end
99
+
100
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
+ # Deserialize Response
102
+ if status_code == 200
103
+ begin
104
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
105
+ result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::SubscriptionUsageListResult.mapper()
106
+ result.body = @client.deserialize(result_mapper, parsed_response)
107
+ rescue Exception => e
108
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
109
+ end
110
+ end
111
+
112
+ result
113
+ end
114
+
115
+ promise.execute
116
+ end
117
+
118
+ #
119
+ # Gets a subscription usage metric.
120
+ #
121
+ # @param location_name [String] The name of the region where the resource is
122
+ # located.
123
+ # @param usage_name [String] Name of usage metric to return.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ # @return [SubscriptionUsage] operation results.
128
+ #
129
+ def get(location_name, usage_name, custom_headers:nil)
130
+ response = get_async(location_name, usage_name, custom_headers:custom_headers).value!
131
+ response.body unless response.nil?
132
+ end
133
+
134
+ #
135
+ # Gets a subscription usage metric.
136
+ #
137
+ # @param location_name [String] The name of the region where the resource is
138
+ # located.
139
+ # @param usage_name [String] Name of usage metric to return.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def get_with_http_info(location_name, usage_name, custom_headers:nil)
146
+ get_async(location_name, usage_name, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Gets a subscription usage metric.
151
+ #
152
+ # @param location_name [String] The name of the region where the resource is
153
+ # located.
154
+ # @param usage_name [String] Name of usage metric to return.
155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
156
+ # to the HTTP request.
157
+ #
158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
159
+ #
160
+ def get_async(location_name, usage_name, custom_headers:nil)
161
+ fail ArgumentError, 'location_name is nil' if location_name.nil?
162
+ fail ArgumentError, 'usage_name is nil' if usage_name.nil?
163
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
164
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
165
+
166
+
167
+ request_headers = {}
168
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
169
+
170
+ # Set Headers
171
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
172
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
173
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}'
174
+
175
+ request_url = @base_url || @client.base_url
176
+
177
+ options = {
178
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
179
+ path_params: {'locationName' => location_name,'usageName' => usage_name,'subscriptionId' => @client.subscription_id},
180
+ query_params: {'api-version' => @client.api_version},
181
+ headers: request_headers.merge(custom_headers || {}),
182
+ base_url: request_url
183
+ }
184
+ promise = @client.make_request_async(:get, path_template, options)
185
+
186
+ promise = promise.then do |result|
187
+ http_response = result.response
188
+ status_code = http_response.status
189
+ response_content = http_response.body
190
+ unless status_code == 200
191
+ error_model = JSON.load(response_content)
192
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
193
+ end
194
+
195
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
196
+ # Deserialize Response
197
+ if status_code == 200
198
+ begin
199
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
200
+ result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::SubscriptionUsage.mapper()
201
+ result.body = @client.deserialize(result_mapper, parsed_response)
202
+ rescue Exception => e
203
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
204
+ end
205
+ end
206
+
207
+ result
208
+ end
209
+
210
+ promise.execute
211
+ end
212
+
213
+ #
214
+ # Gets all subscription usage metrics in a given location.
215
+ #
216
+ # @param next_page_link [String] The NextLink from the previous successful call
217
+ # to List operation.
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [SubscriptionUsageListResult] operation results.
222
+ #
223
+ def list_by_location_next(next_page_link, custom_headers:nil)
224
+ response = list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
225
+ response.body unless response.nil?
226
+ end
227
+
228
+ #
229
+ # Gets all subscription usage metrics in a given location.
230
+ #
231
+ # @param next_page_link [String] The NextLink from the previous successful call
232
+ # to List operation.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
237
+ #
238
+ def list_by_location_next_with_http_info(next_page_link, custom_headers:nil)
239
+ list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
240
+ end
241
+
242
+ #
243
+ # Gets all subscription usage metrics in a given location.
244
+ #
245
+ # @param next_page_link [String] The NextLink from the previous successful call
246
+ # to List operation.
247
+ # @param [Hash{String => String}] A hash of custom headers that will be added
248
+ # to the HTTP request.
249
+ #
250
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
251
+ #
252
+ def list_by_location_next_async(next_page_link, custom_headers:nil)
253
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
254
+
255
+
256
+ request_headers = {}
257
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
258
+
259
+ # Set Headers
260
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
261
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
262
+ path_template = '{nextLink}'
263
+
264
+ request_url = @base_url || @client.base_url
265
+
266
+ options = {
267
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
268
+ skip_encoding_path_params: {'nextLink' => next_page_link},
269
+ headers: request_headers.merge(custom_headers || {}),
270
+ base_url: request_url
271
+ }
272
+ promise = @client.make_request_async(:get, path_template, options)
273
+
274
+ promise = promise.then do |result|
275
+ http_response = result.response
276
+ status_code = http_response.status
277
+ response_content = http_response.body
278
+ unless status_code == 200
279
+ error_model = JSON.load(response_content)
280
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
281
+ end
282
+
283
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
284
+ # Deserialize Response
285
+ if status_code == 200
286
+ begin
287
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
288
+ result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::SubscriptionUsageListResult.mapper()
289
+ result.body = @client.deserialize(result_mapper, parsed_response)
290
+ rescue Exception => e
291
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
292
+ end
293
+ end
294
+
295
+ result
296
+ end
297
+
298
+ promise.execute
299
+ end
300
+
301
+ #
302
+ # Gets all subscription usage metrics in a given location.
303
+ #
304
+ # @param location_name [String] The name of the region where the resource is
305
+ # located.
306
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
307
+ # will be added to the HTTP request.
308
+ #
309
+ # @return [SubscriptionUsageListResult] which provide lazy access to pages of
310
+ # the response.
311
+ #
312
+ def list_by_location_as_lazy(location_name, custom_headers:nil)
313
+ response = list_by_location_async(location_name, custom_headers:custom_headers).value!
314
+ unless response.nil?
315
+ page = response.body
316
+ page.next_method = Proc.new do |next_page_link|
317
+ list_by_location_next_async(next_page_link, custom_headers:custom_headers)
318
+ end
319
+ page
320
+ end
321
+ end
322
+
323
+ end
324
+ end