azure_mgmt_sql 0.11.0 → 0.12.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +95 -46
  3. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_policies.rb +310 -0
  4. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_vaults.rb +300 -0
  5. data/lib/generated/azure_mgmt_sql/data_masking_policies.rb +248 -0
  6. data/lib/generated/azure_mgmt_sql/data_masking_rules.rb +262 -0
  7. data/lib/generated/azure_mgmt_sql/database_blob_auditing_policies.rb +264 -0
  8. data/lib/generated/azure_mgmt_sql/database_threat_detection_policies.rb +264 -0
  9. data/lib/generated/azure_mgmt_sql/database_usages.rb +129 -0
  10. data/lib/generated/azure_mgmt_sql/databases.rb +357 -2825
  11. data/lib/generated/azure_mgmt_sql/elastic_pool_activities.rb +132 -0
  12. data/lib/generated/azure_mgmt_sql/elastic_pool_database_activities.rb +129 -0
  13. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +0 -417
  14. data/lib/generated/azure_mgmt_sql/encryption_protectors.rb +498 -0
  15. data/lib/generated/azure_mgmt_sql/failover_groups.rb +6 -6
  16. data/lib/generated/azure_mgmt_sql/geo_backup_policies.rb +359 -0
  17. data/lib/generated/azure_mgmt_sql/models/database_usage.rb +4 -9
  18. data/lib/generated/azure_mgmt_sql/models/encryption_protector.rb +3 -4
  19. data/lib/generated/azure_mgmt_sql/models/failover_group.rb +2 -2
  20. data/lib/generated/azure_mgmt_sql/models/failover_group_read_write_endpoint.rb +6 -4
  21. data/lib/generated/azure_mgmt_sql/models/failover_group_update.rb +93 -0
  22. data/lib/generated/azure_mgmt_sql/models/firewall_rule.rb +11 -14
  23. data/lib/generated/azure_mgmt_sql/models/metric_value.rb +1 -17
  24. data/lib/generated/azure_mgmt_sql/models/operation.rb +36 -3
  25. data/lib/generated/azure_mgmt_sql/models/operation_display.rb +20 -5
  26. data/lib/generated/azure_mgmt_sql/models/operation_list_result.rb +36 -6
  27. data/lib/generated/azure_mgmt_sql/models/operation_origin.rb +16 -0
  28. data/lib/generated/azure_mgmt_sql/models/partner_info.rb +1 -1
  29. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +9 -12
  30. data/lib/generated/azure_mgmt_sql/models/server_azure_adadministrator.rb +11 -3
  31. data/lib/generated/azure_mgmt_sql/models/server_key.rb +3 -4
  32. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +11 -3
  33. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +11 -3
  34. data/lib/generated/azure_mgmt_sql/models/sync_agent.rb +137 -0
  35. data/lib/generated/azure_mgmt_sql/models/{sql_sub_resource.rb → sync_agent_key_properties.rb} +9 -20
  36. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database.rb +126 -0
  37. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database_list_result.rb +96 -0
  38. data/lib/generated/azure_mgmt_sql/models/sync_agent_list_result.rb +96 -0
  39. data/lib/generated/azure_mgmt_sql/models/sync_agent_state.rb +17 -0
  40. data/lib/generated/azure_mgmt_sql/models/sync_conflict_resolution_policy.rb +16 -0
  41. data/lib/generated/azure_mgmt_sql/models/sync_database_id_list_result.rb +96 -0
  42. data/lib/generated/azure_mgmt_sql/models/{sub_resource.rb → sync_database_id_properties.rb} +7 -15
  43. data/lib/generated/azure_mgmt_sql/models/sync_direction.rb +17 -0
  44. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties.rb +66 -0
  45. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties_list_result.rb +96 -0
  46. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table.rb +99 -0
  47. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table_column.rb +112 -0
  48. data/lib/generated/azure_mgmt_sql/models/sync_group.rb +145 -0
  49. data/lib/generated/azure_mgmt_sql/models/sync_group_list_result.rb +96 -0
  50. data/lib/generated/azure_mgmt_sql/models/sync_group_log_list_result.rb +96 -0
  51. data/lib/generated/azure_mgmt_sql/models/sync_group_log_properties.rb +102 -0
  52. data/lib/generated/azure_mgmt_sql/models/sync_group_log_type.rb +18 -0
  53. data/lib/generated/azure_mgmt_sql/models/sync_group_schema.rb +64 -0
  54. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table.rb +64 -0
  55. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table_column.rb +65 -0
  56. data/lib/generated/azure_mgmt_sql/models/sync_group_state.rb +19 -0
  57. data/lib/generated/azure_mgmt_sql/models/sync_member.rb +160 -0
  58. data/lib/generated/azure_mgmt_sql/models/sync_member_db_type.rb +16 -0
  59. data/lib/generated/azure_mgmt_sql/models/sync_member_list_result.rb +96 -0
  60. data/lib/generated/azure_mgmt_sql/models/sync_member_state.rb +32 -0
  61. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +22 -3
  62. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +22 -3
  63. data/lib/generated/azure_mgmt_sql/models/virtual_network_rule.rb +2 -2
  64. data/lib/generated/azure_mgmt_sql/operations.rb +111 -4
  65. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +3 -215
  66. data/lib/generated/azure_mgmt_sql/replication_links.rb +629 -0
  67. data/lib/generated/azure_mgmt_sql/restore_points.rb +132 -0
  68. data/lib/generated/azure_mgmt_sql/server_azure_adadministrators.rb +5 -5
  69. data/lib/generated/azure_mgmt_sql/server_connection_policies.rb +250 -0
  70. data/lib/generated/azure_mgmt_sql/server_keys.rb +10 -10
  71. data/lib/generated/azure_mgmt_sql/server_usages.rb +125 -0
  72. data/lib/generated/azure_mgmt_sql/servers.rb +161 -1423
  73. data/lib/generated/azure_mgmt_sql/service_objectives.rb +229 -0
  74. data/lib/generated/azure_mgmt_sql/service_tier_advisors.rb +234 -0
  75. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +100 -9
  76. data/lib/generated/azure_mgmt_sql/sync_agents.rb +983 -0
  77. data/lib/generated/azure_mgmt_sql/sync_groups.rb +1863 -0
  78. data/lib/generated/azure_mgmt_sql/sync_members.rb +1290 -0
  79. data/lib/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb +133 -0
  80. data/lib/generated/azure_mgmt_sql/transparent_data_encryptions.rb +264 -0
  81. data/lib/generated/azure_mgmt_sql/version.rb +1 -1
  82. metadata +55 -6
