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,1863 @@
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 SyncGroups
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the SyncGroups 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 collection of sync database ids.
29
+ #
30
+ # @param location_name [String] The name of the region where the resource is
31
+ # located.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<SyncDatabaseIdProperties>] operation results.
36
+ #
37
+ def list_sync_database_ids(location_name, custom_headers = nil)
38
+ first_page = list_sync_database_ids_as_lazy(location_name, custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Gets a collection of sync database ids.
44
+ #
45
+ # @param location_name [String] The name of the region where the resource is
46
+ # located.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def list_sync_database_ids_with_http_info(location_name, custom_headers = nil)
53
+ list_sync_database_ids_async(location_name, custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Gets a collection of sync database ids.
58
+ #
59
+ # @param location_name [String] The name of the region where the resource is
60
+ # located.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_sync_database_ids_async(location_name, custom_headers = nil)
67
+ fail ArgumentError, 'location_name is nil' if location_name.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ api_version = '2015-05-01-preview'
70
+
71
+
72
+ request_headers = {}
73
+
74
+ # Set Headers
75
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
76
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
77
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds'
78
+
79
+ request_url = @base_url || @client.base_url
80
+
81
+ options = {
82
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
83
+ path_params: {'locationName' => location_name,'subscriptionId' => @client.subscription_id},
84
+ query_params: {'api-version' => api_version},
85
+ headers: request_headers.merge(custom_headers || {}),
86
+ base_url: request_url
87
+ }
88
+ promise = @client.make_request_async(:get, path_template, options)
89
+
90
+ promise = promise.then do |result|
91
+ http_response = result.response
92
+ status_code = http_response.status
93
+ response_content = http_response.body
94
+ unless status_code == 200
95
+ error_model = JSON.load(response_content)
96
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
97
+ end
98
+
99
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
100
+ # Deserialize Response
101
+ if status_code == 200
102
+ begin
103
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
104
+ result_mapper = Azure::ARM::SQL::Models::SyncDatabaseIdListResult.mapper()
105
+ result.body = @client.deserialize(result_mapper, parsed_response)
106
+ rescue Exception => e
107
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
108
+ end
109
+ end
110
+
111
+ result
112
+ end
113
+
114
+ promise.execute
115
+ end
116
+
117
+ #
118
+ # Refreshes a hub database schema.
119
+ #
120
+ # @param resource_group_name [String] The name of the resource group that
121
+ # contains the resource. You can obtain this value from the Azure Resource
122
+ # Manager API or the portal.
123
+ # @param server_name [String] The name of the server.
124
+ # @param database_name [String] The name of the database on which the sync
125
+ # group is hosted.
126
+ # @param sync_group_name [String] The name of the sync group.
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ def refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
131
+ response = refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
132
+ nil
133
+ end
134
+
135
+ #
136
+ # @param resource_group_name [String] The name of the resource group that
137
+ # contains the resource. You can obtain this value from the Azure Resource
138
+ # Manager API or the portal.
139
+ # @param server_name [String] The name of the server.
140
+ # @param database_name [String] The name of the database on which the sync
141
+ # group is hosted.
142
+ # @param sync_group_name [String] The name of the sync group.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [Concurrent::Promise] promise which provides async access to http
147
+ # response.
148
+ #
149
+ def refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
150
+ # Send request
151
+ promise = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers)
152
+
153
+ promise = promise.then do |response|
154
+ # Defining deserialization method.
155
+ deserialize_method = lambda do |parsed_response|
156
+ end
157
+
158
+ # Waiting for response.
159
+ @client.get_long_running_operation_result(response, deserialize_method)
160
+ end
161
+
162
+ promise
163
+ end
164
+
165
+ #
166
+ # Gets a collection of hub database schemas.
167
+ #
168
+ # @param resource_group_name [String] The name of the resource group that
169
+ # contains the resource. You can obtain this value from the Azure Resource
170
+ # Manager API or the portal.
171
+ # @param server_name [String] The name of the server.
172
+ # @param database_name [String] The name of the database on which the sync
173
+ # group is hosted.
174
+ # @param sync_group_name [String] The name of the sync group.
175
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
176
+ # will be added to the HTTP request.
177
+ #
178
+ # @return [Array<SyncFullSchemaProperties>] operation results.
179
+ #
180
+ def list_hub_schemas(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
181
+ first_page = list_hub_schemas_as_lazy(resource_group_name, server_name, database_name, sync_group_name, custom_headers)
182
+ first_page.get_all_items
183
+ end
184
+
185
+ #
186
+ # Gets a collection of hub database schemas.
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group that
189
+ # contains the resource. You can obtain this value from the Azure Resource
190
+ # Manager API or the portal.
191
+ # @param server_name [String] The name of the server.
192
+ # @param database_name [String] The name of the database on which the sync
193
+ # group is hosted.
194
+ # @param sync_group_name [String] The name of the sync group.
195
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
196
+ # will be added to the HTTP request.
197
+ #
198
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
199
+ #
200
+ def list_hub_schemas_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
201
+ list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
202
+ end
203
+
204
+ #
205
+ # Gets a collection of hub database schemas.
206
+ #
207
+ # @param resource_group_name [String] The name of the resource group that
208
+ # contains the resource. You can obtain this value from the Azure Resource
209
+ # Manager API or the portal.
210
+ # @param server_name [String] The name of the server.
211
+ # @param database_name [String] The name of the database on which the sync
212
+ # group is hosted.
213
+ # @param sync_group_name [String] The name of the sync group.
214
+ # @param [Hash{String => String}] A hash of custom headers that will be added
215
+ # to the HTTP request.
216
+ #
217
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
218
+ #
219
+ def list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
220
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
221
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
222
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
223
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
224
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
225
+ api_version = '2015-05-01-preview'
226
+
227
+
228
+ request_headers = {}
229
+
230
+ # Set Headers
231
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
232
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
233
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas'
234
+
235
+ request_url = @base_url || @client.base_url
236
+
237
+ options = {
238
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
239
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
240
+ query_params: {'api-version' => api_version},
241
+ headers: request_headers.merge(custom_headers || {}),
242
+ base_url: request_url
243
+ }
244
+ promise = @client.make_request_async(:get, path_template, options)
245
+
246
+ promise = promise.then do |result|
247
+ http_response = result.response
248
+ status_code = http_response.status
249
+ response_content = http_response.body
250
+ unless status_code == 200
251
+ error_model = JSON.load(response_content)
252
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
253
+ end
254
+
255
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
256
+ # Deserialize Response
257
+ if status_code == 200
258
+ begin
259
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
260
+ result_mapper = Azure::ARM::SQL::Models::SyncFullSchemaPropertiesListResult.mapper()
261
+ result.body = @client.deserialize(result_mapper, parsed_response)
262
+ rescue Exception => e
263
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
264
+ end
265
+ end
266
+
267
+ result
268
+ end
269
+
270
+ promise.execute
271
+ end
272
+
273
+ #
274
+ # Gets a collection of sync group logs.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group that
277
+ # contains the resource. You can obtain this value from the Azure Resource
278
+ # Manager API or the portal.
279
+ # @param server_name [String] The name of the server.
280
+ # @param database_name [String] The name of the database on which the sync
281
+ # group is hosted.
282
+ # @param sync_group_name [String] The name of the sync group.
283
+ # @param start_time [String] Get logs generated after this time.
284
+ # @param end_time [String] Get logs generated before this time.
285
+ # @param type [Enum] The types of logs to retrieve. Possible values include:
286
+ # 'All', 'Error', 'Warning', 'Success'
287
+ # @param continuation_token [String] The continuation token for this operation.
288
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
289
+ # will be added to the HTTP request.
290
+ #
291
+ # @return [Array<SyncGroupLogProperties>] operation results.
292
+ #
293
+ def list_logs(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token = nil, custom_headers = nil)
294
+ first_page = list_logs_as_lazy(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token, custom_headers)
295
+ first_page.get_all_items
296
+ end
297
+
298
+ #
299
+ # Gets a collection of sync group logs.
300
+ #
301
+ # @param resource_group_name [String] The name of the resource group that
302
+ # contains the resource. You can obtain this value from the Azure Resource
303
+ # Manager API or the portal.
304
+ # @param server_name [String] The name of the server.
305
+ # @param database_name [String] The name of the database on which the sync
306
+ # group is hosted.
307
+ # @param sync_group_name [String] The name of the sync group.
308
+ # @param start_time [String] Get logs generated after this time.
309
+ # @param end_time [String] Get logs generated before this time.
310
+ # @param type [Enum] The types of logs to retrieve. Possible values include:
311
+ # 'All', 'Error', 'Warning', 'Success'
312
+ # @param continuation_token [String] The continuation token for this operation.
313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
314
+ # will be added to the HTTP request.
315
+ #
316
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
317
+ #
318
+ def list_logs_with_http_info(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token = nil, custom_headers = nil)
319
+ list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token, custom_headers).value!
320
+ end
321
+
322
+ #
323
+ # Gets a collection of sync group logs.
324
+ #
325
+ # @param resource_group_name [String] The name of the resource group that
326
+ # contains the resource. You can obtain this value from the Azure Resource
327
+ # Manager API or the portal.
328
+ # @param server_name [String] The name of the server.
329
+ # @param database_name [String] The name of the database on which the sync
330
+ # group is hosted.
331
+ # @param sync_group_name [String] The name of the sync group.
332
+ # @param start_time [String] Get logs generated after this time.
333
+ # @param end_time [String] Get logs generated before this time.
334
+ # @param type [Enum] The types of logs to retrieve. Possible values include:
335
+ # 'All', 'Error', 'Warning', 'Success'
336
+ # @param continuation_token [String] The continuation token for this operation.
337
+ # @param [Hash{String => String}] A hash of custom headers that will be added
338
+ # to the HTTP request.
339
+ #
340
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
341
+ #
342
+ def list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token = nil, custom_headers = nil)
343
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
344
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
345
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
346
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
347
+ fail ArgumentError, 'start_time is nil' if start_time.nil?
348
+ fail ArgumentError, 'end_time is nil' if end_time.nil?
349
+ fail ArgumentError, 'type is nil' if type.nil?
350
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
351
+ api_version = '2015-05-01-preview'
352
+
353
+
354
+ request_headers = {}
355
+
356
+ # Set Headers
357
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
358
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
359
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs'
360
+
361
+ request_url = @base_url || @client.base_url
362
+
363
+ options = {
364
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
365
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
366
+ query_params: {'startTime' => start_time,'endTime' => end_time,'type' => type,'continuationToken' => continuation_token,'api-version' => api_version},
367
+ headers: request_headers.merge(custom_headers || {}),
368
+ base_url: request_url
369
+ }
370
+ promise = @client.make_request_async(:get, path_template, options)
371
+
372
+ promise = promise.then do |result|
373
+ http_response = result.response
374
+ status_code = http_response.status
375
+ response_content = http_response.body
376
+ unless status_code == 200
377
+ error_model = JSON.load(response_content)
378
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
379
+ end
380
+
381
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
382
+ # Deserialize Response
383
+ if status_code == 200
384
+ begin
385
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
386
+ result_mapper = Azure::ARM::SQL::Models::SyncGroupLogListResult.mapper()
387
+ result.body = @client.deserialize(result_mapper, parsed_response)
388
+ rescue Exception => e
389
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
390
+ end
391
+ end
392
+
393
+ result
394
+ end
395
+
396
+ promise.execute
397
+ end
398
+
399
+ #
400
+ # Cancels a sync group synchronization.
401
+ #
402
+ # @param resource_group_name [String] The name of the resource group that
403
+ # contains the resource. You can obtain this value from the Azure Resource
404
+ # Manager API or the portal.
405
+ # @param server_name [String] The name of the server.
406
+ # @param database_name [String] The name of the database on which the sync
407
+ # group is hosted.
408
+ # @param sync_group_name [String] The name of the sync group.
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ #
413
+ def cancel_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
414
+ response = cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
415
+ nil
416
+ end
417
+
418
+ #
419
+ # Cancels a sync group synchronization.
420
+ #
421
+ # @param resource_group_name [String] The name of the resource group that
422
+ # contains the resource. You can obtain this value from the Azure Resource
423
+ # Manager API or the portal.
424
+ # @param server_name [String] The name of the server.
425
+ # @param database_name [String] The name of the database on which the sync
426
+ # group is hosted.
427
+ # @param sync_group_name [String] The name of the sync group.
428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
429
+ # will be added to the HTTP request.
430
+ #
431
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
432
+ #
433
+ def cancel_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
434
+ cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
435
+ end
436
+
437
+ #
438
+ # Cancels a sync group synchronization.
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 database_name [String] The name of the database on which the sync
445
+ # group is hosted.
446
+ # @param sync_group_name [String] The name of the sync group.
447
+ # @param [Hash{String => String}] A hash of custom headers that will be added
448
+ # to the HTTP request.
449
+ #
450
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
451
+ #
452
+ def cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
453
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
454
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
455
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
456
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
457
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
458
+ api_version = '2015-05-01-preview'
459
+
460
+
461
+ request_headers = {}
462
+
463
+ # Set Headers
464
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
465
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
466
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync'
467
+
468
+ request_url = @base_url || @client.base_url
469
+
470
+ options = {
471
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
472
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
473
+ query_params: {'api-version' => api_version},
474
+ headers: request_headers.merge(custom_headers || {}),
475
+ base_url: request_url
476
+ }
477
+ promise = @client.make_request_async(:post, path_template, options)
478
+
479
+ promise = promise.then do |result|
480
+ http_response = result.response
481
+ status_code = http_response.status
482
+ response_content = http_response.body
483
+ unless status_code == 200
484
+ error_model = JSON.load(response_content)
485
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
486
+ end
487
+
488
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
489
+
490
+ result
491
+ end
492
+
493
+ promise.execute
494
+ end
495
+
496
+ #
497
+ # Triggers a sync group synchronization.
498
+ #
499
+ # @param resource_group_name [String] The name of the resource group that
500
+ # contains the resource. You can obtain this value from the Azure Resource
501
+ # Manager API or the portal.
502
+ # @param server_name [String] The name of the server.
503
+ # @param database_name [String] The name of the database on which the sync
504
+ # group is hosted.
505
+ # @param sync_group_name [String] The name of the sync group.
506
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
507
+ # will be added to the HTTP request.
508
+ #
509
+ #
510
+ def trigger_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
511
+ response = trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
512
+ nil
513
+ end
514
+
515
+ #
516
+ # Triggers a sync group synchronization.
517
+ #
518
+ # @param resource_group_name [String] The name of the resource group that
519
+ # contains the resource. You can obtain this value from the Azure Resource
520
+ # Manager API or the portal.
521
+ # @param server_name [String] The name of the server.
522
+ # @param database_name [String] The name of the database on which the sync
523
+ # group is hosted.
524
+ # @param sync_group_name [String] The name of the sync group.
525
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
526
+ # will be added to the HTTP request.
527
+ #
528
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
529
+ #
530
+ def trigger_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
531
+ trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
532
+ end
533
+
534
+ #
535
+ # Triggers a sync group synchronization.
536
+ #
537
+ # @param resource_group_name [String] The name of the resource group that
538
+ # contains the resource. You can obtain this value from the Azure Resource
539
+ # Manager API or the portal.
540
+ # @param server_name [String] The name of the server.
541
+ # @param database_name [String] The name of the database on which the sync
542
+ # group is hosted.
543
+ # @param sync_group_name [String] The name of the sync group.
544
+ # @param [Hash{String => String}] A hash of custom headers that will be added
545
+ # to the HTTP request.
546
+ #
547
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
548
+ #
549
+ def trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
550
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
551
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
552
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
553
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
554
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
555
+ api_version = '2015-05-01-preview'
556
+
557
+
558
+ request_headers = {}
559
+
560
+ # Set Headers
561
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
562
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
563
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync'
564
+
565
+ request_url = @base_url || @client.base_url
566
+
567
+ options = {
568
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
569
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
570
+ query_params: {'api-version' => api_version},
571
+ headers: request_headers.merge(custom_headers || {}),
572
+ base_url: request_url
573
+ }
574
+ promise = @client.make_request_async(:post, path_template, options)
575
+
576
+ promise = promise.then do |result|
577
+ http_response = result.response
578
+ status_code = http_response.status
579
+ response_content = http_response.body
580
+ unless status_code == 200
581
+ error_model = JSON.load(response_content)
582
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
583
+ end
584
+
585
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
586
+
587
+ result
588
+ end
589
+
590
+ promise.execute
591
+ end
592
+
593
+ #
594
+ # Gets a sync group.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group that
597
+ # contains the resource. You can obtain this value from the Azure Resource
598
+ # Manager API or the portal.
599
+ # @param server_name [String] The name of the server.
600
+ # @param database_name [String] The name of the database on which the sync
601
+ # group is hosted.
602
+ # @param sync_group_name [String] The name of the sync group.
603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
604
+ # will be added to the HTTP request.
605
+ #
606
+ # @return [SyncGroup] operation results.
607
+ #
608
+ def get(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
609
+ response = get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
610
+ response.body unless response.nil?
611
+ end
612
+
613
+ #
614
+ # Gets a sync group.
615
+ #
616
+ # @param resource_group_name [String] The name of the resource group that
617
+ # contains the resource. You can obtain this value from the Azure Resource
618
+ # Manager API or the portal.
619
+ # @param server_name [String] The name of the server.
620
+ # @param database_name [String] The name of the database on which the sync
621
+ # group is hosted.
622
+ # @param sync_group_name [String] The name of the sync group.
623
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
624
+ # will be added to the HTTP request.
625
+ #
626
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
627
+ #
628
+ def get_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
629
+ get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
630
+ end
631
+
632
+ #
633
+ # Gets a sync group.
634
+ #
635
+ # @param resource_group_name [String] The name of the resource group that
636
+ # contains the resource. You can obtain this value from the Azure Resource
637
+ # Manager API or the portal.
638
+ # @param server_name [String] The name of the server.
639
+ # @param database_name [String] The name of the database on which the sync
640
+ # group is hosted.
641
+ # @param sync_group_name [String] The name of the sync group.
642
+ # @param [Hash{String => String}] A hash of custom headers that will be added
643
+ # to the HTTP request.
644
+ #
645
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
646
+ #
647
+ def get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
648
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
649
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
650
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
651
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
652
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
653
+ api_version = '2015-05-01-preview'
654
+
655
+
656
+ request_headers = {}
657
+
658
+ # Set Headers
659
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
660
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
661
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'
662
+
663
+ request_url = @base_url || @client.base_url
664
+
665
+ options = {
666
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
667
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
668
+ query_params: {'api-version' => api_version},
669
+ headers: request_headers.merge(custom_headers || {}),
670
+ base_url: request_url
671
+ }
672
+ promise = @client.make_request_async(:get, path_template, options)
673
+
674
+ promise = promise.then do |result|
675
+ http_response = result.response
676
+ status_code = http_response.status
677
+ response_content = http_response.body
678
+ unless status_code == 200
679
+ error_model = JSON.load(response_content)
680
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
681
+ end
682
+
683
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
684
+ # Deserialize Response
685
+ if status_code == 200
686
+ begin
687
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
688
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
689
+ result.body = @client.deserialize(result_mapper, parsed_response)
690
+ rescue Exception => e
691
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
692
+ end
693
+ end
694
+
695
+ result
696
+ end
697
+
698
+ promise.execute
699
+ end
700
+
701
+ #
702
+ # Creates or updates a sync group.
703
+ #
704
+ # @param resource_group_name [String] The name of the resource group that
705
+ # contains the resource. You can obtain this value from the Azure Resource
706
+ # Manager API or the portal.
707
+ # @param server_name [String] The name of the server.
708
+ # @param database_name [String] The name of the database on which the sync
709
+ # group is hosted.
710
+ # @param sync_group_name [String] The name of the sync group.
711
+ # @param parameters [SyncGroup] The requested sync group resource state.
712
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
713
+ # will be added to the HTTP request.
714
+ #
715
+ # @return [SyncGroup] operation results.
716
+ #
717
+ def create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
718
+ response = create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
719
+ response.body unless response.nil?
720
+ end
721
+
722
+ #
723
+ # @param resource_group_name [String] The name of the resource group that
724
+ # contains the resource. You can obtain this value from the Azure Resource
725
+ # Manager API or the portal.
726
+ # @param server_name [String] The name of the server.
727
+ # @param database_name [String] The name of the database on which the sync
728
+ # group is hosted.
729
+ # @param sync_group_name [String] The name of the sync group.
730
+ # @param parameters [SyncGroup] The requested sync group resource state.
731
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
732
+ # will be added to the HTTP request.
733
+ #
734
+ # @return [Concurrent::Promise] promise which provides async access to http
735
+ # response.
736
+ #
737
+ def create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
738
+ # Send request
739
+ promise = begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers)
740
+
741
+ promise = promise.then do |response|
742
+ # Defining deserialization method.
743
+ deserialize_method = lambda do |parsed_response|
744
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
745
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
746
+ end
747
+
748
+ # Waiting for response.
749
+ @client.get_long_running_operation_result(response, deserialize_method)
750
+ end
751
+
752
+ promise
753
+ end
754
+
755
+ #
756
+ # Deletes a sync group.
757
+ #
758
+ # @param resource_group_name [String] The name of the resource group that
759
+ # contains the resource. You can obtain this value from the Azure Resource
760
+ # Manager API or the portal.
761
+ # @param server_name [String] The name of the server.
762
+ # @param database_name [String] The name of the database on which the sync
763
+ # group is hosted.
764
+ # @param sync_group_name [String] The name of the sync group.
765
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
766
+ # will be added to the HTTP request.
767
+ #
768
+ def delete(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
769
+ response = delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
770
+ nil
771
+ end
772
+
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 database_name [String] The name of the database on which the sync
779
+ # group is hosted.
780
+ # @param sync_group_name [String] The name of the sync group.
781
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
782
+ # will be added to the HTTP request.
783
+ #
784
+ # @return [Concurrent::Promise] promise which provides async access to http
785
+ # response.
786
+ #
787
+ def delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
788
+ # Send request
789
+ promise = begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers)
790
+
791
+ promise = promise.then do |response|
792
+ # Defining deserialization method.
793
+ deserialize_method = lambda do |parsed_response|
794
+ end
795
+
796
+ # Waiting for response.
797
+ @client.get_long_running_operation_result(response, deserialize_method)
798
+ end
799
+
800
+ promise
801
+ end
802
+
803
+ #
804
+ # Updates a sync group.
805
+ #
806
+ # @param resource_group_name [String] The name of the resource group that
807
+ # contains the resource. You can obtain this value from the Azure Resource
808
+ # Manager API or the portal.
809
+ # @param server_name [String] The name of the server.
810
+ # @param database_name [String] The name of the database on which the sync
811
+ # group is hosted.
812
+ # @param sync_group_name [String] The name of the sync group.
813
+ # @param parameters [SyncGroup] The requested sync group resource state.
814
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
815
+ # will be added to the HTTP request.
816
+ #
817
+ # @return [SyncGroup] operation results.
818
+ #
819
+ def update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
820
+ response = update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
821
+ response.body unless response.nil?
822
+ end
823
+
824
+ #
825
+ # @param resource_group_name [String] The name of the resource group that
826
+ # contains the resource. You can obtain this value from the Azure Resource
827
+ # Manager API or the portal.
828
+ # @param server_name [String] The name of the server.
829
+ # @param database_name [String] The name of the database on which the sync
830
+ # group is hosted.
831
+ # @param sync_group_name [String] The name of the sync group.
832
+ # @param parameters [SyncGroup] The requested sync group resource state.
833
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
834
+ # will be added to the HTTP request.
835
+ #
836
+ # @return [Concurrent::Promise] promise which provides async access to http
837
+ # response.
838
+ #
839
+ def update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
840
+ # Send request
841
+ promise = begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers)
842
+
843
+ promise = promise.then do |response|
844
+ # Defining deserialization method.
845
+ deserialize_method = lambda do |parsed_response|
846
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
847
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
848
+ end
849
+
850
+ # Waiting for response.
851
+ @client.get_long_running_operation_result(response, deserialize_method)
852
+ end
853
+
854
+ promise
855
+ end
856
+
857
+ #
858
+ # Lists sync groups under a hub database.
859
+ #
860
+ # @param resource_group_name [String] The name of the resource group that
861
+ # contains the resource. You can obtain this value from the Azure Resource
862
+ # Manager API or the portal.
863
+ # @param server_name [String] The name of the server.
864
+ # @param database_name [String] The name of the database on which the sync
865
+ # group is hosted.
866
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
867
+ # will be added to the HTTP request.
868
+ #
869
+ # @return [Array<SyncGroup>] operation results.
870
+ #
871
+ def list_by_database(resource_group_name, server_name, database_name, custom_headers = nil)
872
+ first_page = list_by_database_as_lazy(resource_group_name, server_name, database_name, custom_headers)
873
+ first_page.get_all_items
874
+ end
875
+
876
+ #
877
+ # Lists sync groups under a hub database.
878
+ #
879
+ # @param resource_group_name [String] The name of the resource group that
880
+ # contains the resource. You can obtain this value from the Azure Resource
881
+ # Manager API or the portal.
882
+ # @param server_name [String] The name of the server.
883
+ # @param database_name [String] The name of the database on which the sync
884
+ # group is hosted.
885
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
886
+ # will be added to the HTTP request.
887
+ #
888
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
889
+ #
890
+ def list_by_database_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
891
+ list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
892
+ end
893
+
894
+ #
895
+ # Lists sync groups under a hub database.
896
+ #
897
+ # @param resource_group_name [String] The name of the resource group that
898
+ # contains the resource. You can obtain this value from the Azure Resource
899
+ # Manager API or the portal.
900
+ # @param server_name [String] The name of the server.
901
+ # @param database_name [String] The name of the database on which the sync
902
+ # group is hosted.
903
+ # @param [Hash{String => String}] A hash of custom headers that will be added
904
+ # to the HTTP request.
905
+ #
906
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
907
+ #
908
+ def list_by_database_async(resource_group_name, server_name, database_name, custom_headers = nil)
909
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
910
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
911
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
912
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
913
+ api_version = '2015-05-01-preview'
914
+
915
+
916
+ request_headers = {}
917
+
918
+ # Set Headers
919
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
920
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
921
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups'
922
+
923
+ request_url = @base_url || @client.base_url
924
+
925
+ options = {
926
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
927
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id},
928
+ query_params: {'api-version' => api_version},
929
+ headers: request_headers.merge(custom_headers || {}),
930
+ base_url: request_url
931
+ }
932
+ promise = @client.make_request_async(:get, path_template, options)
933
+
934
+ promise = promise.then do |result|
935
+ http_response = result.response
936
+ status_code = http_response.status
937
+ response_content = http_response.body
938
+ unless status_code == 200
939
+ error_model = JSON.load(response_content)
940
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
941
+ end
942
+
943
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
944
+ # Deserialize Response
945
+ if status_code == 200
946
+ begin
947
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
948
+ result_mapper = Azure::ARM::SQL::Models::SyncGroupListResult.mapper()
949
+ result.body = @client.deserialize(result_mapper, parsed_response)
950
+ rescue Exception => e
951
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
952
+ end
953
+ end
954
+
955
+ result
956
+ end
957
+
958
+ promise.execute
959
+ end
960
+
961
+ #
962
+ # Refreshes a hub database schema.
963
+ #
964
+ # @param resource_group_name [String] The name of the resource group that
965
+ # contains the resource. You can obtain this value from the Azure Resource
966
+ # Manager API or the portal.
967
+ # @param server_name [String] The name of the server.
968
+ # @param database_name [String] The name of the database on which the sync
969
+ # group is hosted.
970
+ # @param sync_group_name [String] The name of the sync group.
971
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
972
+ # will be added to the HTTP request.
973
+ #
974
+ #
975
+ def begin_refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
976
+ response = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
977
+ nil
978
+ end
979
+
980
+ #
981
+ # Refreshes a hub database schema.
982
+ #
983
+ # @param resource_group_name [String] The name of the resource group that
984
+ # contains the resource. You can obtain this value from the Azure Resource
985
+ # Manager API or the portal.
986
+ # @param server_name [String] The name of the server.
987
+ # @param database_name [String] The name of the database on which the sync
988
+ # group is hosted.
989
+ # @param sync_group_name [String] The name of the sync group.
990
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
991
+ # will be added to the HTTP request.
992
+ #
993
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
994
+ #
995
+ def begin_refresh_hub_schema_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
996
+ begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
997
+ end
998
+
999
+ #
1000
+ # Refreshes a hub database schema.
1001
+ #
1002
+ # @param resource_group_name [String] The name of the resource group that
1003
+ # contains the resource. You can obtain this value from the Azure Resource
1004
+ # Manager API or the portal.
1005
+ # @param server_name [String] The name of the server.
1006
+ # @param database_name [String] The name of the database on which the sync
1007
+ # group is hosted.
1008
+ # @param sync_group_name [String] The name of the sync group.
1009
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1010
+ # to the HTTP request.
1011
+ #
1012
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1013
+ #
1014
+ def begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
1015
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1016
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1017
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1018
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
1019
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1020
+ api_version = '2015-05-01-preview'
1021
+
1022
+
1023
+ request_headers = {}
1024
+
1025
+ # Set Headers
1026
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1027
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1028
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema'
1029
+
1030
+ request_url = @base_url || @client.base_url
1031
+
1032
+ options = {
1033
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1034
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
1035
+ query_params: {'api-version' => api_version},
1036
+ headers: request_headers.merge(custom_headers || {}),
1037
+ base_url: request_url
1038
+ }
1039
+ promise = @client.make_request_async(:post, path_template, options)
1040
+
1041
+ promise = promise.then do |result|
1042
+ http_response = result.response
1043
+ status_code = http_response.status
1044
+ response_content = http_response.body
1045
+ unless status_code == 200 || status_code == 202
1046
+ error_model = JSON.load(response_content)
1047
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1048
+ end
1049
+
1050
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1051
+
1052
+ result
1053
+ end
1054
+
1055
+ promise.execute
1056
+ end
1057
+
1058
+ #
1059
+ # Creates or updates a sync group.
1060
+ #
1061
+ # @param resource_group_name [String] The name of the resource group that
1062
+ # contains the resource. You can obtain this value from the Azure Resource
1063
+ # Manager API or the portal.
1064
+ # @param server_name [String] The name of the server.
1065
+ # @param database_name [String] The name of the database on which the sync
1066
+ # group is hosted.
1067
+ # @param sync_group_name [String] The name of the sync group.
1068
+ # @param parameters [SyncGroup] The requested sync group resource state.
1069
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1070
+ # will be added to the HTTP request.
1071
+ #
1072
+ # @return [SyncGroup] operation results.
1073
+ #
1074
+ def begin_create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1075
+ response = begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
1076
+ response.body unless response.nil?
1077
+ end
1078
+
1079
+ #
1080
+ # Creates or updates a sync group.
1081
+ #
1082
+ # @param resource_group_name [String] The name of the resource group that
1083
+ # contains the resource. You can obtain this value from the Azure Resource
1084
+ # Manager API or the portal.
1085
+ # @param server_name [String] The name of the server.
1086
+ # @param database_name [String] The name of the database on which the sync
1087
+ # group is hosted.
1088
+ # @param sync_group_name [String] The name of the sync group.
1089
+ # @param parameters [SyncGroup] The requested sync group resource state.
1090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1091
+ # will be added to the HTTP request.
1092
+ #
1093
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1094
+ #
1095
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1096
+ begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
1097
+ end
1098
+
1099
+ #
1100
+ # Creates or updates a sync group.
1101
+ #
1102
+ # @param resource_group_name [String] The name of the resource group that
1103
+ # contains the resource. You can obtain this value from the Azure Resource
1104
+ # Manager API or the portal.
1105
+ # @param server_name [String] The name of the server.
1106
+ # @param database_name [String] The name of the database on which the sync
1107
+ # group is hosted.
1108
+ # @param sync_group_name [String] The name of the sync group.
1109
+ # @param parameters [SyncGroup] The requested sync group resource state.
1110
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1111
+ # to the HTTP request.
1112
+ #
1113
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1114
+ #
1115
+ def begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1116
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1117
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1118
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1119
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
1120
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1121
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1122
+ api_version = '2015-05-01-preview'
1123
+
1124
+
1125
+ request_headers = {}
1126
+
1127
+ # Set Headers
1128
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1129
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1130
+
1131
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1132
+
1133
+ # Serialize Request
1134
+ request_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
1135
+ request_content = @client.serialize(request_mapper, parameters)
1136
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1137
+
1138
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'
1139
+
1140
+ request_url = @base_url || @client.base_url
1141
+
1142
+ options = {
1143
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1144
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
1145
+ query_params: {'api-version' => api_version},
1146
+ body: request_content,
1147
+ headers: request_headers.merge(custom_headers || {}),
1148
+ base_url: request_url
1149
+ }
1150
+ promise = @client.make_request_async(:put, path_template, options)
1151
+
1152
+ promise = promise.then do |result|
1153
+ http_response = result.response
1154
+ status_code = http_response.status
1155
+ response_content = http_response.body
1156
+ unless status_code == 200 || status_code == 202 || status_code == 201
1157
+ error_model = JSON.load(response_content)
1158
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1159
+ end
1160
+
1161
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1162
+ # Deserialize Response
1163
+ if status_code == 200
1164
+ begin
1165
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1166
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
1167
+ result.body = @client.deserialize(result_mapper, parsed_response)
1168
+ rescue Exception => e
1169
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1170
+ end
1171
+ end
1172
+ # Deserialize Response
1173
+ if status_code == 201
1174
+ begin
1175
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1176
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
1177
+ result.body = @client.deserialize(result_mapper, parsed_response)
1178
+ rescue Exception => e
1179
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1180
+ end
1181
+ end
1182
+
1183
+ result
1184
+ end
1185
+
1186
+ promise.execute
1187
+ end
1188
+
1189
+ #
1190
+ # Deletes a sync group.
1191
+ #
1192
+ # @param resource_group_name [String] The name of the resource group that
1193
+ # contains the resource. You can obtain this value from the Azure Resource
1194
+ # Manager API or the portal.
1195
+ # @param server_name [String] The name of the server.
1196
+ # @param database_name [String] The name of the database on which the sync
1197
+ # group is hosted.
1198
+ # @param sync_group_name [String] The name of the sync group.
1199
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1200
+ # will be added to the HTTP request.
1201
+ #
1202
+ #
1203
+ def begin_delete(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
1204
+ response = begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
1205
+ nil
1206
+ end
1207
+
1208
+ #
1209
+ # Deletes a sync group.
1210
+ #
1211
+ # @param resource_group_name [String] The name of the resource group that
1212
+ # contains the resource. You can obtain this value from the Azure Resource
1213
+ # Manager API or the portal.
1214
+ # @param server_name [String] The name of the server.
1215
+ # @param database_name [String] The name of the database on which the sync
1216
+ # group is hosted.
1217
+ # @param sync_group_name [String] The name of the sync group.
1218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1219
+ # will be added to the HTTP request.
1220
+ #
1221
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1222
+ #
1223
+ def begin_delete_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
1224
+ begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
1225
+ end
1226
+
1227
+ #
1228
+ # Deletes a sync group.
1229
+ #
1230
+ # @param resource_group_name [String] The name of the resource group that
1231
+ # contains the resource. You can obtain this value from the Azure Resource
1232
+ # Manager API or the portal.
1233
+ # @param server_name [String] The name of the server.
1234
+ # @param database_name [String] The name of the database on which the sync
1235
+ # group is hosted.
1236
+ # @param sync_group_name [String] The name of the sync group.
1237
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1238
+ # to the HTTP request.
1239
+ #
1240
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1241
+ #
1242
+ def begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
1243
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1244
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1245
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1246
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
1247
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1248
+ api_version = '2015-05-01-preview'
1249
+
1250
+
1251
+ request_headers = {}
1252
+
1253
+ # Set Headers
1254
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1255
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1256
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'
1257
+
1258
+ request_url = @base_url || @client.base_url
1259
+
1260
+ options = {
1261
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1262
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
1263
+ query_params: {'api-version' => api_version},
1264
+ headers: request_headers.merge(custom_headers || {}),
1265
+ base_url: request_url
1266
+ }
1267
+ promise = @client.make_request_async(:delete, path_template, options)
1268
+
1269
+ promise = promise.then do |result|
1270
+ http_response = result.response
1271
+ status_code = http_response.status
1272
+ response_content = http_response.body
1273
+ unless status_code == 200 || status_code == 202 || status_code == 204
1274
+ error_model = JSON.load(response_content)
1275
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1276
+ end
1277
+
1278
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1279
+
1280
+ result
1281
+ end
1282
+
1283
+ promise.execute
1284
+ end
1285
+
1286
+ #
1287
+ # Updates a sync group.
1288
+ #
1289
+ # @param resource_group_name [String] The name of the resource group that
1290
+ # contains the resource. You can obtain this value from the Azure Resource
1291
+ # Manager API or the portal.
1292
+ # @param server_name [String] The name of the server.
1293
+ # @param database_name [String] The name of the database on which the sync
1294
+ # group is hosted.
1295
+ # @param sync_group_name [String] The name of the sync group.
1296
+ # @param parameters [SyncGroup] The requested sync group resource state.
1297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1298
+ # will be added to the HTTP request.
1299
+ #
1300
+ # @return [SyncGroup] operation results.
1301
+ #
1302
+ def begin_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1303
+ response = begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
1304
+ response.body unless response.nil?
1305
+ end
1306
+
1307
+ #
1308
+ # Updates a sync group.
1309
+ #
1310
+ # @param resource_group_name [String] The name of the resource group that
1311
+ # contains the resource. You can obtain this value from the Azure Resource
1312
+ # Manager API or the portal.
1313
+ # @param server_name [String] The name of the server.
1314
+ # @param database_name [String] The name of the database on which the sync
1315
+ # group is hosted.
1316
+ # @param sync_group_name [String] The name of the sync group.
1317
+ # @param parameters [SyncGroup] The requested sync group resource state.
1318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1319
+ # will be added to the HTTP request.
1320
+ #
1321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1322
+ #
1323
+ def begin_update_with_http_info(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1324
+ begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers).value!
1325
+ end
1326
+
1327
+ #
1328
+ # Updates a sync group.
1329
+ #
1330
+ # @param resource_group_name [String] The name of the resource group that
1331
+ # contains the resource. You can obtain this value from the Azure Resource
1332
+ # Manager API or the portal.
1333
+ # @param server_name [String] The name of the server.
1334
+ # @param database_name [String] The name of the database on which the sync
1335
+ # group is hosted.
1336
+ # @param sync_group_name [String] The name of the sync group.
1337
+ # @param parameters [SyncGroup] The requested sync group resource state.
1338
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1339
+ # to the HTTP request.
1340
+ #
1341
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1342
+ #
1343
+ def begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers = nil)
1344
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1345
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1346
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1347
+ fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
1348
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1349
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1350
+ api_version = '2015-05-01-preview'
1351
+
1352
+
1353
+ request_headers = {}
1354
+
1355
+ # Set Headers
1356
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1357
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1358
+
1359
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1360
+
1361
+ # Serialize Request
1362
+ request_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
1363
+ request_content = @client.serialize(request_mapper, parameters)
1364
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1365
+
1366
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'
1367
+
1368
+ request_url = @base_url || @client.base_url
1369
+
1370
+ options = {
1371
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1372
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
1373
+ query_params: {'api-version' => api_version},
1374
+ body: request_content,
1375
+ headers: request_headers.merge(custom_headers || {}),
1376
+ base_url: request_url
1377
+ }
1378
+ promise = @client.make_request_async(:patch, path_template, options)
1379
+
1380
+ promise = promise.then do |result|
1381
+ http_response = result.response
1382
+ status_code = http_response.status
1383
+ response_content = http_response.body
1384
+ unless status_code == 200 || status_code == 202
1385
+ error_model = JSON.load(response_content)
1386
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1387
+ end
1388
+
1389
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1390
+ # Deserialize Response
1391
+ if status_code == 200
1392
+ begin
1393
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1394
+ result_mapper = Azure::ARM::SQL::Models::SyncGroup.mapper()
1395
+ result.body = @client.deserialize(result_mapper, parsed_response)
1396
+ rescue Exception => e
1397
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1398
+ end
1399
+ end
1400
+
1401
+ result
1402
+ end
1403
+
1404
+ promise.execute
1405
+ end
1406
+
1407
+ #
1408
+ # Gets a collection of sync database ids.
1409
+ #
1410
+ # @param next_page_link [String] The NextLink from the previous successful call
1411
+ # to List operation.
1412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1413
+ # will be added to the HTTP request.
1414
+ #
1415
+ # @return [SyncDatabaseIdListResult] operation results.
1416
+ #
1417
+ def list_sync_database_ids_next(next_page_link, custom_headers = nil)
1418
+ response = list_sync_database_ids_next_async(next_page_link, custom_headers).value!
1419
+ response.body unless response.nil?
1420
+ end
1421
+
1422
+ #
1423
+ # Gets a collection of sync database ids.
1424
+ #
1425
+ # @param next_page_link [String] The NextLink from the previous successful call
1426
+ # to List operation.
1427
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1428
+ # will be added to the HTTP request.
1429
+ #
1430
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1431
+ #
1432
+ def list_sync_database_ids_next_with_http_info(next_page_link, custom_headers = nil)
1433
+ list_sync_database_ids_next_async(next_page_link, custom_headers).value!
1434
+ end
1435
+
1436
+ #
1437
+ # Gets a collection of sync database ids.
1438
+ #
1439
+ # @param next_page_link [String] The NextLink from the previous successful call
1440
+ # to List operation.
1441
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1442
+ # to the HTTP request.
1443
+ #
1444
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1445
+ #
1446
+ def list_sync_database_ids_next_async(next_page_link, custom_headers = nil)
1447
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1448
+
1449
+
1450
+ request_headers = {}
1451
+
1452
+ # Set Headers
1453
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1454
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1455
+ path_template = '{nextLink}'
1456
+
1457
+ request_url = @base_url || @client.base_url
1458
+
1459
+ options = {
1460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1461
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1462
+ headers: request_headers.merge(custom_headers || {}),
1463
+ base_url: request_url
1464
+ }
1465
+ promise = @client.make_request_async(:get, path_template, options)
1466
+
1467
+ promise = promise.then do |result|
1468
+ http_response = result.response
1469
+ status_code = http_response.status
1470
+ response_content = http_response.body
1471
+ unless status_code == 200
1472
+ error_model = JSON.load(response_content)
1473
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1474
+ end
1475
+
1476
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1477
+ # Deserialize Response
1478
+ if status_code == 200
1479
+ begin
1480
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1481
+ result_mapper = Azure::ARM::SQL::Models::SyncDatabaseIdListResult.mapper()
1482
+ result.body = @client.deserialize(result_mapper, parsed_response)
1483
+ rescue Exception => e
1484
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1485
+ end
1486
+ end
1487
+
1488
+ result
1489
+ end
1490
+
1491
+ promise.execute
1492
+ end
1493
+
1494
+ #
1495
+ # Gets a collection of hub database schemas.
1496
+ #
1497
+ # @param next_page_link [String] The NextLink from the previous successful call
1498
+ # to List operation.
1499
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1500
+ # will be added to the HTTP request.
1501
+ #
1502
+ # @return [SyncFullSchemaPropertiesListResult] operation results.
1503
+ #
1504
+ def list_hub_schemas_next(next_page_link, custom_headers = nil)
1505
+ response = list_hub_schemas_next_async(next_page_link, custom_headers).value!
1506
+ response.body unless response.nil?
1507
+ end
1508
+
1509
+ #
1510
+ # Gets a collection of hub database schemas.
1511
+ #
1512
+ # @param next_page_link [String] The NextLink from the previous successful call
1513
+ # to List operation.
1514
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1515
+ # will be added to the HTTP request.
1516
+ #
1517
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1518
+ #
1519
+ def list_hub_schemas_next_with_http_info(next_page_link, custom_headers = nil)
1520
+ list_hub_schemas_next_async(next_page_link, custom_headers).value!
1521
+ end
1522
+
1523
+ #
1524
+ # Gets a collection of hub database schemas.
1525
+ #
1526
+ # @param next_page_link [String] The NextLink from the previous successful call
1527
+ # to List operation.
1528
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1529
+ # to the HTTP request.
1530
+ #
1531
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1532
+ #
1533
+ def list_hub_schemas_next_async(next_page_link, custom_headers = nil)
1534
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1535
+
1536
+
1537
+ request_headers = {}
1538
+
1539
+ # Set Headers
1540
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1541
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1542
+ path_template = '{nextLink}'
1543
+
1544
+ request_url = @base_url || @client.base_url
1545
+
1546
+ options = {
1547
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1548
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1549
+ headers: request_headers.merge(custom_headers || {}),
1550
+ base_url: request_url
1551
+ }
1552
+ promise = @client.make_request_async(:get, path_template, options)
1553
+
1554
+ promise = promise.then do |result|
1555
+ http_response = result.response
1556
+ status_code = http_response.status
1557
+ response_content = http_response.body
1558
+ unless status_code == 200
1559
+ error_model = JSON.load(response_content)
1560
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1561
+ end
1562
+
1563
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1564
+ # Deserialize Response
1565
+ if status_code == 200
1566
+ begin
1567
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1568
+ result_mapper = Azure::ARM::SQL::Models::SyncFullSchemaPropertiesListResult.mapper()
1569
+ result.body = @client.deserialize(result_mapper, parsed_response)
1570
+ rescue Exception => e
1571
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1572
+ end
1573
+ end
1574
+
1575
+ result
1576
+ end
1577
+
1578
+ promise.execute
1579
+ end
1580
+
1581
+ #
1582
+ # Gets a collection of sync group logs.
1583
+ #
1584
+ # @param next_page_link [String] The NextLink from the previous successful call
1585
+ # to List operation.
1586
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1587
+ # will be added to the HTTP request.
1588
+ #
1589
+ # @return [SyncGroupLogListResult] operation results.
1590
+ #
1591
+ def list_logs_next(next_page_link, custom_headers = nil)
1592
+ response = list_logs_next_async(next_page_link, custom_headers).value!
1593
+ response.body unless response.nil?
1594
+ end
1595
+
1596
+ #
1597
+ # Gets a collection of sync group logs.
1598
+ #
1599
+ # @param next_page_link [String] The NextLink from the previous successful call
1600
+ # to List operation.
1601
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1602
+ # will be added to the HTTP request.
1603
+ #
1604
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1605
+ #
1606
+ def list_logs_next_with_http_info(next_page_link, custom_headers = nil)
1607
+ list_logs_next_async(next_page_link, custom_headers).value!
1608
+ end
1609
+
1610
+ #
1611
+ # Gets a collection of sync group logs.
1612
+ #
1613
+ # @param next_page_link [String] The NextLink from the previous successful call
1614
+ # to List operation.
1615
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1616
+ # to the HTTP request.
1617
+ #
1618
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1619
+ #
1620
+ def list_logs_next_async(next_page_link, custom_headers = nil)
1621
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1622
+
1623
+
1624
+ request_headers = {}
1625
+
1626
+ # Set Headers
1627
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1628
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1629
+ path_template = '{nextLink}'
1630
+
1631
+ request_url = @base_url || @client.base_url
1632
+
1633
+ options = {
1634
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1635
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1636
+ headers: request_headers.merge(custom_headers || {}),
1637
+ base_url: request_url
1638
+ }
1639
+ promise = @client.make_request_async(:get, path_template, options)
1640
+
1641
+ promise = promise.then do |result|
1642
+ http_response = result.response
1643
+ status_code = http_response.status
1644
+ response_content = http_response.body
1645
+ unless status_code == 200
1646
+ error_model = JSON.load(response_content)
1647
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1648
+ end
1649
+
1650
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1651
+ # Deserialize Response
1652
+ if status_code == 200
1653
+ begin
1654
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1655
+ result_mapper = Azure::ARM::SQL::Models::SyncGroupLogListResult.mapper()
1656
+ result.body = @client.deserialize(result_mapper, parsed_response)
1657
+ rescue Exception => e
1658
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1659
+ end
1660
+ end
1661
+
1662
+ result
1663
+ end
1664
+
1665
+ promise.execute
1666
+ end
1667
+
1668
+ #
1669
+ # Lists sync groups under a hub database.
1670
+ #
1671
+ # @param next_page_link [String] The NextLink from the previous successful call
1672
+ # to List operation.
1673
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1674
+ # will be added to the HTTP request.
1675
+ #
1676
+ # @return [SyncGroupListResult] operation results.
1677
+ #
1678
+ def list_by_database_next(next_page_link, custom_headers = nil)
1679
+ response = list_by_database_next_async(next_page_link, custom_headers).value!
1680
+ response.body unless response.nil?
1681
+ end
1682
+
1683
+ #
1684
+ # Lists sync groups under a hub database.
1685
+ #
1686
+ # @param next_page_link [String] The NextLink from the previous successful call
1687
+ # to List operation.
1688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1689
+ # will be added to the HTTP request.
1690
+ #
1691
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1692
+ #
1693
+ def list_by_database_next_with_http_info(next_page_link, custom_headers = nil)
1694
+ list_by_database_next_async(next_page_link, custom_headers).value!
1695
+ end
1696
+
1697
+ #
1698
+ # Lists sync groups under a hub database.
1699
+ #
1700
+ # @param next_page_link [String] The NextLink from the previous successful call
1701
+ # to List operation.
1702
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1703
+ # to the HTTP request.
1704
+ #
1705
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1706
+ #
1707
+ def list_by_database_next_async(next_page_link, custom_headers = nil)
1708
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1709
+
1710
+
1711
+ request_headers = {}
1712
+
1713
+ # Set Headers
1714
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1715
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1716
+ path_template = '{nextLink}'
1717
+
1718
+ request_url = @base_url || @client.base_url
1719
+
1720
+ options = {
1721
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1722
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1723
+ headers: request_headers.merge(custom_headers || {}),
1724
+ base_url: request_url
1725
+ }
1726
+ promise = @client.make_request_async(:get, path_template, options)
1727
+
1728
+ promise = promise.then do |result|
1729
+ http_response = result.response
1730
+ status_code = http_response.status
1731
+ response_content = http_response.body
1732
+ unless status_code == 200
1733
+ error_model = JSON.load(response_content)
1734
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1735
+ end
1736
+
1737
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1738
+ # Deserialize Response
1739
+ if status_code == 200
1740
+ begin
1741
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1742
+ result_mapper = Azure::ARM::SQL::Models::SyncGroupListResult.mapper()
1743
+ result.body = @client.deserialize(result_mapper, parsed_response)
1744
+ rescue Exception => e
1745
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1746
+ end
1747
+ end
1748
+
1749
+ result
1750
+ end
1751
+
1752
+ promise.execute
1753
+ end
1754
+
1755
+ #
1756
+ # Gets a collection of sync database ids.
1757
+ #
1758
+ # @param location_name [String] The name of the region where the resource is
1759
+ # located.
1760
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1761
+ # will be added to the HTTP request.
1762
+ #
1763
+ # @return [SyncDatabaseIdListResult] which provide lazy access to pages of the
1764
+ # response.
1765
+ #
1766
+ def list_sync_database_ids_as_lazy(location_name, custom_headers = nil)
1767
+ response = list_sync_database_ids_async(location_name, custom_headers).value!
1768
+ unless response.nil?
1769
+ page = response.body
1770
+ page.next_method = Proc.new do |next_page_link|
1771
+ list_sync_database_ids_next_async(next_page_link, custom_headers)
1772
+ end
1773
+ page
1774
+ end
1775
+ end
1776
+
1777
+ #
1778
+ # Gets a collection of hub database schemas.
1779
+ #
1780
+ # @param resource_group_name [String] The name of the resource group that
1781
+ # contains the resource. You can obtain this value from the Azure Resource
1782
+ # Manager API or the portal.
1783
+ # @param server_name [String] The name of the server.
1784
+ # @param database_name [String] The name of the database on which the sync
1785
+ # group is hosted.
1786
+ # @param sync_group_name [String] The name of the sync group.
1787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1788
+ # will be added to the HTTP request.
1789
+ #
1790
+ # @return [SyncFullSchemaPropertiesListResult] which provide lazy access to
1791
+ # pages of the response.
1792
+ #
1793
+ def list_hub_schemas_as_lazy(resource_group_name, server_name, database_name, sync_group_name, custom_headers = nil)
1794
+ response = list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers).value!
1795
+ unless response.nil?
1796
+ page = response.body
1797
+ page.next_method = Proc.new do |next_page_link|
1798
+ list_hub_schemas_next_async(next_page_link, custom_headers)
1799
+ end
1800
+ page
1801
+ end
1802
+ end
1803
+
1804
+ #
1805
+ # Gets a collection of sync group logs.
1806
+ #
1807
+ # @param resource_group_name [String] The name of the resource group that
1808
+ # contains the resource. You can obtain this value from the Azure Resource
1809
+ # Manager API or the portal.
1810
+ # @param server_name [String] The name of the server.
1811
+ # @param database_name [String] The name of the database on which the sync
1812
+ # group is hosted.
1813
+ # @param sync_group_name [String] The name of the sync group.
1814
+ # @param start_time [String] Get logs generated after this time.
1815
+ # @param end_time [String] Get logs generated before this time.
1816
+ # @param type [Enum] The types of logs to retrieve. Possible values include:
1817
+ # 'All', 'Error', 'Warning', 'Success'
1818
+ # @param continuation_token [String] The continuation token for this operation.
1819
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1820
+ # will be added to the HTTP request.
1821
+ #
1822
+ # @return [SyncGroupLogListResult] which provide lazy access to pages of the
1823
+ # response.
1824
+ #
1825
+ def list_logs_as_lazy(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token = nil, custom_headers = nil)
1826
+ response = list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token, custom_headers).value!
1827
+ unless response.nil?
1828
+ page = response.body
1829
+ page.next_method = Proc.new do |next_page_link|
1830
+ list_logs_next_async(next_page_link, custom_headers)
1831
+ end
1832
+ page
1833
+ end
1834
+ end
1835
+
1836
+ #
1837
+ # Lists sync groups under a hub database.
1838
+ #
1839
+ # @param resource_group_name [String] The name of the resource group that
1840
+ # contains the resource. You can obtain this value from the Azure Resource
1841
+ # Manager API or the portal.
1842
+ # @param server_name [String] The name of the server.
1843
+ # @param database_name [String] The name of the database on which the sync
1844
+ # group is hosted.
1845
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1846
+ # will be added to the HTTP request.
1847
+ #
1848
+ # @return [SyncGroupListResult] which provide lazy access to pages of the
1849
+ # response.
1850
+ #
1851
+ def list_by_database_as_lazy(resource_group_name, server_name, database_name, custom_headers = nil)
1852
+ response = list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
1853
+ unless response.nil?
1854
+ page = response.body
1855
+ page.next_method = Proc.new do |next_page_link|
1856
+ list_by_database_next_async(next_page_link, custom_headers)
1857
+ end
1858
+ page
1859
+ end
1860
+ end
1861
+
1862
+ end
1863
+ end