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,830 @@
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::V2014_04_01
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 DisasterRecoveryConfigurations
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the DisasterRecoveryConfigurations 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
+ # Lists a server's disaster recovery configuration.
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 [DisasterRecoveryConfigurationListResult] operation results.
38
+ #
39
+ def list(resource_group_name, server_name, custom_headers:nil)
40
+ response = list_async(resource_group_name, server_name, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Lists a server's disaster recovery configuration.
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_with_http_info(resource_group_name, server_name, custom_headers:nil)
57
+ list_async(resource_group_name, server_name, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Lists a server's disaster recovery configuration.
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_async(resource_group_name, server_name, custom_headers:nil)
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
76
+ fail ArgumentError, 'server_name is nil' if server_name.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}/disasterRecoveryConfiguration'
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: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
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::V2014_04_01::Models::DisasterRecoveryConfigurationListResult.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
+ # Deletes a disaster recovery configuration.
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 disaster_recovery_configuration_name [String] The name of the disaster
133
+ # recovery configuration to be deleted.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ def delete(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
138
+ response = delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
139
+ nil
140
+ end
141
+
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group that
144
+ # contains the resource. You can obtain this value from the Azure Resource
145
+ # Manager API or the portal.
146
+ # @param server_name [String] The name of the server.
147
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
148
+ # recovery configuration to be deleted.
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] promise which provides async access to http
153
+ # response.
154
+ #
155
+ def delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
156
+ # Send request
157
+ promise = begin_delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers)
158
+
159
+ promise = promise.then do |response|
160
+ # Defining deserialization method.
161
+ deserialize_method = lambda do |parsed_response|
162
+ end
163
+
164
+ # Waiting for response.
165
+ @client.get_long_running_operation_result(response, deserialize_method)
166
+ end
167
+
168
+ promise
169
+ end
170
+
171
+ #
172
+ # Creates or updates a disaster recovery configuration.
173
+ #
174
+ # @param resource_group_name [String] The name of the resource group that
175
+ # contains the resource. You can obtain this value from the Azure Resource
176
+ # Manager API or the portal.
177
+ # @param server_name [String] The name of the server.
178
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
179
+ # recovery configuration to be created/updated.
180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
+ # will be added to the HTTP request.
182
+ #
183
+ # @return [DisasterRecoveryConfiguration] operation results.
184
+ #
185
+ def create_or_update(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
186
+ response = create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
187
+ response.body unless response.nil?
188
+ end
189
+
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group that
192
+ # contains the resource. You can obtain this value from the Azure Resource
193
+ # Manager API or the portal.
194
+ # @param server_name [String] The name of the server.
195
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
196
+ # recovery configuration to be created/updated.
197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
198
+ # will be added to the HTTP request.
199
+ #
200
+ # @return [Concurrent::Promise] promise which provides async access to http
201
+ # response.
202
+ #
203
+ def create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
204
+ # Send request
205
+ promise = begin_create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers)
206
+
207
+ promise = promise.then do |response|
208
+ # Defining deserialization method.
209
+ deserialize_method = lambda do |parsed_response|
210
+ result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::DisasterRecoveryConfiguration.mapper()
211
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
212
+ end
213
+
214
+ # Waiting for response.
215
+ @client.get_long_running_operation_result(response, deserialize_method)
216
+ end
217
+
218
+ promise
219
+ end
220
+
221
+ #
222
+ # Gets a disaster recovery configuration.
223
+ #
224
+ # @param resource_group_name [String] The name of the resource group that
225
+ # contains the resource. You can obtain this value from the Azure Resource
226
+ # Manager API or the portal.
227
+ # @param server_name [String] The name of the server.
228
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
229
+ # recovery configuration.
230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
231
+ # will be added to the HTTP request.
232
+ #
233
+ # @return [DisasterRecoveryConfiguration] operation results.
234
+ #
235
+ def get(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
236
+ response = get_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
237
+ response.body unless response.nil?
238
+ end
239
+
240
+ #
241
+ # Gets a disaster recovery configuration.
242
+ #
243
+ # @param resource_group_name [String] The name of the resource group that
244
+ # contains the resource. You can obtain this value from the Azure Resource
245
+ # Manager API or the portal.
246
+ # @param server_name [String] The name of the server.
247
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
248
+ # recovery configuration.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
253
+ #
254
+ def get_with_http_info(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
255
+ get_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
256
+ end
257
+
258
+ #
259
+ # Gets a disaster recovery configuration.
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group that
262
+ # contains the resource. You can obtain this value from the Azure Resource
263
+ # Manager API or the portal.
264
+ # @param server_name [String] The name of the server.
265
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
266
+ # recovery configuration.
267
+ # @param [Hash{String => String}] A hash of custom headers that will be added
268
+ # to the HTTP request.
269
+ #
270
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
271
+ #
272
+ def get_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
273
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
274
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
275
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
276
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
277
+ fail ArgumentError, 'disaster_recovery_configuration_name is nil' if disaster_recovery_configuration_name.nil?
278
+
279
+
280
+ request_headers = {}
281
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
282
+
283
+ # Set Headers
284
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
285
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
286
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}'
287
+
288
+ request_url = @base_url || @client.base_url
289
+
290
+ options = {
291
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
292
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'disasterRecoveryConfigurationName' => disaster_recovery_configuration_name},
293
+ query_params: {'api-version' => @client.api_version},
294
+ headers: request_headers.merge(custom_headers || {}),
295
+ base_url: request_url
296
+ }
297
+ promise = @client.make_request_async(:get, path_template, options)
298
+
299
+ promise = promise.then do |result|
300
+ http_response = result.response
301
+ status_code = http_response.status
302
+ response_content = http_response.body
303
+ unless status_code == 200
304
+ error_model = JSON.load(response_content)
305
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
306
+ end
307
+
308
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
309
+ # Deserialize Response
310
+ if status_code == 200
311
+ begin
312
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
313
+ result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::DisasterRecoveryConfiguration.mapper()
314
+ result.body = @client.deserialize(result_mapper, parsed_response)
315
+ rescue Exception => e
316
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
317
+ end
318
+ end
319
+
320
+ result
321
+ end
322
+
323
+ promise.execute
324
+ end
325
+
326
+ #
327
+ # Fails over from the current primary server to this server.
328
+ #
329
+ # @param resource_group_name [String] The name of the resource group that
330
+ # contains the resource. You can obtain this value from the Azure Resource
331
+ # Manager API or the portal.
332
+ # @param server_name [String] The name of the server.
333
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
334
+ # recovery configuration to failover.
335
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
336
+ # will be added to the HTTP request.
337
+ #
338
+ def failover(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
339
+ response = failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
340
+ nil
341
+ end
342
+
343
+ #
344
+ # @param resource_group_name [String] The name of the resource group that
345
+ # contains the resource. You can obtain this value from the Azure Resource
346
+ # Manager API or the portal.
347
+ # @param server_name [String] The name of the server.
348
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
349
+ # recovery configuration to failover.
350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
351
+ # will be added to the HTTP request.
352
+ #
353
+ # @return [Concurrent::Promise] promise which provides async access to http
354
+ # response.
355
+ #
356
+ def failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
357
+ # Send request
358
+ promise = begin_failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers)
359
+
360
+ promise = promise.then do |response|
361
+ # Defining deserialization method.
362
+ deserialize_method = lambda do |parsed_response|
363
+ end
364
+
365
+ # Waiting for response.
366
+ @client.get_long_running_operation_result(response, deserialize_method)
367
+ end
368
+
369
+ promise
370
+ end
371
+
372
+ #
373
+ # Fails over from the current primary server to this server. This operation
374
+ # might result in data loss.
375
+ #
376
+ # @param resource_group_name [String] The name of the resource group that
377
+ # contains the resource. You can obtain this value from the Azure Resource
378
+ # Manager API or the portal.
379
+ # @param server_name [String] The name of the server.
380
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
381
+ # recovery configuration to failover forcefully.
382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
383
+ # will be added to the HTTP request.
384
+ #
385
+ def failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
386
+ response = failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
387
+ nil
388
+ end
389
+
390
+ #
391
+ # @param resource_group_name [String] The name of the resource group that
392
+ # contains the resource. You can obtain this value from the Azure Resource
393
+ # Manager API or the portal.
394
+ # @param server_name [String] The name of the server.
395
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
396
+ # recovery configuration to failover forcefully.
397
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
398
+ # will be added to the HTTP request.
399
+ #
400
+ # @return [Concurrent::Promise] promise which provides async access to http
401
+ # response.
402
+ #
403
+ def failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
404
+ # Send request
405
+ promise = begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers)
406
+
407
+ promise = promise.then do |response|
408
+ # Defining deserialization method.
409
+ deserialize_method = lambda do |parsed_response|
410
+ end
411
+
412
+ # Waiting for response.
413
+ @client.get_long_running_operation_result(response, deserialize_method)
414
+ end
415
+
416
+ promise
417
+ end
418
+
419
+ #
420
+ # Deletes a disaster recovery configuration.
421
+ #
422
+ # @param resource_group_name [String] The name of the resource group that
423
+ # contains the resource. You can obtain this value from the Azure Resource
424
+ # Manager API or the portal.
425
+ # @param server_name [String] The name of the server.
426
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
427
+ # recovery configuration to be deleted.
428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
429
+ # will be added to the HTTP request.
430
+ #
431
+ #
432
+ def begin_delete(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
433
+ response = begin_delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
434
+ nil
435
+ end
436
+
437
+ #
438
+ # Deletes a disaster recovery configuration.
439
+ #
440
+ # @param resource_group_name [String] The name of the resource group that
441
+ # contains the resource. You can obtain this value from the Azure Resource
442
+ # Manager API or the portal.
443
+ # @param server_name [String] The name of the server.
444
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
445
+ # recovery configuration to be deleted.
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
450
+ #
451
+ def begin_delete_with_http_info(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
452
+ begin_delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
453
+ end
454
+
455
+ #
456
+ # Deletes a disaster recovery configuration.
457
+ #
458
+ # @param resource_group_name [String] The name of the resource group that
459
+ # contains the resource. You can obtain this value from the Azure Resource
460
+ # Manager API or the portal.
461
+ # @param server_name [String] The name of the server.
462
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
463
+ # recovery configuration to be deleted.
464
+ # @param [Hash{String => String}] A hash of custom headers that will be added
465
+ # to the HTTP request.
466
+ #
467
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
468
+ #
469
+ def begin_delete_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
470
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
471
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
472
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
473
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
474
+ fail ArgumentError, 'disaster_recovery_configuration_name is nil' if disaster_recovery_configuration_name.nil?
475
+
476
+
477
+ request_headers = {}
478
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
479
+
480
+ # Set Headers
481
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
482
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
483
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}'
484
+
485
+ request_url = @base_url || @client.base_url
486
+
487
+ options = {
488
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
489
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'disasterRecoveryConfigurationName' => disaster_recovery_configuration_name},
490
+ query_params: {'api-version' => @client.api_version},
491
+ headers: request_headers.merge(custom_headers || {}),
492
+ base_url: request_url
493
+ }
494
+ promise = @client.make_request_async(:delete, path_template, options)
495
+
496
+ promise = promise.then do |result|
497
+ http_response = result.response
498
+ status_code = http_response.status
499
+ response_content = http_response.body
500
+ unless status_code == 200 || status_code == 202 || status_code == 204
501
+ error_model = JSON.load(response_content)
502
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
503
+ end
504
+
505
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
506
+
507
+ result
508
+ end
509
+
510
+ promise.execute
511
+ end
512
+
513
+ #
514
+ # Creates or updates a disaster recovery configuration.
515
+ #
516
+ # @param resource_group_name [String] The name of the resource group that
517
+ # contains the resource. You can obtain this value from the Azure Resource
518
+ # Manager API or the portal.
519
+ # @param server_name [String] The name of the server.
520
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
521
+ # recovery configuration to be created/updated.
522
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
523
+ # will be added to the HTTP request.
524
+ #
525
+ # @return [DisasterRecoveryConfiguration] operation results.
526
+ #
527
+ def begin_create_or_update(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
528
+ response = begin_create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
529
+ response.body unless response.nil?
530
+ end
531
+
532
+ #
533
+ # Creates or updates a disaster recovery configuration.
534
+ #
535
+ # @param resource_group_name [String] The name of the resource group that
536
+ # contains the resource. You can obtain this value from the Azure Resource
537
+ # Manager API or the portal.
538
+ # @param server_name [String] The name of the server.
539
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
540
+ # recovery configuration to be created/updated.
541
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
542
+ # will be added to the HTTP request.
543
+ #
544
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
545
+ #
546
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
547
+ begin_create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
548
+ end
549
+
550
+ #
551
+ # Creates or updates a disaster recovery configuration.
552
+ #
553
+ # @param resource_group_name [String] The name of the resource group that
554
+ # contains the resource. You can obtain this value from the Azure Resource
555
+ # Manager API or the portal.
556
+ # @param server_name [String] The name of the server.
557
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
558
+ # recovery configuration to be created/updated.
559
+ # @param [Hash{String => String}] A hash of custom headers that will be added
560
+ # to the HTTP request.
561
+ #
562
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
563
+ #
564
+ def begin_create_or_update_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
565
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
566
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
567
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
568
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
569
+ fail ArgumentError, 'disaster_recovery_configuration_name is nil' if disaster_recovery_configuration_name.nil?
570
+
571
+
572
+ request_headers = {}
573
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
574
+
575
+ # Set Headers
576
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
577
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
578
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}'
579
+
580
+ request_url = @base_url || @client.base_url
581
+
582
+ options = {
583
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
584
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'disasterRecoveryConfigurationName' => disaster_recovery_configuration_name},
585
+ query_params: {'api-version' => @client.api_version},
586
+ headers: request_headers.merge(custom_headers || {}),
587
+ base_url: request_url
588
+ }
589
+ promise = @client.make_request_async(:put, path_template, options)
590
+
591
+ promise = promise.then do |result|
592
+ http_response = result.response
593
+ status_code = http_response.status
594
+ response_content = http_response.body
595
+ unless status_code == 202 || status_code == 201 || status_code == 200
596
+ error_model = JSON.load(response_content)
597
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
598
+ end
599
+
600
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
601
+ # Deserialize Response
602
+ if status_code == 202
603
+ begin
604
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
605
+ result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::DisasterRecoveryConfiguration.mapper()
606
+ result.body = @client.deserialize(result_mapper, parsed_response)
607
+ rescue Exception => e
608
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
609
+ end
610
+ end
611
+ # Deserialize Response
612
+ if status_code == 201
613
+ begin
614
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
615
+ result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::DisasterRecoveryConfiguration.mapper()
616
+ result.body = @client.deserialize(result_mapper, parsed_response)
617
+ rescue Exception => e
618
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
619
+ end
620
+ end
621
+ # Deserialize Response
622
+ if status_code == 200
623
+ begin
624
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
625
+ result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::DisasterRecoveryConfiguration.mapper()
626
+ result.body = @client.deserialize(result_mapper, parsed_response)
627
+ rescue Exception => e
628
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
629
+ end
630
+ end
631
+
632
+ result
633
+ end
634
+
635
+ promise.execute
636
+ end
637
+
638
+ #
639
+ # Fails over from the current primary server to this server.
640
+ #
641
+ # @param resource_group_name [String] The name of the resource group that
642
+ # contains the resource. You can obtain this value from the Azure Resource
643
+ # Manager API or the portal.
644
+ # @param server_name [String] The name of the server.
645
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
646
+ # recovery configuration to failover.
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ #
651
+ def begin_failover(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
652
+ response = begin_failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
653
+ nil
654
+ end
655
+
656
+ #
657
+ # Fails over from the current primary server to this server.
658
+ #
659
+ # @param resource_group_name [String] The name of the resource group that
660
+ # contains the resource. You can obtain this value from the Azure Resource
661
+ # Manager API or the portal.
662
+ # @param server_name [String] The name of the server.
663
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
664
+ # recovery configuration to failover.
665
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
666
+ # will be added to the HTTP request.
667
+ #
668
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
669
+ #
670
+ def begin_failover_with_http_info(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
671
+ begin_failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
672
+ end
673
+
674
+ #
675
+ # Fails over from the current primary server to this server.
676
+ #
677
+ # @param resource_group_name [String] The name of the resource group that
678
+ # contains the resource. You can obtain this value from the Azure Resource
679
+ # Manager API or the portal.
680
+ # @param server_name [String] The name of the server.
681
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
682
+ # recovery configuration to failover.
683
+ # @param [Hash{String => String}] A hash of custom headers that will be added
684
+ # to the HTTP request.
685
+ #
686
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
687
+ #
688
+ def begin_failover_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
689
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
690
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
691
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
692
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
693
+ fail ArgumentError, 'disaster_recovery_configuration_name is nil' if disaster_recovery_configuration_name.nil?
694
+
695
+
696
+ request_headers = {}
697
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
698
+
699
+ # Set Headers
700
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
701
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
702
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/failover'
703
+
704
+ request_url = @base_url || @client.base_url
705
+
706
+ options = {
707
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
708
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'disasterRecoveryConfigurationName' => disaster_recovery_configuration_name},
709
+ query_params: {'api-version' => @client.api_version},
710
+ headers: request_headers.merge(custom_headers || {}),
711
+ base_url: request_url
712
+ }
713
+ promise = @client.make_request_async(:post, path_template, options)
714
+
715
+ promise = promise.then do |result|
716
+ http_response = result.response
717
+ status_code = http_response.status
718
+ response_content = http_response.body
719
+ unless status_code == 204 || status_code == 202
720
+ error_model = JSON.load(response_content)
721
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
722
+ end
723
+
724
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
725
+
726
+ result
727
+ end
728
+
729
+ promise.execute
730
+ end
731
+
732
+ #
733
+ # Fails over from the current primary server to this server. This operation
734
+ # might result in data loss.
735
+ #
736
+ # @param resource_group_name [String] The name of the resource group that
737
+ # contains the resource. You can obtain this value from the Azure Resource
738
+ # Manager API or the portal.
739
+ # @param server_name [String] The name of the server.
740
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
741
+ # recovery configuration to failover forcefully.
742
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
743
+ # will be added to the HTTP request.
744
+ #
745
+ #
746
+ def begin_failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
747
+ response = begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
748
+ nil
749
+ end
750
+
751
+ #
752
+ # Fails over from the current primary server to this server. This operation
753
+ # might result in data loss.
754
+ #
755
+ # @param resource_group_name [String] The name of the resource group that
756
+ # contains the resource. You can obtain this value from the Azure Resource
757
+ # Manager API or the portal.
758
+ # @param server_name [String] The name of the server.
759
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
760
+ # recovery configuration to failover forcefully.
761
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
762
+ # will be added to the HTTP request.
763
+ #
764
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
765
+ #
766
+ def begin_failover_allow_data_loss_with_http_info(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
767
+ begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
768
+ end
769
+
770
+ #
771
+ # Fails over from the current primary server to this server. This operation
772
+ # might result in data loss.
773
+ #
774
+ # @param resource_group_name [String] The name of the resource group that
775
+ # contains the resource. You can obtain this value from the Azure Resource
776
+ # Manager API or the portal.
777
+ # @param server_name [String] The name of the server.
778
+ # @param disaster_recovery_configuration_name [String] The name of the disaster
779
+ # recovery configuration to failover forcefully.
780
+ # @param [Hash{String => String}] A hash of custom headers that will be added
781
+ # to the HTTP request.
782
+ #
783
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
784
+ #
785
+ def begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
786
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
787
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
788
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
789
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
790
+ fail ArgumentError, 'disaster_recovery_configuration_name is nil' if disaster_recovery_configuration_name.nil?
791
+
792
+
793
+ request_headers = {}
794
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
795
+
796
+ # Set Headers
797
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
798
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
799
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/forceFailoverAllowDataLoss'
800
+
801
+ request_url = @base_url || @client.base_url
802
+
803
+ options = {
804
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
805
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'disasterRecoveryConfigurationName' => disaster_recovery_configuration_name},
806
+ query_params: {'api-version' => @client.api_version},
807
+ headers: request_headers.merge(custom_headers || {}),
808
+ base_url: request_url
809
+ }
810
+ promise = @client.make_request_async(:post, 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 == 204 || status_code == 202
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
+
823
+ result
824
+ end
825
+
826
+ promise.execute
827
+ end
828
+
829
+ end
830
+ end