@@ -0,0 +1,629 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::SQL
7
+ #
8
+ # The Azure SQL Database management API provides a RESTful set of web
9
+ # services that interact with Azure SQL Database services to manage your
10
+ # databases. The API enables you to create, retrieve, update, and delete
11
+ # databases.
12
+ #
13
+ class ReplicationLinks
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ReplicationLinks 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
+ # Deletes a database replication link. Cannot be done during failover.
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 database_name [String] The name of the database that has the
35
+ # replication link to be dropped.
36
+ # @param link_id [String] The ID of the replication link to be deleted.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ #
41
+ def delete(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
42
+ response = delete_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
43
+ nil
44
+ end
45
+
46
+ #
47
+ # Deletes a database replication link. Cannot be done during failover.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group that
50
+ # contains the resource. You can obtain this value from the Azure Resource
51
+ # Manager API or the portal.
52
+ # @param server_name [String] The name of the server.
53
+ # @param database_name [String] The name of the database that has the
54
+ # replication link to be dropped.
55
+ # @param link_id [String] The ID of the replication link to be deleted.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def delete_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
62
+ delete_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Deletes a database replication link. Cannot be done during failover.
67
+ #
68
+ # @param resource_group_name [String] The name of the resource group that
69
+ # contains the resource. You can obtain this value from the Azure Resource
70
+ # Manager API or the portal.
71
+ # @param server_name [String] The name of the server.
72
+ # @param database_name [String] The name of the database that has the
73
+ # replication link to be dropped.
74
+ # @param link_id [String] The ID of the replication link to be deleted.
75
+ # @param [Hash{String => String}] A hash of custom headers that will be added
76
+ # to the HTTP request.
77
+ #
78
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
79
+ #
80
+ def delete_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
81
+ api_version = '2014-04-01'
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
84
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
85
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
86
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
87
+
88
+
89
+ request_headers = {}
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
101
+ query_params: {'api-version' => api_version},
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:delete, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200 || status_code == 204
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Gets a database replication link.
126
+ #
127
+ # @param resource_group_name [String] The name of the resource group that
128
+ # contains the resource. You can obtain this value from the Azure Resource
129
+ # Manager API or the portal.
130
+ # @param server_name [String] The name of the server.
131
+ # @param database_name [String] The name of the database to get the link for.
132
+ # @param link_id [String] The replication link ID to be retrieved.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [ReplicationLink] operation results.
137
+ #
138
+ def get(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
139
+ response = get_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # Gets a database replication link.
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 to get the link for.
151
+ # @param link_id [String] The replication link ID to be retrieved.
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
156
+ #
157
+ def get_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
158
+ get_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
159
+ end
160
+
161
+ #
162
+ # Gets a database replication link.
163
+ #
164
+ # @param resource_group_name [String] The name of the resource group that
165
+ # contains the resource. You can obtain this value from the Azure Resource
166
+ # Manager API or the portal.
167
+ # @param server_name [String] The name of the server.
168
+ # @param database_name [String] The name of the database to get the link for.
169
+ # @param link_id [String] The replication link ID to be retrieved.
170
+ # @param [Hash{String => String}] A hash of custom headers that will be added
171
+ # to the HTTP request.
172
+ #
173
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
174
+ #
175
+ def get_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
176
+ api_version = '2014-04-01'
177
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
178
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
179
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
180
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
181
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
182
+
183
+
184
+ request_headers = {}
185
+
186
+ # Set Headers
187
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
188
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
189
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'
190
+
191
+ request_url = @base_url || @client.base_url
192
+
193
+ options = {
194
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
195
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
196
+ query_params: {'api-version' => api_version},
197
+ headers: request_headers.merge(custom_headers || {}),
198
+ base_url: request_url
199
+ }
200
+ promise = @client.make_request_async(:get, path_template, options)
201
+
202
+ promise = promise.then do |result|
203
+ http_response = result.response
204
+ status_code = http_response.status
205
+ response_content = http_response.body
206
+ unless status_code == 200
207
+ error_model = JSON.load(response_content)
208
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
209
+ end
210
+
211
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
212
+ # Deserialize Response
213
+ if status_code == 200
214
+ begin
215
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
216
+ result_mapper = Azure::ARM::SQL::Models::ReplicationLink.mapper()
217
+ result.body = @client.deserialize(result_mapper, parsed_response)
218
+ rescue Exception => e
219
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
220
+ end
221
+ end
222
+
223
+ result
224
+ end
225
+
226
+ promise.execute
227
+ end
228
+
229
+ #
230
+ # Sets which replica database is primary by failing over from the current
231
+ # primary replica database.
232
+ #
233
+ # @param resource_group_name [String] The name of the resource group that
234
+ # contains the resource. You can obtain this value from the Azure Resource
235
+ # Manager API or the portal.
236
+ # @param server_name [String] The name of the server.
237
+ # @param database_name [String] The name of the database that has the
238
+ # replication link to be failed over.
239
+ # @param link_id [String] The ID of the replication link to be failed over.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ def failover(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
244
+ response = failover_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
245
+ nil
246
+ end
247
+
248
+ #
249
+ # @param resource_group_name [String] The name of the resource group that
250
+ # contains the resource. You can obtain this value from the Azure Resource
251
+ # Manager API or the portal.
252
+ # @param server_name [String] The name of the server.
253
+ # @param database_name [String] The name of the database that has the
254
+ # replication link to be failed over.
255
+ # @param link_id [String] The ID of the replication link to be failed over.
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ # @return [Concurrent::Promise] promise which provides async access to http
260
+ # response.
261
+ #
262
+ def failover_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
263
+ # Send request
264
+ promise = begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers)
265
+
266
+ promise = promise.then do |response|
267
+ # Defining deserialization method.
268
+ deserialize_method = lambda do |parsed_response|
269
+ end
270
+
271
+ # Waiting for response.
272
+ @client.get_long_running_operation_result(response, deserialize_method)
273
+ end
274
+
275
+ promise
276
+ end
277
+
278
+ #
279
+ # Sets which replica database is primary by failing over from the current
280
+ # primary replica database. This operation might result in data loss.
281
+ #
282
+ # @param resource_group_name [String] The name of the resource group that
283
+ # contains the resource. You can obtain this value from the Azure Resource
284
+ # Manager API or the portal.
285
+ # @param server_name [String] The name of the server.
286
+ # @param database_name [String] The name of the database that has the
287
+ # replication link to be failed over.
288
+ # @param link_id [String] The ID of the replication link to be failed over.
289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
290
+ # will be added to the HTTP request.
291
+ #
292
+ def failover_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
293
+ response = failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
294
+ nil
295
+ end
296
+
297
+ #
298
+ # @param resource_group_name [String] The name of the resource group that
299
+ # contains the resource. You can obtain this value from the Azure Resource
300
+ # Manager API or the portal.
301
+ # @param server_name [String] The name of the server.
302
+ # @param database_name [String] The name of the database that has the
303
+ # replication link to be failed over.
304
+ # @param link_id [String] The ID of the replication link to be failed over.
305
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
306
+ # will be added to the HTTP request.
307
+ #
308
+ # @return [Concurrent::Promise] promise which provides async access to http
309
+ # response.
310
+ #
311
+ def failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
312
+ # Send request
313
+ promise = begin_failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers)
314
+
315
+ promise = promise.then do |response|
316
+ # Defining deserialization method.
317
+ deserialize_method = lambda do |parsed_response|
318
+ end
319
+
320
+ # Waiting for response.
321
+ @client.get_long_running_operation_result(response, deserialize_method)
322
+ end
323
+
324
+ promise
325
+ end
326
+
327
+ #
328
+ # Lists a database's replication links.
329
+ #
330
+ # @param resource_group_name [String] The name of the resource group that
331
+ # contains the resource. You can obtain this value from the Azure Resource
332
+ # Manager API or the portal.
333
+ # @param server_name [String] The name of the server.
334
+ # @param database_name [String] The name of the database to retrieve links for.
335
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
336
+ # will be added to the HTTP request.
337
+ #
338
+ # @return [ReplicationLinkListResult] operation results.
339
+ #
340
+ def list_by_database(resource_group_name, server_name, database_name, custom_headers = nil)
341
+ response = list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
342
+ response.body unless response.nil?
343
+ end
344
+
345
+ #
346
+ # Lists a database's replication links.
347
+ #
348
+ # @param resource_group_name [String] The name of the resource group that
349
+ # contains the resource. You can obtain this value from the Azure Resource
350
+ # Manager API or the portal.
351
+ # @param server_name [String] The name of the server.
352
+ # @param database_name [String] The name of the database to retrieve links for.
353
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
354
+ # will be added to the HTTP request.
355
+ #
356
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
357
+ #
358
+ def list_by_database_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
359
+ list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
360
+ end
361
+
362
+ #
363
+ # Lists a database's replication links.
364
+ #
365
+ # @param resource_group_name [String] The name of the resource group that
366
+ # contains the resource. You can obtain this value from the Azure Resource
367
+ # Manager API or the portal.
368
+ # @param server_name [String] The name of the server.
369
+ # @param database_name [String] The name of the database to retrieve links for.
370
+ # @param [Hash{String => String}] A hash of custom headers that will be added
371
+ # to the HTTP request.
372
+ #
373
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
374
+ #
375
+ def list_by_database_async(resource_group_name, server_name, database_name, custom_headers = nil)
376
+ api_version = '2014-04-01'
377
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
378
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
379
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
380
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
381
+
382
+
383
+ request_headers = {}
384
+
385
+ # Set Headers
386
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
387
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
388
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks'
389
+
390
+ request_url = @base_url || @client.base_url
391
+
392
+ options = {
393
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
394
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
395
+ query_params: {'api-version' => api_version},
396
+ headers: request_headers.merge(custom_headers || {}),
397
+ base_url: request_url
398
+ }
399
+ promise = @client.make_request_async(:get, path_template, options)
400
+
401
+ promise = promise.then do |result|
402
+ http_response = result.response
403
+ status_code = http_response.status
404
+ response_content = http_response.body
405
+ unless status_code == 200
406
+ error_model = JSON.load(response_content)
407
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
408
+ end
409
+
410
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
411
+ # Deserialize Response
412
+ if status_code == 200
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = Azure::ARM::SQL::Models::ReplicationLinkListResult.mapper()
416
+ result.body = @client.deserialize(result_mapper, parsed_response)
417
+ rescue Exception => e
418
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
419
+ end
420
+ end
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ #
429
+ # Sets which replica database is primary by failing over from the current
430
+ # primary replica database.
431
+ #
432
+ # @param resource_group_name [String] The name of the resource group that
433
+ # contains the resource. You can obtain this value from the Azure Resource
434
+ # Manager API or the portal.
435
+ # @param server_name [String] The name of the server.
436
+ # @param database_name [String] The name of the database that has the
437
+ # replication link to be failed over.
438
+ # @param link_id [String] The ID of the replication link to be failed over.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ #
443
+ def begin_failover(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
444
+ response = begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
445
+ nil
446
+ end
447
+
448
+ #
449
+ # Sets which replica database is primary by failing over from the current
450
+ # primary replica database.
451
+ #
452
+ # @param resource_group_name [String] The name of the resource group that
453
+ # contains the resource. You can obtain this value from the Azure Resource
454
+ # Manager API or the portal.
455
+ # @param server_name [String] The name of the server.
456
+ # @param database_name [String] The name of the database that has the
457
+ # replication link to be failed over.
458
+ # @param link_id [String] The ID of the replication link to be failed over.
459
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
460
+ # will be added to the HTTP request.
461
+ #
462
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
463
+ #
464
+ def begin_failover_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
465
+ begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
466
+ end
467
+
468
+ #
469
+ # Sets which replica database is primary by failing over from the current
470
+ # primary replica database.
471
+ #
472
+ # @param resource_group_name [String] The name of the resource group that
473
+ # contains the resource. You can obtain this value from the Azure Resource
474
+ # Manager API or the portal.
475
+ # @param server_name [String] The name of the server.
476
+ # @param database_name [String] The name of the database that has the
477
+ # replication link to be failed over.
478
+ # @param link_id [String] The ID of the replication link to be failed over.
479
+ # @param [Hash{String => String}] A hash of custom headers that will be added
480
+ # to the HTTP request.
481
+ #
482
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
483
+ #
484
+ def begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
485
+ api_version = '2014-04-01'
486
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
487
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
488
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
489
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
490
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
491
+
492
+
493
+ request_headers = {}
494
+
495
+ # Set Headers
496
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
497
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
498
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover'
499
+
500
+ request_url = @base_url || @client.base_url
501
+
502
+ options = {
503
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
504
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
505
+ query_params: {'api-version' => api_version},
506
+ headers: request_headers.merge(custom_headers || {}),
507
+ base_url: request_url
508
+ }
509
+ promise = @client.make_request_async(:post, path_template, options)
510
+
511
+ promise = promise.then do |result|
512
+ http_response = result.response
513
+ status_code = http_response.status
514
+ response_content = http_response.body
515
+ unless status_code == 204 || status_code == 202
516
+ error_model = JSON.load(response_content)
517
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
518
+ end
519
+
520
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
521
+
522
+ result
523
+ end
524
+
525
+ promise.execute
526
+ end
527
+
528
+ #
529
+ # Sets which replica database is primary by failing over from the current
530
+ # primary replica database. This operation might result in data loss.
531
+ #
532
+ # @param resource_group_name [String] The name of the resource group that
533
+ # contains the resource. You can obtain this value from the Azure Resource
534
+ # Manager API or the portal.
535
+ # @param server_name [String] The name of the server.
536
+ # @param database_name [String] The name of the database that has the
537
+ # replication link to be failed over.
538
+ # @param link_id [String] The ID of the replication link to be failed over.
539
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
540
+ # will be added to the HTTP request.
541
+ #
542
+ #
543
+ def begin_failover_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
544
+ response = begin_failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
545
+ nil
546
+ end
547
+
548
+ #
549
+ # Sets which replica database is primary by failing over from the current
550
+ # primary replica database. This operation might result in data loss.
551
+ #
552
+ # @param resource_group_name [String] The name of the resource group that
553
+ # contains the resource. You can obtain this value from the Azure Resource
554
+ # Manager API or the portal.
555
+ # @param server_name [String] The name of the server.
556
+ # @param database_name [String] The name of the database that has the
557
+ # replication link to be failed over.
558
+ # @param link_id [String] The ID of the replication link to be failed over.
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
563
+ #
564
+ def begin_failover_allow_data_loss_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
565
+ begin_failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
566
+ end
567
+
568
+ #
569
+ # Sets which replica database is primary by failing over from the current
570
+ # primary replica database. This operation might result in data loss.
571
+ #
572
+ # @param resource_group_name [String] The name of the resource group that
573
+ # contains the resource. You can obtain this value from the Azure Resource
574
+ # Manager API or the portal.
575
+ # @param server_name [String] The name of the server.
576
+ # @param database_name [String] The name of the database that has the
577
+ # replication link to be failed over.
578
+ # @param link_id [String] The ID of the replication link to be failed over.
579
+ # @param [Hash{String => String}] A hash of custom headers that will be added
580
+ # to the HTTP request.
581
+ #
582
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
583
+ #
584
+ def begin_failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
585
+ api_version = '2014-04-01'
586
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
587
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
588
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
589
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
590
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
591
+
592
+
593
+ request_headers = {}
594
+
595
+ # Set Headers
596
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
597
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
598
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'
599
+
600
+ request_url = @base_url || @client.base_url
601
+
602
+ options = {
603
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
604
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
605
+ query_params: {'api-version' => api_version},
606
+ headers: request_headers.merge(custom_headers || {}),
607
+ base_url: request_url
608
+ }
609
+ promise = @client.make_request_async(:post, path_template, options)
610
+
611
+ promise = promise.then do |result|
612
+ http_response = result.response
613
+ status_code = http_response.status
614
+ response_content = http_response.body
615
+ unless status_code == 204 || status_code == 202
616
+ error_model = JSON.load(response_content)
617
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
618
+ end
619
+
620
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
621
+
622
+ result
623
+ end
624
+
625
+ promise.execute
626
+ end
627
+
628
+ end
629
+ end