azure_mgmt_sql 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,1599 @@
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::V2017_03_01_preview
7
+ #
8
+ # The Azure SQL Database management API provides a RESTful set of web APIs
9
+ # that interact with Azure SQL Database services to manage your databases.
10
+ # The API enables users to create, retrieve, update, and delete databases,
11
+ # servers, and other entities.
12
+ #
13
+ class Databases
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Databases 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 a list of databases.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Array<Database>] operation results.
38
+ #
39
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
40
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
41
+ first_page.get_all_items
42
+ end
43
+
44
+ #
45
+ # Gets a list of databases.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the resource. You can obtain this value from the Azure Resource
49
+ # Manager API or the portal.
50
+ # @param server_name [String] The name of the server.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
57
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Gets a list of databases.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group that
64
+ # contains the resource. You can obtain this value from the Azure Resource
65
+ # Manager API or the portal.
66
+ # @param server_name [String] The name of the server.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Gets a database.
127
+ #
128
+ # @param resource_group_name [String] The name of the resource group that
129
+ # contains the resource. You can obtain this value from the Azure Resource
130
+ # Manager API or the portal.
131
+ # @param server_name [String] The name of the server.
132
+ # @param database_name [String] The name of the database.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Database] operation results.
137
+ #
138
+ def get(resource_group_name, server_name, database_name, custom_headers:nil)
139
+ response = get_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # Gets a database.
145
+ #
146
+ # @param resource_group_name [String] The name of the resource group that
147
+ # contains the resource. You can obtain this value from the Azure Resource
148
+ # Manager API or the portal.
149
+ # @param server_name [String] The name of the server.
150
+ # @param database_name [String] The name of the database.
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
155
+ #
156
+ def get_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
157
+ get_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
158
+ end
159
+
160
+ #
161
+ # Gets a database.
162
+ #
163
+ # @param resource_group_name [String] The name of the resource group that
164
+ # contains the resource. You can obtain this value from the Azure Resource
165
+ # Manager API or the portal.
166
+ # @param server_name [String] The name of the server.
167
+ # @param database_name [String] The name of the database.
168
+ # @param [Hash{String => String}] A hash of custom headers that will be added
169
+ # to the HTTP request.
170
+ #
171
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
172
+ #
173
+ def get_async(resource_group_name, server_name, database_name, custom_headers:nil)
174
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
175
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
176
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
177
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
178
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
179
+
180
+
181
+ request_headers = {}
182
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
183
+
184
+ # Set Headers
185
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
186
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
187
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
188
+
189
+ request_url = @base_url || @client.base_url
190
+
191
+ options = {
192
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
193
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
194
+ query_params: {'api-version' => @client.api_version},
195
+ headers: request_headers.merge(custom_headers || {}),
196
+ base_url: request_url
197
+ }
198
+ promise = @client.make_request_async(:get, path_template, options)
199
+
200
+ promise = promise.then do |result|
201
+ http_response = result.response
202
+ status_code = http_response.status
203
+ response_content = http_response.body
204
+ unless status_code == 200
205
+ error_model = JSON.load(response_content)
206
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
207
+ end
208
+
209
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
210
+ # Deserialize Response
211
+ if status_code == 200
212
+ begin
213
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
214
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
215
+ result.body = @client.deserialize(result_mapper, parsed_response)
216
+ rescue Exception => e
217
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
218
+ end
219
+ end
220
+
221
+ result
222
+ end
223
+
224
+ promise.execute
225
+ end
226
+
227
+ #
228
+ # Creates a new database or updates an existing database.
229
+ #
230
+ # @param resource_group_name [String] The name of the resource group that
231
+ # contains the resource. You can obtain this value from the Azure Resource
232
+ # Manager API or the portal.
233
+ # @param server_name [String] The name of the server.
234
+ # @param database_name [String] The name of the database.
235
+ # @param parameters [Database] The requested database resource state.
236
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
237
+ # will be added to the HTTP request.
238
+ #
239
+ # @return [Database] operation results.
240
+ #
241
+ def create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
242
+ response = create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
243
+ response.body unless response.nil?
244
+ end
245
+
246
+ #
247
+ # @param resource_group_name [String] The name of the resource group that
248
+ # contains the resource. You can obtain this value from the Azure Resource
249
+ # Manager API or the portal.
250
+ # @param server_name [String] The name of the server.
251
+ # @param database_name [String] The name of the database.
252
+ # @param parameters [Database] The requested database resource state.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [Concurrent::Promise] promise which provides async access to http
257
+ # response.
258
+ #
259
+ def create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
260
+ # Send request
261
+ promise = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)
262
+
263
+ promise = promise.then do |response|
264
+ # Defining deserialization method.
265
+ deserialize_method = lambda do |parsed_response|
266
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
267
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
268
+ end
269
+
270
+ # Waiting for response.
271
+ @client.get_long_running_operation_result(response, deserialize_method)
272
+ end
273
+
274
+ promise
275
+ end
276
+
277
+ #
278
+ # Deletes the database.
279
+ #
280
+ # @param resource_group_name [String] The name of the resource group that
281
+ # contains the resource. You can obtain this value from the Azure Resource
282
+ # Manager API or the portal.
283
+ # @param server_name [String] The name of the server.
284
+ # @param database_name [String] The name of the database.
285
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
+ # will be added to the HTTP request.
287
+ #
288
+ def delete(resource_group_name, server_name, database_name, custom_headers:nil)
289
+ response = delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
290
+ nil
291
+ end
292
+
293
+ #
294
+ # @param resource_group_name [String] The name of the resource group that
295
+ # contains the resource. You can obtain this value from the Azure Resource
296
+ # Manager API or the portal.
297
+ # @param server_name [String] The name of the server.
298
+ # @param database_name [String] The name of the database.
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [Concurrent::Promise] promise which provides async access to http
303
+ # response.
304
+ #
305
+ def delete_async(resource_group_name, server_name, database_name, custom_headers:nil)
306
+ # Send request
307
+ promise = begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)
308
+
309
+ promise = promise.then do |response|
310
+ # Defining deserialization method.
311
+ deserialize_method = lambda do |parsed_response|
312
+ end
313
+
314
+ # Waiting for response.
315
+ @client.get_long_running_operation_result(response, deserialize_method)
316
+ end
317
+
318
+ promise
319
+ end
320
+
321
+ #
322
+ # Updates an existing database.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group that
325
+ # contains the resource. You can obtain this value from the Azure Resource
326
+ # Manager API or the portal.
327
+ # @param server_name [String] The name of the server.
328
+ # @param database_name [String] The name of the database.
329
+ # @param parameters [DatabaseUpdate] The requested database resource state.
330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
331
+ # will be added to the HTTP request.
332
+ #
333
+ # @return [Database] operation results.
334
+ #
335
+ def update(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
336
+ response = update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
337
+ response.body unless response.nil?
338
+ end
339
+
340
+ #
341
+ # @param resource_group_name [String] The name of the resource group that
342
+ # contains the resource. You can obtain this value from the Azure Resource
343
+ # Manager API or the portal.
344
+ # @param server_name [String] The name of the server.
345
+ # @param database_name [String] The name of the database.
346
+ # @param parameters [DatabaseUpdate] The requested database resource state.
347
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
348
+ # will be added to the HTTP request.
349
+ #
350
+ # @return [Concurrent::Promise] promise which provides async access to http
351
+ # response.
352
+ #
353
+ def update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
354
+ # Send request
355
+ promise = begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)
356
+
357
+ promise = promise.then do |response|
358
+ # Defining deserialization method.
359
+ deserialize_method = lambda do |parsed_response|
360
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
361
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
362
+ end
363
+
364
+ # Waiting for response.
365
+ @client.get_long_running_operation_result(response, deserialize_method)
366
+ end
367
+
368
+ promise
369
+ end
370
+
371
+ #
372
+ # Exports a database.
373
+ #
374
+ # @param resource_group_name [String] The name of the resource group that
375
+ # contains the resource. You can obtain this value from the Azure Resource
376
+ # Manager API or the portal.
377
+ # @param server_name [String] The name of the server.
378
+ # @param database_name [String] The name of the database.
379
+ # @param parameters [ImportExportDatabaseDefinition] The database export
380
+ # request parameters.
381
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
382
+ # will be added to the HTTP request.
383
+ #
384
+ # @return [ImportExportOperationResult] operation results.
385
+ #
386
+ def export(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
387
+ response = export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
388
+ response.body unless response.nil?
389
+ end
390
+
391
+ #
392
+ # @param resource_group_name [String] The name of the resource group that
393
+ # contains the resource. You can obtain this value from the Azure Resource
394
+ # Manager API or the portal.
395
+ # @param server_name [String] The name of the server.
396
+ # @param database_name [String] The name of the database.
397
+ # @param parameters [ImportExportDatabaseDefinition] The database export
398
+ # request parameters.
399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
400
+ # will be added to the HTTP request.
401
+ #
402
+ # @return [Concurrent::Promise] promise which provides async access to http
403
+ # response.
404
+ #
405
+ def export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
406
+ # Send request
407
+ promise = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)
408
+
409
+ promise = promise.then do |response|
410
+ # Defining deserialization method.
411
+ deserialize_method = lambda do |parsed_response|
412
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportOperationResult.mapper()
413
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
414
+ end
415
+
416
+ # Waiting for response.
417
+ @client.get_long_running_operation_result(response, deserialize_method)
418
+ end
419
+
420
+ promise
421
+ end
422
+
423
+ #
424
+ # Pauses a database.
425
+ #
426
+ # @param resource_group_name [String] The name of the resource group that
427
+ # contains the resource. You can obtain this value from the Azure Resource
428
+ # Manager API or the portal.
429
+ # @param server_name [String] The name of the server.
430
+ # @param database_name [String] The name of the database to be paused.
431
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
432
+ # will be added to the HTTP request.
433
+ #
434
+ # @return [Database] operation results.
435
+ #
436
+ def pause(resource_group_name, server_name, database_name, custom_headers:nil)
437
+ response = pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
438
+ response.body unless response.nil?
439
+ end
440
+
441
+ #
442
+ # @param resource_group_name [String] The name of the resource group that
443
+ # contains the resource. You can obtain this value from the Azure Resource
444
+ # Manager API or the portal.
445
+ # @param server_name [String] The name of the server.
446
+ # @param database_name [String] The name of the database to be paused.
447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
448
+ # will be added to the HTTP request.
449
+ #
450
+ # @return [Concurrent::Promise] promise which provides async access to http
451
+ # response.
452
+ #
453
+ def pause_async(resource_group_name, server_name, database_name, custom_headers:nil)
454
+ # Send request
455
+ promise = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)
456
+
457
+ promise = promise.then do |response|
458
+ # Defining deserialization method.
459
+ deserialize_method = lambda do |parsed_response|
460
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
461
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
462
+ end
463
+
464
+ # Waiting for response.
465
+ @client.get_long_running_operation_result(response, deserialize_method)
466
+ end
467
+
468
+ promise
469
+ end
470
+
471
+ #
472
+ # Gets a list of databases in an elastic pool.
473
+ #
474
+ # @param resource_group_name [String] The name of the resource group that
475
+ # contains the resource. You can obtain this value from the Azure Resource
476
+ # Manager API or the portal.
477
+ # @param server_name [String] The name of the server.
478
+ # @param elastic_pool_name [String] The name of the elastic pool.
479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
480
+ # will be added to the HTTP request.
481
+ #
482
+ # @return [Array<Database>] operation results.
483
+ #
484
+ def list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
485
+ first_page = list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers)
486
+ first_page.get_all_items
487
+ end
488
+
489
+ #
490
+ # Gets a list of databases in an elastic pool.
491
+ #
492
+ # @param resource_group_name [String] The name of the resource group that
493
+ # contains the resource. You can obtain this value from the Azure Resource
494
+ # Manager API or the portal.
495
+ # @param server_name [String] The name of the server.
496
+ # @param elastic_pool_name [String] The name of the elastic pool.
497
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
498
+ # will be added to the HTTP request.
499
+ #
500
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
501
+ #
502
+ def list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
503
+ list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
504
+ end
505
+
506
+ #
507
+ # Gets a list of databases in an elastic pool.
508
+ #
509
+ # @param resource_group_name [String] The name of the resource group that
510
+ # contains the resource. You can obtain this value from the Azure Resource
511
+ # Manager API or the portal.
512
+ # @param server_name [String] The name of the server.
513
+ # @param elastic_pool_name [String] The name of the elastic pool.
514
+ # @param [Hash{String => String}] A hash of custom headers that will be added
515
+ # to the HTTP request.
516
+ #
517
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
518
+ #
519
+ def list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
520
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
521
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
522
+ fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil?
523
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
524
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
525
+
526
+
527
+ request_headers = {}
528
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
529
+
530
+ # Set Headers
531
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
532
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
533
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'
534
+
535
+ request_url = @base_url || @client.base_url
536
+
537
+ options = {
538
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
539
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name,'subscriptionId' => @client.subscription_id},
540
+ query_params: {'api-version' => @client.api_version},
541
+ headers: request_headers.merge(custom_headers || {}),
542
+ base_url: request_url
543
+ }
544
+ promise = @client.make_request_async(:get, path_template, options)
545
+
546
+ promise = promise.then do |result|
547
+ http_response = result.response
548
+ status_code = http_response.status
549
+ response_content = http_response.body
550
+ unless status_code == 200
551
+ error_model = JSON.load(response_content)
552
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
553
+ end
554
+
555
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
556
+ # Deserialize Response
557
+ if status_code == 200
558
+ begin
559
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
560
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper()
561
+ result.body = @client.deserialize(result_mapper, parsed_response)
562
+ rescue Exception => e
563
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
564
+ end
565
+ end
566
+
567
+ result
568
+ end
569
+
570
+ promise.execute
571
+ end
572
+
573
+ #
574
+ # Resumes a database.
575
+ #
576
+ # @param resource_group_name [String] The name of the resource group that
577
+ # contains the resource. You can obtain this value from the Azure Resource
578
+ # Manager API or the portal.
579
+ # @param server_name [String] The name of the server.
580
+ # @param database_name [String] The name of the database to be resumed.
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [Database] operation results.
585
+ #
586
+ def resume(resource_group_name, server_name, database_name, custom_headers:nil)
587
+ response = resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
588
+ response.body unless response.nil?
589
+ end
590
+
591
+ #
592
+ # @param resource_group_name [String] The name of the resource group that
593
+ # contains the resource. You can obtain this value from the Azure Resource
594
+ # Manager API or the portal.
595
+ # @param server_name [String] The name of the server.
596
+ # @param database_name [String] The name of the database to be resumed.
597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
598
+ # will be added to the HTTP request.
599
+ #
600
+ # @return [Concurrent::Promise] promise which provides async access to http
601
+ # response.
602
+ #
603
+ def resume_async(resource_group_name, server_name, database_name, custom_headers:nil)
604
+ # Send request
605
+ promise = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers)
606
+
607
+ promise = promise.then do |response|
608
+ # Defining deserialization method.
609
+ deserialize_method = lambda do |parsed_response|
610
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
611
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
612
+ end
613
+
614
+ # Waiting for response.
615
+ @client.get_long_running_operation_result(response, deserialize_method)
616
+ end
617
+
618
+ promise
619
+ end
620
+
621
+ #
622
+ # Renames a database.
623
+ #
624
+ # @param resource_group_name [String] The name of the resource group that
625
+ # contains the resource. You can obtain this value from the Azure Resource
626
+ # Manager API or the portal.
627
+ # @param server_name [String] The name of the server.
628
+ # @param database_name [String] The name of the database to rename.
629
+ # @param parameters [ResourceMoveDefinition] The resource move definition for
630
+ # renaming this database.
631
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
632
+ # will be added to the HTTP request.
633
+ #
634
+ #
635
+ def rename(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
636
+ response = rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
637
+ nil
638
+ end
639
+
640
+ #
641
+ # Renames a database.
642
+ #
643
+ # @param resource_group_name [String] The name of the resource group that
644
+ # contains the resource. You can obtain this value from the Azure Resource
645
+ # Manager API or the portal.
646
+ # @param server_name [String] The name of the server.
647
+ # @param database_name [String] The name of the database to rename.
648
+ # @param parameters [ResourceMoveDefinition] The resource move definition for
649
+ # renaming this database.
650
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
651
+ # will be added to the HTTP request.
652
+ #
653
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
654
+ #
655
+ def rename_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
656
+ rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
657
+ end
658
+
659
+ #
660
+ # Renames a database.
661
+ #
662
+ # @param resource_group_name [String] The name of the resource group that
663
+ # contains the resource. You can obtain this value from the Azure Resource
664
+ # Manager API or the portal.
665
+ # @param server_name [String] The name of the server.
666
+ # @param database_name [String] The name of the database to rename.
667
+ # @param parameters [ResourceMoveDefinition] The resource move definition for
668
+ # renaming this database.
669
+ # @param [Hash{String => String}] A hash of custom headers that will be added
670
+ # to the HTTP request.
671
+ #
672
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
673
+ #
674
+ def rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
675
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
676
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
677
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
678
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
679
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
680
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
681
+
682
+
683
+ request_headers = {}
684
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
685
+
686
+ # Set Headers
687
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
688
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
689
+
690
+ # Serialize Request
691
+ request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ResourceMoveDefinition.mapper()
692
+ request_content = @client.serialize(request_mapper, parameters)
693
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
694
+
695
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move'
696
+
697
+ request_url = @base_url || @client.base_url
698
+
699
+ options = {
700
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
701
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
702
+ query_params: {'api-version' => @client.api_version},
703
+ body: request_content,
704
+ headers: request_headers.merge(custom_headers || {}),
705
+ base_url: request_url
706
+ }
707
+ promise = @client.make_request_async(:post, path_template, options)
708
+
709
+ promise = promise.then do |result|
710
+ http_response = result.response
711
+ status_code = http_response.status
712
+ response_content = http_response.body
713
+ unless status_code == 200
714
+ error_model = JSON.load(response_content)
715
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
716
+ end
717
+
718
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
719
+
720
+ result
721
+ end
722
+
723
+ promise.execute
724
+ end
725
+
726
+ #
727
+ # Creates a new database or updates an existing database.
728
+ #
729
+ # @param resource_group_name [String] The name of the resource group that
730
+ # contains the resource. You can obtain this value from the Azure Resource
731
+ # Manager API or the portal.
732
+ # @param server_name [String] The name of the server.
733
+ # @param database_name [String] The name of the database.
734
+ # @param parameters [Database] The requested database resource state.
735
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
736
+ # will be added to the HTTP request.
737
+ #
738
+ # @return [Database] operation results.
739
+ #
740
+ def begin_create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
741
+ response = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
742
+ response.body unless response.nil?
743
+ end
744
+
745
+ #
746
+ # Creates a new database or updates an existing database.
747
+ #
748
+ # @param resource_group_name [String] The name of the resource group that
749
+ # contains the resource. You can obtain this value from the Azure Resource
750
+ # Manager API or the portal.
751
+ # @param server_name [String] The name of the server.
752
+ # @param database_name [String] The name of the database.
753
+ # @param parameters [Database] The requested database resource state.
754
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
755
+ # will be added to the HTTP request.
756
+ #
757
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
758
+ #
759
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
760
+ begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
761
+ end
762
+
763
+ #
764
+ # Creates a new database or updates an existing database.
765
+ #
766
+ # @param resource_group_name [String] The name of the resource group that
767
+ # contains the resource. You can obtain this value from the Azure Resource
768
+ # Manager API or the portal.
769
+ # @param server_name [String] The name of the server.
770
+ # @param database_name [String] The name of the database.
771
+ # @param parameters [Database] The requested database resource state.
772
+ # @param [Hash{String => String}] A hash of custom headers that will be added
773
+ # to the HTTP request.
774
+ #
775
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
776
+ #
777
+ def begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
778
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
779
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
780
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
781
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
782
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
783
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
784
+
785
+
786
+ request_headers = {}
787
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
788
+
789
+ # Set Headers
790
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
791
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
792
+
793
+ # Serialize Request
794
+ request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
795
+ request_content = @client.serialize(request_mapper, parameters)
796
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
797
+
798
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
799
+
800
+ request_url = @base_url || @client.base_url
801
+
802
+ options = {
803
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
804
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
805
+ query_params: {'api-version' => @client.api_version},
806
+ body: request_content,
807
+ headers: request_headers.merge(custom_headers || {}),
808
+ base_url: request_url
809
+ }
810
+ promise = @client.make_request_async(:put, path_template, options)
811
+
812
+ promise = promise.then do |result|
813
+ http_response = result.response
814
+ status_code = http_response.status
815
+ response_content = http_response.body
816
+ unless status_code == 200 || status_code == 202 || status_code == 201
817
+ error_model = JSON.load(response_content)
818
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
819
+ end
820
+
821
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
822
+ # Deserialize Response
823
+ if status_code == 200
824
+ begin
825
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
826
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
827
+ result.body = @client.deserialize(result_mapper, parsed_response)
828
+ rescue Exception => e
829
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
830
+ end
831
+ end
832
+ # Deserialize Response
833
+ if status_code == 201
834
+ begin
835
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
836
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
837
+ result.body = @client.deserialize(result_mapper, parsed_response)
838
+ rescue Exception => e
839
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
840
+ end
841
+ end
842
+
843
+ result
844
+ end
845
+
846
+ promise.execute
847
+ end
848
+
849
+ #
850
+ # Deletes the database.
851
+ #
852
+ # @param resource_group_name [String] The name of the resource group that
853
+ # contains the resource. You can obtain this value from the Azure Resource
854
+ # Manager API or the portal.
855
+ # @param server_name [String] The name of the server.
856
+ # @param database_name [String] The name of the database.
857
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
858
+ # will be added to the HTTP request.
859
+ #
860
+ #
861
+ def begin_delete(resource_group_name, server_name, database_name, custom_headers:nil)
862
+ response = begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
863
+ nil
864
+ end
865
+
866
+ #
867
+ # Deletes the database.
868
+ #
869
+ # @param resource_group_name [String] The name of the resource group that
870
+ # contains the resource. You can obtain this value from the Azure Resource
871
+ # Manager API or the portal.
872
+ # @param server_name [String] The name of the server.
873
+ # @param database_name [String] The name of the database.
874
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
875
+ # will be added to the HTTP request.
876
+ #
877
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
878
+ #
879
+ def begin_delete_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
880
+ begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
881
+ end
882
+
883
+ #
884
+ # Deletes the database.
885
+ #
886
+ # @param resource_group_name [String] The name of the resource group that
887
+ # contains the resource. You can obtain this value from the Azure Resource
888
+ # Manager API or the portal.
889
+ # @param server_name [String] The name of the server.
890
+ # @param database_name [String] The name of the database.
891
+ # @param [Hash{String => String}] A hash of custom headers that will be added
892
+ # to the HTTP request.
893
+ #
894
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
895
+ #
896
+ def begin_delete_async(resource_group_name, server_name, database_name, custom_headers:nil)
897
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
898
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
899
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
900
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
901
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
902
+
903
+
904
+ request_headers = {}
905
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
906
+
907
+ # Set Headers
908
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
909
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
910
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
911
+
912
+ request_url = @base_url || @client.base_url
913
+
914
+ options = {
915
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
916
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
917
+ query_params: {'api-version' => @client.api_version},
918
+ headers: request_headers.merge(custom_headers || {}),
919
+ base_url: request_url
920
+ }
921
+ promise = @client.make_request_async(:delete, path_template, options)
922
+
923
+ promise = promise.then do |result|
924
+ http_response = result.response
925
+ status_code = http_response.status
926
+ response_content = http_response.body
927
+ unless status_code == 200 || status_code == 202 || status_code == 204
928
+ error_model = JSON.load(response_content)
929
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
930
+ end
931
+
932
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
933
+
934
+ result
935
+ end
936
+
937
+ promise.execute
938
+ end
939
+
940
+ #
941
+ # Updates an existing database.
942
+ #
943
+ # @param resource_group_name [String] The name of the resource group that
944
+ # contains the resource. You can obtain this value from the Azure Resource
945
+ # Manager API or the portal.
946
+ # @param server_name [String] The name of the server.
947
+ # @param database_name [String] The name of the database.
948
+ # @param parameters [DatabaseUpdate] The requested database resource state.
949
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
950
+ # will be added to the HTTP request.
951
+ #
952
+ # @return [Database] operation results.
953
+ #
954
+ def begin_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
955
+ response = begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
956
+ response.body unless response.nil?
957
+ end
958
+
959
+ #
960
+ # Updates an existing database.
961
+ #
962
+ # @param resource_group_name [String] The name of the resource group that
963
+ # contains the resource. You can obtain this value from the Azure Resource
964
+ # Manager API or the portal.
965
+ # @param server_name [String] The name of the server.
966
+ # @param database_name [String] The name of the database.
967
+ # @param parameters [DatabaseUpdate] The requested database resource state.
968
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
969
+ # will be added to the HTTP request.
970
+ #
971
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
972
+ #
973
+ def begin_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
974
+ begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
975
+ end
976
+
977
+ #
978
+ # Updates an existing database.
979
+ #
980
+ # @param resource_group_name [String] The name of the resource group that
981
+ # contains the resource. You can obtain this value from the Azure Resource
982
+ # Manager API or the portal.
983
+ # @param server_name [String] The name of the server.
984
+ # @param database_name [String] The name of the database.
985
+ # @param parameters [DatabaseUpdate] The requested database resource state.
986
+ # @param [Hash{String => String}] A hash of custom headers that will be added
987
+ # to the HTTP request.
988
+ #
989
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
990
+ #
991
+ def begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
992
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
993
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
994
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
995
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
996
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
997
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
998
+
999
+
1000
+ request_headers = {}
1001
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1002
+
1003
+ # Set Headers
1004
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1005
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1006
+
1007
+ # Serialize Request
1008
+ request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseUpdate.mapper()
1009
+ request_content = @client.serialize(request_mapper, parameters)
1010
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1011
+
1012
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
1013
+
1014
+ request_url = @base_url || @client.base_url
1015
+
1016
+ options = {
1017
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1018
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1019
+ query_params: {'api-version' => @client.api_version},
1020
+ body: request_content,
1021
+ headers: request_headers.merge(custom_headers || {}),
1022
+ base_url: request_url
1023
+ }
1024
+ promise = @client.make_request_async(:patch, path_template, options)
1025
+
1026
+ promise = promise.then do |result|
1027
+ http_response = result.response
1028
+ status_code = http_response.status
1029
+ response_content = http_response.body
1030
+ unless status_code == 200 || status_code == 202
1031
+ error_model = JSON.load(response_content)
1032
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1033
+ end
1034
+
1035
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1036
+ # Deserialize Response
1037
+ if status_code == 200
1038
+ begin
1039
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1040
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
1041
+ result.body = @client.deserialize(result_mapper, parsed_response)
1042
+ rescue Exception => e
1043
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1044
+ end
1045
+ end
1046
+
1047
+ result
1048
+ end
1049
+
1050
+ promise.execute
1051
+ end
1052
+
1053
+ #
1054
+ # Exports a database.
1055
+ #
1056
+ # @param resource_group_name [String] The name of the resource group that
1057
+ # contains the resource. You can obtain this value from the Azure Resource
1058
+ # Manager API or the portal.
1059
+ # @param server_name [String] The name of the server.
1060
+ # @param database_name [String] The name of the database.
1061
+ # @param parameters [ImportExportDatabaseDefinition] The database export
1062
+ # request parameters.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [ImportExportOperationResult] operation results.
1067
+ #
1068
+ def begin_export(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
1069
+ response = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
1070
+ response.body unless response.nil?
1071
+ end
1072
+
1073
+ #
1074
+ # Exports a database.
1075
+ #
1076
+ # @param resource_group_name [String] The name of the resource group that
1077
+ # contains the resource. You can obtain this value from the Azure Resource
1078
+ # Manager API or the portal.
1079
+ # @param server_name [String] The name of the server.
1080
+ # @param database_name [String] The name of the database.
1081
+ # @param parameters [ImportExportDatabaseDefinition] The database export
1082
+ # request parameters.
1083
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1084
+ # will be added to the HTTP request.
1085
+ #
1086
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1087
+ #
1088
+ def begin_export_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
1089
+ begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
1090
+ end
1091
+
1092
+ #
1093
+ # Exports a database.
1094
+ #
1095
+ # @param resource_group_name [String] The name of the resource group that
1096
+ # contains the resource. You can obtain this value from the Azure Resource
1097
+ # Manager API or the portal.
1098
+ # @param server_name [String] The name of the server.
1099
+ # @param database_name [String] The name of the database.
1100
+ # @param parameters [ImportExportDatabaseDefinition] The database export
1101
+ # request parameters.
1102
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1103
+ # to the HTTP request.
1104
+ #
1105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1106
+ #
1107
+ def begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
1108
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1109
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1110
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1111
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1112
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1113
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1114
+
1115
+
1116
+ request_headers = {}
1117
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1118
+
1119
+ # Set Headers
1120
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1121
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1122
+
1123
+ # Serialize Request
1124
+ request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportDatabaseDefinition.mapper()
1125
+ request_content = @client.serialize(request_mapper, parameters)
1126
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1127
+
1128
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export'
1129
+
1130
+ request_url = @base_url || @client.base_url
1131
+
1132
+ options = {
1133
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1134
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1135
+ query_params: {'api-version' => @client.api_version},
1136
+ body: request_content,
1137
+ headers: request_headers.merge(custom_headers || {}),
1138
+ base_url: request_url
1139
+ }
1140
+ promise = @client.make_request_async(:post, path_template, options)
1141
+
1142
+ promise = promise.then do |result|
1143
+ http_response = result.response
1144
+ status_code = http_response.status
1145
+ response_content = http_response.body
1146
+ unless status_code == 200 || status_code == 202
1147
+ error_model = JSON.load(response_content)
1148
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1149
+ end
1150
+
1151
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1152
+ # Deserialize Response
1153
+ if status_code == 200
1154
+ begin
1155
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1156
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportOperationResult.mapper()
1157
+ result.body = @client.deserialize(result_mapper, parsed_response)
1158
+ rescue Exception => e
1159
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1160
+ end
1161
+ end
1162
+
1163
+ result
1164
+ end
1165
+
1166
+ promise.execute
1167
+ end
1168
+
1169
+ #
1170
+ # Pauses a database.
1171
+ #
1172
+ # @param resource_group_name [String] The name of the resource group that
1173
+ # contains the resource. You can obtain this value from the Azure Resource
1174
+ # Manager API or the portal.
1175
+ # @param server_name [String] The name of the server.
1176
+ # @param database_name [String] The name of the database to be paused.
1177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1178
+ # will be added to the HTTP request.
1179
+ #
1180
+ # @return [Database] operation results.
1181
+ #
1182
+ def begin_pause(resource_group_name, server_name, database_name, custom_headers:nil)
1183
+ response = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
1184
+ response.body unless response.nil?
1185
+ end
1186
+
1187
+ #
1188
+ # Pauses a database.
1189
+ #
1190
+ # @param resource_group_name [String] The name of the resource group that
1191
+ # contains the resource. You can obtain this value from the Azure Resource
1192
+ # Manager API or the portal.
1193
+ # @param server_name [String] The name of the server.
1194
+ # @param database_name [String] The name of the database to be paused.
1195
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1196
+ # will be added to the HTTP request.
1197
+ #
1198
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1199
+ #
1200
+ def begin_pause_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
1201
+ begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
1202
+ end
1203
+
1204
+ #
1205
+ # Pauses a database.
1206
+ #
1207
+ # @param resource_group_name [String] The name of the resource group that
1208
+ # contains the resource. You can obtain this value from the Azure Resource
1209
+ # Manager API or the portal.
1210
+ # @param server_name [String] The name of the server.
1211
+ # @param database_name [String] The name of the database to be paused.
1212
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1213
+ # to the HTTP request.
1214
+ #
1215
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1216
+ #
1217
+ def begin_pause_async(resource_group_name, server_name, database_name, custom_headers:nil)
1218
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1219
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1220
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1221
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1222
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1223
+
1224
+
1225
+ request_headers = {}
1226
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1227
+
1228
+ # Set Headers
1229
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1230
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1231
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause'
1232
+
1233
+ request_url = @base_url || @client.base_url
1234
+
1235
+ options = {
1236
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1237
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1238
+ query_params: {'api-version' => @client.api_version},
1239
+ headers: request_headers.merge(custom_headers || {}),
1240
+ base_url: request_url
1241
+ }
1242
+ promise = @client.make_request_async(:post, path_template, options)
1243
+
1244
+ promise = promise.then do |result|
1245
+ http_response = result.response
1246
+ status_code = http_response.status
1247
+ response_content = http_response.body
1248
+ unless status_code == 200 || status_code == 202
1249
+ error_model = JSON.load(response_content)
1250
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1251
+ end
1252
+
1253
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1254
+ # Deserialize Response
1255
+ if status_code == 200
1256
+ begin
1257
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1258
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
1259
+ result.body = @client.deserialize(result_mapper, parsed_response)
1260
+ rescue Exception => e
1261
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1262
+ end
1263
+ end
1264
+
1265
+ result
1266
+ end
1267
+
1268
+ promise.execute
1269
+ end
1270
+
1271
+ #
1272
+ # Resumes a database.
1273
+ #
1274
+ # @param resource_group_name [String] The name of the resource group that
1275
+ # contains the resource. You can obtain this value from the Azure Resource
1276
+ # Manager API or the portal.
1277
+ # @param server_name [String] The name of the server.
1278
+ # @param database_name [String] The name of the database to be resumed.
1279
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1280
+ # will be added to the HTTP request.
1281
+ #
1282
+ # @return [Database] operation results.
1283
+ #
1284
+ def begin_resume(resource_group_name, server_name, database_name, custom_headers:nil)
1285
+ response = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
1286
+ response.body unless response.nil?
1287
+ end
1288
+
1289
+ #
1290
+ # Resumes a database.
1291
+ #
1292
+ # @param resource_group_name [String] The name of the resource group that
1293
+ # contains the resource. You can obtain this value from the Azure Resource
1294
+ # Manager API or the portal.
1295
+ # @param server_name [String] The name of the server.
1296
+ # @param database_name [String] The name of the database to be resumed.
1297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1298
+ # will be added to the HTTP request.
1299
+ #
1300
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1301
+ #
1302
+ def begin_resume_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
1303
+ begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
1304
+ end
1305
+
1306
+ #
1307
+ # Resumes a database.
1308
+ #
1309
+ # @param resource_group_name [String] The name of the resource group that
1310
+ # contains the resource. You can obtain this value from the Azure Resource
1311
+ # Manager API or the portal.
1312
+ # @param server_name [String] The name of the server.
1313
+ # @param database_name [String] The name of the database to be resumed.
1314
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1315
+ # to the HTTP request.
1316
+ #
1317
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1318
+ #
1319
+ def begin_resume_async(resource_group_name, server_name, database_name, custom_headers:nil)
1320
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1321
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1322
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1323
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1324
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1325
+
1326
+
1327
+ request_headers = {}
1328
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1329
+
1330
+ # Set Headers
1331
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1332
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1333
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume'
1334
+
1335
+ request_url = @base_url || @client.base_url
1336
+
1337
+ options = {
1338
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1339
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
1340
+ query_params: {'api-version' => @client.api_version},
1341
+ headers: request_headers.merge(custom_headers || {}),
1342
+ base_url: request_url
1343
+ }
1344
+ promise = @client.make_request_async(:post, path_template, options)
1345
+
1346
+ promise = promise.then do |result|
1347
+ http_response = result.response
1348
+ status_code = http_response.status
1349
+ response_content = http_response.body
1350
+ unless status_code == 200 || status_code == 202
1351
+ error_model = JSON.load(response_content)
1352
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1353
+ end
1354
+
1355
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1356
+ # Deserialize Response
1357
+ if status_code == 200
1358
+ begin
1359
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1360
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper()
1361
+ result.body = @client.deserialize(result_mapper, parsed_response)
1362
+ rescue Exception => e
1363
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1364
+ end
1365
+ end
1366
+
1367
+ result
1368
+ end
1369
+
1370
+ promise.execute
1371
+ end
1372
+
1373
+ #
1374
+ # Gets a list of databases.
1375
+ #
1376
+ # @param next_page_link [String] The NextLink from the previous successful call
1377
+ # to List operation.
1378
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1379
+ # will be added to the HTTP request.
1380
+ #
1381
+ # @return [DatabaseListResult] operation results.
1382
+ #
1383
+ def list_by_server_next(next_page_link, custom_headers:nil)
1384
+ response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
1385
+ response.body unless response.nil?
1386
+ end
1387
+
1388
+ #
1389
+ # Gets a list of databases.
1390
+ #
1391
+ # @param next_page_link [String] The NextLink from the previous successful call
1392
+ # to List operation.
1393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1394
+ # will be added to the HTTP request.
1395
+ #
1396
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1397
+ #
1398
+ def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
1399
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
1400
+ end
1401
+
1402
+ #
1403
+ # Gets a list of databases.
1404
+ #
1405
+ # @param next_page_link [String] The NextLink from the previous successful call
1406
+ # to List operation.
1407
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1408
+ # to the HTTP request.
1409
+ #
1410
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1411
+ #
1412
+ def list_by_server_next_async(next_page_link, custom_headers:nil)
1413
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1414
+
1415
+
1416
+ request_headers = {}
1417
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1418
+
1419
+ # Set Headers
1420
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1421
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1422
+ path_template = '{nextLink}'
1423
+
1424
+ request_url = @base_url || @client.base_url
1425
+
1426
+ options = {
1427
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1428
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1429
+ headers: request_headers.merge(custom_headers || {}),
1430
+ base_url: request_url
1431
+ }
1432
+ promise = @client.make_request_async(:get, path_template, options)
1433
+
1434
+ promise = promise.then do |result|
1435
+ http_response = result.response
1436
+ status_code = http_response.status
1437
+ response_content = http_response.body
1438
+ unless status_code == 200
1439
+ error_model = JSON.load(response_content)
1440
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1441
+ end
1442
+
1443
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1444
+ # Deserialize Response
1445
+ if status_code == 200
1446
+ begin
1447
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1448
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper()
1449
+ result.body = @client.deserialize(result_mapper, parsed_response)
1450
+ rescue Exception => e
1451
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1452
+ end
1453
+ end
1454
+
1455
+ result
1456
+ end
1457
+
1458
+ promise.execute
1459
+ end
1460
+
1461
+ #
1462
+ # Gets a list of databases in an elastic pool.
1463
+ #
1464
+ # @param next_page_link [String] The NextLink from the previous successful call
1465
+ # to List operation.
1466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1467
+ # will be added to the HTTP request.
1468
+ #
1469
+ # @return [DatabaseListResult] operation results.
1470
+ #
1471
+ def list_by_elastic_pool_next(next_page_link, custom_headers:nil)
1472
+ response = list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value!
1473
+ response.body unless response.nil?
1474
+ end
1475
+
1476
+ #
1477
+ # Gets a list of databases in an elastic pool.
1478
+ #
1479
+ # @param next_page_link [String] The NextLink from the previous successful call
1480
+ # to List operation.
1481
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1482
+ # will be added to the HTTP request.
1483
+ #
1484
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1485
+ #
1486
+ def list_by_elastic_pool_next_with_http_info(next_page_link, custom_headers:nil)
1487
+ list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value!
1488
+ end
1489
+
1490
+ #
1491
+ # Gets a list of databases in an elastic pool.
1492
+ #
1493
+ # @param next_page_link [String] The NextLink from the previous successful call
1494
+ # to List operation.
1495
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1496
+ # to the HTTP request.
1497
+ #
1498
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1499
+ #
1500
+ def list_by_elastic_pool_next_async(next_page_link, custom_headers:nil)
1501
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1502
+
1503
+
1504
+ request_headers = {}
1505
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1506
+
1507
+ # Set Headers
1508
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1509
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1510
+ path_template = '{nextLink}'
1511
+
1512
+ request_url = @base_url || @client.base_url
1513
+
1514
+ options = {
1515
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1516
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1517
+ headers: request_headers.merge(custom_headers || {}),
1518
+ base_url: request_url
1519
+ }
1520
+ promise = @client.make_request_async(:get, path_template, options)
1521
+
1522
+ promise = promise.then do |result|
1523
+ http_response = result.response
1524
+ status_code = http_response.status
1525
+ response_content = http_response.body
1526
+ unless status_code == 200
1527
+ error_model = JSON.load(response_content)
1528
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1529
+ end
1530
+
1531
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1532
+ # Deserialize Response
1533
+ if status_code == 200
1534
+ begin
1535
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1536
+ result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper()
1537
+ result.body = @client.deserialize(result_mapper, parsed_response)
1538
+ rescue Exception => e
1539
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1540
+ end
1541
+ end
1542
+
1543
+ result
1544
+ end
1545
+
1546
+ promise.execute
1547
+ end
1548
+
1549
+ #
1550
+ # Gets a list of databases.
1551
+ #
1552
+ # @param resource_group_name [String] The name of the resource group that
1553
+ # contains the resource. You can obtain this value from the Azure Resource
1554
+ # Manager API or the portal.
1555
+ # @param server_name [String] The name of the server.
1556
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1557
+ # will be added to the HTTP request.
1558
+ #
1559
+ # @return [DatabaseListResult] which provide lazy access to pages of the
1560
+ # response.
1561
+ #
1562
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
1563
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
1564
+ unless response.nil?
1565
+ page = response.body
1566
+ page.next_method = Proc.new do |next_page_link|
1567
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers)
1568
+ end
1569
+ page
1570
+ end
1571
+ end
1572
+
1573
+ #
1574
+ # Gets a list of databases in an elastic pool.
1575
+ #
1576
+ # @param resource_group_name [String] The name of the resource group that
1577
+ # contains the resource. You can obtain this value from the Azure Resource
1578
+ # Manager API or the portal.
1579
+ # @param server_name [String] The name of the server.
1580
+ # @param elastic_pool_name [String] The name of the elastic pool.
1581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1582
+ # will be added to the HTTP request.
1583
+ #
1584
+ # @return [DatabaseListResult] which provide lazy access to pages of the
1585
+ # response.
1586
+ #
1587
+ def list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
1588
+ response = list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
1589
+ unless response.nil?
1590
+ page = response.body
1591
+ page.next_method = Proc.new do |next_page_link|
1592
+ list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers)
1593
+ end
1594
+ page
1595
+ end
1596
+ end
1597
+
1598
+ end
1599
+ end