azure_mgmt_sqlvirtualmachine 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine.rb +71 -0
  4. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/availability_group_listeners.rb +684 -0
  5. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/additional_features_server_configurations.rb +57 -0
  6. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/auto_backup_settings.rb +173 -0
  7. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/auto_patching_settings.rb +85 -0
  8. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/availability_group_listener.rb +130 -0
  9. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/availability_group_listener_list_result.rb +100 -0
  10. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/backup_schedule_type.rb +16 -0
  11. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/cluster_configuration.rb +15 -0
  12. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/cluster_manager_type.rb +15 -0
  13. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/connectivity_type.rb +17 -0
  14. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/day_of_week.rb +21 -0
  15. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/disk_configuration_type.rb +17 -0
  16. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/full_backup_frequency_type.rb +16 -0
  17. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/identity_type.rb +15 -0
  18. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/key_vault_credential_settings.rb +91 -0
  19. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/load_balancer_configuration.rb +100 -0
  20. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation.rb +95 -0
  21. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_display.rb +85 -0
  22. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_list_result.rb +100 -0
  23. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/operation_origin.rb +16 -0
  24. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/private_ipaddress.rb +58 -0
  25. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/proxy_resource.rb +62 -0
  26. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/resource.rb +80 -0
  27. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/resource_identity.rb +72 -0
  28. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/scale_type.rb +15 -0
  29. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/server_configurations_management_settings.rb +84 -0
  30. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_connectivity_update_settings.rb +80 -0
  31. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_image_sku.rb +19 -0
  32. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_server_license_type.rb +16 -0
  33. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_storage_update_settings.rb +58 -0
  34. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine.rb +237 -0
  35. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group.rb +174 -0
  36. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group_list_result.rb +100 -0
  37. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_group_update.rb +54 -0
  38. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_list_result.rb +100 -0
  39. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_virtual_machine_update.rb +54 -0
  40. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_workload_type.rb +17 -0
  41. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/sql_workload_type_update_settings.rb +47 -0
  42. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/tracked_resource.rb +92 -0
  43. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/wsfc_domain_credentials.rb +69 -0
  44. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/models/wsfc_domain_profile.rb +130 -0
  45. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/module_definition.rb +9 -0
  46. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/operations.rb +219 -0
  47. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machine_groups.rb +1000 -0
  48. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machine_management_client.rb +143 -0
  49. data/lib/2017-03-01-preview/generated/azure_mgmt_sqlvirtualmachine/sql_virtual_machines.rb +980 -0
  50. data/lib/azure_mgmt_sqlvirtualmachine.rb +6 -0
  51. data/lib/module_definition.rb +8 -0
  52. data/lib/profiles/latest/modules/sqlvirtualmachine_profile_module.rb +227 -0
  53. data/lib/profiles/latest/sqlvirtualmachine_latest_profile_client.rb +40 -0
  54. data/lib/profiles/latest/sqlvirtualmachine_module_definition.rb +8 -0
  55. data/lib/version.rb +7 -0
  56. metadata +173 -0
@@ -0,0 +1,1000 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview
7
+ #
8
+ # The SQL virtual machine management API provides a RESTful set of web APIs
9
+ # that interact with Azure Compute, Network & Storage services to manage your
10
+ # SQL Server virtual machine. The API enables users to create, delete and
11
+ # retrieve a SQL virtual machine, SQL virtual machine group or availability
12
+ # group listener.
13
+ #
14
+ class SqlVirtualMachineGroups
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the SqlVirtualMachineGroups class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return [SqlVirtualMachineManagementClient] reference to the SqlVirtualMachineManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # Gets a SQL virtual machine group.
30
+ #
31
+ # @param resource_group_name [String] Name of the resource group that contains
32
+ # the resource. You can obtain this value from the Azure Resource Manager API
33
+ # or the portal.
34
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
35
+ # machine group.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [SqlVirtualMachineGroup] operation results.
40
+ #
41
+ def get(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
42
+ response = get_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a SQL virtual machine group.
48
+ #
49
+ # @param resource_group_name [String] Name of the resource group that contains
50
+ # the resource. You can obtain this value from the Azure Resource Manager API
51
+ # or the portal.
52
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
53
+ # machine group.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def get_with_http_info(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
60
+ get_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Gets a SQL virtual machine group.
65
+ #
66
+ # @param resource_group_name [String] Name of the resource group that contains
67
+ # the resource. You can obtain this value from the Azure Resource Manager API
68
+ # or the portal.
69
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
70
+ # machine group.
71
+ # @param [Hash{String => String}] A hash of custom headers that will be added
72
+ # to the HTTP request.
73
+ #
74
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
75
+ #
76
+ def get_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
77
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
78
+ fail ArgumentError, 'sql_virtual_machine_group_name is nil' if sql_virtual_machine_group_name.nil?
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+
82
+
83
+ request_headers = {}
84
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineGroupName' => sql_virtual_machine_group_name,'subscriptionId' => @client.subscription_id},
96
+ query_params: {'api-version' => @client.api_version},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Creates or updates a SQL virtual machine group.
131
+ #
132
+ # @param resource_group_name [String] Name of the resource group that contains
133
+ # the resource. You can obtain this value from the Azure Resource Manager API
134
+ # or the portal.
135
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
136
+ # machine group.
137
+ # @param parameters [SqlVirtualMachineGroup] The SQL virtual machine group.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [SqlVirtualMachineGroup] operation results.
142
+ #
143
+ def create_or_update(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
144
+ response = create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
145
+ response.body unless response.nil?
146
+ end
147
+
148
+ #
149
+ # @param resource_group_name [String] Name of the resource group that contains
150
+ # the resource. You can obtain this value from the Azure Resource Manager API
151
+ # or the portal.
152
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
153
+ # machine group.
154
+ # @param parameters [SqlVirtualMachineGroup] The SQL virtual machine group.
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [Concurrent::Promise] promise which provides async access to http
159
+ # response.
160
+ #
161
+ def create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
162
+ # Send request
163
+ promise = begin_create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers)
164
+
165
+ promise = promise.then do |response|
166
+ # Defining deserialization method.
167
+ deserialize_method = lambda do |parsed_response|
168
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
169
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
170
+ end
171
+
172
+ # Waiting for response.
173
+ @client.get_long_running_operation_result(response, deserialize_method)
174
+ end
175
+
176
+ promise
177
+ end
178
+
179
+ #
180
+ # Deletes a SQL virtual machine group.
181
+ #
182
+ # @param resource_group_name [String] Name of the resource group that contains
183
+ # the resource. You can obtain this value from the Azure Resource Manager API
184
+ # or the portal.
185
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
186
+ # machine group.
187
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
188
+ # will be added to the HTTP request.
189
+ #
190
+ def delete(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
191
+ response = delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers).value!
192
+ nil
193
+ end
194
+
195
+ #
196
+ # @param resource_group_name [String] Name of the resource group that contains
197
+ # the resource. You can obtain this value from the Azure Resource Manager API
198
+ # or the portal.
199
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
200
+ # machine group.
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [Concurrent::Promise] promise which provides async access to http
205
+ # response.
206
+ #
207
+ def delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
208
+ # Send request
209
+ promise = begin_delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers)
210
+
211
+ promise = promise.then do |response|
212
+ # Defining deserialization method.
213
+ deserialize_method = lambda do |parsed_response|
214
+ end
215
+
216
+ # Waiting for response.
217
+ @client.get_long_running_operation_result(response, deserialize_method)
218
+ end
219
+
220
+ promise
221
+ end
222
+
223
+ #
224
+ # Updates SQL virtual machine group tags.
225
+ #
226
+ # @param resource_group_name [String] Name of the resource group that contains
227
+ # the resource. You can obtain this value from the Azure Resource Manager API
228
+ # or the portal.
229
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
230
+ # machine group.
231
+ # @param parameters [SqlVirtualMachineGroupUpdate] The SQL virtual machine
232
+ # group.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [SqlVirtualMachineGroup] operation results.
237
+ #
238
+ def update(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
239
+ response = update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
240
+ response.body unless response.nil?
241
+ end
242
+
243
+ #
244
+ # @param resource_group_name [String] Name of the resource group that contains
245
+ # the resource. You can obtain this value from the Azure Resource Manager API
246
+ # or the portal.
247
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
248
+ # machine group.
249
+ # @param parameters [SqlVirtualMachineGroupUpdate] The SQL virtual machine
250
+ # group.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [Concurrent::Promise] promise which provides async access to http
255
+ # response.
256
+ #
257
+ def update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
258
+ # Send request
259
+ promise = begin_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers)
260
+
261
+ promise = promise.then do |response|
262
+ # Defining deserialization method.
263
+ deserialize_method = lambda do |parsed_response|
264
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
265
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
266
+ end
267
+
268
+ # Waiting for response.
269
+ @client.get_long_running_operation_result(response, deserialize_method)
270
+ end
271
+
272
+ promise
273
+ end
274
+
275
+ #
276
+ # Gets all SQL virtual machine groups in a resource group.
277
+ #
278
+ # @param resource_group_name [String] Name of the resource group that contains
279
+ # the resource. You can obtain this value from the Azure Resource Manager API
280
+ # or the portal.
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [Array<SqlVirtualMachineGroup>] operation results.
285
+ #
286
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
287
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
288
+ first_page.get_all_items
289
+ end
290
+
291
+ #
292
+ # Gets all SQL virtual machine groups in a resource group.
293
+ #
294
+ # @param resource_group_name [String] Name of the resource group that contains
295
+ # the resource. You can obtain this value from the Azure Resource Manager API
296
+ # or the portal.
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
301
+ #
302
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
303
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
304
+ end
305
+
306
+ #
307
+ # Gets all SQL virtual machine groups in a resource group.
308
+ #
309
+ # @param resource_group_name [String] Name of the resource group that contains
310
+ # the resource. You can obtain this value from the Azure Resource Manager API
311
+ # or the portal.
312
+ # @param [Hash{String => String}] A hash of custom headers that will be added
313
+ # to the HTTP request.
314
+ #
315
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
316
+ #
317
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
318
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
319
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
320
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
321
+
322
+
323
+ request_headers = {}
324
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
325
+
326
+ # Set Headers
327
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
328
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
329
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups'
330
+
331
+ request_url = @base_url || @client.base_url
332
+
333
+ options = {
334
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
335
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
336
+ query_params: {'api-version' => @client.api_version},
337
+ headers: request_headers.merge(custom_headers || {}),
338
+ base_url: request_url
339
+ }
340
+ promise = @client.make_request_async(:get, path_template, options)
341
+
342
+ promise = promise.then do |result|
343
+ http_response = result.response
344
+ status_code = http_response.status
345
+ response_content = http_response.body
346
+ unless status_code == 200
347
+ error_model = JSON.load(response_content)
348
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
349
+ end
350
+
351
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
352
+ # Deserialize Response
353
+ if status_code == 200
354
+ begin
355
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
356
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroupListResult.mapper()
357
+ result.body = @client.deserialize(result_mapper, parsed_response)
358
+ rescue Exception => e
359
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
360
+ end
361
+ end
362
+
363
+ result
364
+ end
365
+
366
+ promise.execute
367
+ end
368
+
369
+ #
370
+ # Gets all SQL virtual machine groups in a subscription.
371
+ #
372
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
373
+ # will be added to the HTTP request.
374
+ #
375
+ # @return [Array<SqlVirtualMachineGroup>] operation results.
376
+ #
377
+ def list(custom_headers:nil)
378
+ first_page = list_as_lazy(custom_headers:custom_headers)
379
+ first_page.get_all_items
380
+ end
381
+
382
+ #
383
+ # Gets all SQL virtual machine groups in a subscription.
384
+ #
385
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
386
+ # will be added to the HTTP request.
387
+ #
388
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
389
+ #
390
+ def list_with_http_info(custom_headers:nil)
391
+ list_async(custom_headers:custom_headers).value!
392
+ end
393
+
394
+ #
395
+ # Gets all SQL virtual machine groups in a subscription.
396
+ #
397
+ # @param [Hash{String => String}] A hash of custom headers that will be added
398
+ # to the HTTP request.
399
+ #
400
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
401
+ #
402
+ def list_async(custom_headers:nil)
403
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
404
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
405
+
406
+
407
+ request_headers = {}
408
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
409
+
410
+ # Set Headers
411
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
412
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
413
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups'
414
+
415
+ request_url = @base_url || @client.base_url
416
+
417
+ options = {
418
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
419
+ path_params: {'subscriptionId' => @client.subscription_id},
420
+ query_params: {'api-version' => @client.api_version},
421
+ headers: request_headers.merge(custom_headers || {}),
422
+ base_url: request_url
423
+ }
424
+ promise = @client.make_request_async(:get, path_template, options)
425
+
426
+ promise = promise.then do |result|
427
+ http_response = result.response
428
+ status_code = http_response.status
429
+ response_content = http_response.body
430
+ unless status_code == 200
431
+ error_model = JSON.load(response_content)
432
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
433
+ end
434
+
435
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
436
+ # Deserialize Response
437
+ if status_code == 200
438
+ begin
439
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
440
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroupListResult.mapper()
441
+ result.body = @client.deserialize(result_mapper, parsed_response)
442
+ rescue Exception => e
443
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
444
+ end
445
+ end
446
+
447
+ result
448
+ end
449
+
450
+ promise.execute
451
+ end
452
+
453
+ #
454
+ # Creates or updates a SQL virtual machine group.
455
+ #
456
+ # @param resource_group_name [String] Name of the resource group that contains
457
+ # the resource. You can obtain this value from the Azure Resource Manager API
458
+ # or the portal.
459
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
460
+ # machine group.
461
+ # @param parameters [SqlVirtualMachineGroup] The SQL virtual machine group.
462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
463
+ # will be added to the HTTP request.
464
+ #
465
+ # @return [SqlVirtualMachineGroup] operation results.
466
+ #
467
+ def begin_create_or_update(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
468
+ response = begin_create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
469
+ response.body unless response.nil?
470
+ end
471
+
472
+ #
473
+ # Creates or updates a SQL virtual machine group.
474
+ #
475
+ # @param resource_group_name [String] Name of the resource group that contains
476
+ # the resource. You can obtain this value from the Azure Resource Manager API
477
+ # or the portal.
478
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
479
+ # machine group.
480
+ # @param parameters [SqlVirtualMachineGroup] The SQL virtual machine group.
481
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
482
+ # will be added to the HTTP request.
483
+ #
484
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
485
+ #
486
+ def begin_create_or_update_with_http_info(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
487
+ begin_create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
488
+ end
489
+
490
+ #
491
+ # Creates or updates a SQL virtual machine group.
492
+ #
493
+ # @param resource_group_name [String] Name of the resource group that contains
494
+ # the resource. You can obtain this value from the Azure Resource Manager API
495
+ # or the portal.
496
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
497
+ # machine group.
498
+ # @param parameters [SqlVirtualMachineGroup] The SQL virtual machine group.
499
+ # @param [Hash{String => String}] A hash of custom headers that will be added
500
+ # to the HTTP request.
501
+ #
502
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
503
+ #
504
+ def begin_create_or_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
505
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
506
+ fail ArgumentError, 'sql_virtual_machine_group_name is nil' if sql_virtual_machine_group_name.nil?
507
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
508
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
509
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
510
+
511
+
512
+ request_headers = {}
513
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
514
+
515
+ # Set Headers
516
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
517
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
518
+
519
+ # Serialize Request
520
+ request_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
521
+ request_content = @client.serialize(request_mapper, parameters)
522
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
523
+
524
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}'
525
+
526
+ request_url = @base_url || @client.base_url
527
+
528
+ options = {
529
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
530
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineGroupName' => sql_virtual_machine_group_name,'subscriptionId' => @client.subscription_id},
531
+ query_params: {'api-version' => @client.api_version},
532
+ body: request_content,
533
+ headers: request_headers.merge(custom_headers || {}),
534
+ base_url: request_url
535
+ }
536
+ promise = @client.make_request_async(:put, path_template, options)
537
+
538
+ promise = promise.then do |result|
539
+ http_response = result.response
540
+ status_code = http_response.status
541
+ response_content = http_response.body
542
+ unless status_code == 200 || status_code == 201
543
+ error_model = JSON.load(response_content)
544
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
545
+ end
546
+
547
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
548
+ # Deserialize Response
549
+ if status_code == 200
550
+ begin
551
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
552
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
553
+ result.body = @client.deserialize(result_mapper, parsed_response)
554
+ rescue Exception => e
555
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
556
+ end
557
+ end
558
+ # Deserialize Response
559
+ if status_code == 201
560
+ begin
561
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
562
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
563
+ result.body = @client.deserialize(result_mapper, parsed_response)
564
+ rescue Exception => e
565
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
566
+ end
567
+ end
568
+
569
+ result
570
+ end
571
+
572
+ promise.execute
573
+ end
574
+
575
+ #
576
+ # Deletes a SQL virtual machine group.
577
+ #
578
+ # @param resource_group_name [String] Name of the resource group that contains
579
+ # the resource. You can obtain this value from the Azure Resource Manager API
580
+ # or the portal.
581
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
582
+ # machine group.
583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
584
+ # will be added to the HTTP request.
585
+ #
586
+ #
587
+ def begin_delete(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
588
+ response = begin_delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers).value!
589
+ nil
590
+ end
591
+
592
+ #
593
+ # Deletes a SQL virtual machine group.
594
+ #
595
+ # @param resource_group_name [String] Name of the resource group that contains
596
+ # the resource. You can obtain this value from the Azure Resource Manager API
597
+ # or the portal.
598
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
599
+ # machine group.
600
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
601
+ # will be added to the HTTP request.
602
+ #
603
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
604
+ #
605
+ def begin_delete_with_http_info(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
606
+ begin_delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:custom_headers).value!
607
+ end
608
+
609
+ #
610
+ # Deletes a SQL virtual machine group.
611
+ #
612
+ # @param resource_group_name [String] Name of the resource group that contains
613
+ # the resource. You can obtain this value from the Azure Resource Manager API
614
+ # or the portal.
615
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
616
+ # machine group.
617
+ # @param [Hash{String => String}] A hash of custom headers that will be added
618
+ # to the HTTP request.
619
+ #
620
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
621
+ #
622
+ def begin_delete_async(resource_group_name, sql_virtual_machine_group_name, custom_headers:nil)
623
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
624
+ fail ArgumentError, 'sql_virtual_machine_group_name is nil' if sql_virtual_machine_group_name.nil?
625
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
626
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
627
+
628
+
629
+ request_headers = {}
630
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
631
+
632
+ # Set Headers
633
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
634
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
635
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}'
636
+
637
+ request_url = @base_url || @client.base_url
638
+
639
+ options = {
640
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
641
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineGroupName' => sql_virtual_machine_group_name,'subscriptionId' => @client.subscription_id},
642
+ query_params: {'api-version' => @client.api_version},
643
+ headers: request_headers.merge(custom_headers || {}),
644
+ base_url: request_url
645
+ }
646
+ promise = @client.make_request_async(:delete, path_template, options)
647
+
648
+ promise = promise.then do |result|
649
+ http_response = result.response
650
+ status_code = http_response.status
651
+ response_content = http_response.body
652
+ unless status_code == 200 || status_code == 202 || status_code == 204
653
+ error_model = JSON.load(response_content)
654
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
655
+ end
656
+
657
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
658
+
659
+ result
660
+ end
661
+
662
+ promise.execute
663
+ end
664
+
665
+ #
666
+ # Updates SQL virtual machine group tags.
667
+ #
668
+ # @param resource_group_name [String] Name of the resource group that contains
669
+ # the resource. You can obtain this value from the Azure Resource Manager API
670
+ # or the portal.
671
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
672
+ # machine group.
673
+ # @param parameters [SqlVirtualMachineGroupUpdate] The SQL virtual machine
674
+ # group.
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ # @return [SqlVirtualMachineGroup] operation results.
679
+ #
680
+ def begin_update(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
681
+ response = begin_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
682
+ response.body unless response.nil?
683
+ end
684
+
685
+ #
686
+ # Updates SQL virtual machine group tags.
687
+ #
688
+ # @param resource_group_name [String] Name of the resource group that contains
689
+ # the resource. You can obtain this value from the Azure Resource Manager API
690
+ # or the portal.
691
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
692
+ # machine group.
693
+ # @param parameters [SqlVirtualMachineGroupUpdate] The SQL virtual machine
694
+ # group.
695
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
696
+ # will be added to the HTTP request.
697
+ #
698
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
699
+ #
700
+ def begin_update_with_http_info(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
701
+ begin_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:custom_headers).value!
702
+ end
703
+
704
+ #
705
+ # Updates SQL virtual machine group tags.
706
+ #
707
+ # @param resource_group_name [String] Name of the resource group that contains
708
+ # the resource. You can obtain this value from the Azure Resource Manager API
709
+ # or the portal.
710
+ # @param sql_virtual_machine_group_name [String] Name of the SQL virtual
711
+ # machine group.
712
+ # @param parameters [SqlVirtualMachineGroupUpdate] The SQL virtual machine
713
+ # group.
714
+ # @param [Hash{String => String}] A hash of custom headers that will be added
715
+ # to the HTTP request.
716
+ #
717
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
718
+ #
719
+ def begin_update_async(resource_group_name, sql_virtual_machine_group_name, parameters, custom_headers:nil)
720
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
721
+ fail ArgumentError, 'sql_virtual_machine_group_name is nil' if sql_virtual_machine_group_name.nil?
722
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
723
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
724
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
725
+
726
+
727
+ request_headers = {}
728
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
729
+
730
+ # Set Headers
731
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
732
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
733
+
734
+ # Serialize Request
735
+ request_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroupUpdate.mapper()
736
+ request_content = @client.serialize(request_mapper, parameters)
737
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
738
+
739
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}'
740
+
741
+ request_url = @base_url || @client.base_url
742
+
743
+ options = {
744
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
745
+ path_params: {'resourceGroupName' => resource_group_name,'sqlVirtualMachineGroupName' => sql_virtual_machine_group_name,'subscriptionId' => @client.subscription_id},
746
+ query_params: {'api-version' => @client.api_version},
747
+ body: request_content,
748
+ headers: request_headers.merge(custom_headers || {}),
749
+ base_url: request_url
750
+ }
751
+ promise = @client.make_request_async(:patch, path_template, options)
752
+
753
+ promise = promise.then do |result|
754
+ http_response = result.response
755
+ status_code = http_response.status
756
+ response_content = http_response.body
757
+ unless status_code == 200
758
+ error_model = JSON.load(response_content)
759
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
760
+ end
761
+
762
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
763
+ # Deserialize Response
764
+ if status_code == 200
765
+ begin
766
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
767
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroup.mapper()
768
+ result.body = @client.deserialize(result_mapper, parsed_response)
769
+ rescue Exception => e
770
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
771
+ end
772
+ end
773
+
774
+ result
775
+ end
776
+
777
+ promise.execute
778
+ end
779
+
780
+ #
781
+ # Gets all SQL virtual machine groups in a resource group.
782
+ #
783
+ # @param next_page_link [String] The NextLink from the previous successful call
784
+ # to List operation.
785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
786
+ # will be added to the HTTP request.
787
+ #
788
+ # @return [SqlVirtualMachineGroupListResult] operation results.
789
+ #
790
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
791
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
792
+ response.body unless response.nil?
793
+ end
794
+
795
+ #
796
+ # Gets all SQL virtual machine groups in a resource group.
797
+ #
798
+ # @param next_page_link [String] The NextLink from the previous successful call
799
+ # to List operation.
800
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
801
+ # will be added to the HTTP request.
802
+ #
803
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
804
+ #
805
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
806
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
807
+ end
808
+
809
+ #
810
+ # Gets all SQL virtual machine groups in a resource group.
811
+ #
812
+ # @param next_page_link [String] The NextLink from the previous successful call
813
+ # to List operation.
814
+ # @param [Hash{String => String}] A hash of custom headers that will be added
815
+ # to the HTTP request.
816
+ #
817
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
818
+ #
819
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
820
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
821
+
822
+
823
+ request_headers = {}
824
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
825
+
826
+ # Set Headers
827
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
828
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
829
+ path_template = '{nextLink}'
830
+
831
+ request_url = @base_url || @client.base_url
832
+
833
+ options = {
834
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
835
+ skip_encoding_path_params: {'nextLink' => next_page_link},
836
+ headers: request_headers.merge(custom_headers || {}),
837
+ base_url: request_url
838
+ }
839
+ promise = @client.make_request_async(:get, path_template, options)
840
+
841
+ promise = promise.then do |result|
842
+ http_response = result.response
843
+ status_code = http_response.status
844
+ response_content = http_response.body
845
+ unless status_code == 200
846
+ error_model = JSON.load(response_content)
847
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
848
+ end
849
+
850
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
851
+ # Deserialize Response
852
+ if status_code == 200
853
+ begin
854
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
855
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroupListResult.mapper()
856
+ result.body = @client.deserialize(result_mapper, parsed_response)
857
+ rescue Exception => e
858
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
859
+ end
860
+ end
861
+
862
+ result
863
+ end
864
+
865
+ promise.execute
866
+ end
867
+
868
+ #
869
+ # Gets all SQL virtual machine groups in a subscription.
870
+ #
871
+ # @param next_page_link [String] The NextLink from the previous successful call
872
+ # to List operation.
873
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
874
+ # will be added to the HTTP request.
875
+ #
876
+ # @return [SqlVirtualMachineGroupListResult] operation results.
877
+ #
878
+ def list_next(next_page_link, custom_headers:nil)
879
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
880
+ response.body unless response.nil?
881
+ end
882
+
883
+ #
884
+ # Gets all SQL virtual machine groups in a subscription.
885
+ #
886
+ # @param next_page_link [String] The NextLink from the previous successful call
887
+ # to List operation.
888
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
889
+ # will be added to the HTTP request.
890
+ #
891
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
892
+ #
893
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
894
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
895
+ end
896
+
897
+ #
898
+ # Gets all SQL virtual machine groups in a subscription.
899
+ #
900
+ # @param next_page_link [String] The NextLink from the previous successful call
901
+ # to List operation.
902
+ # @param [Hash{String => String}] A hash of custom headers that will be added
903
+ # to the HTTP request.
904
+ #
905
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
906
+ #
907
+ def list_next_async(next_page_link, custom_headers:nil)
908
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
909
+
910
+
911
+ request_headers = {}
912
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
913
+
914
+ # Set Headers
915
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
916
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
917
+ path_template = '{nextLink}'
918
+
919
+ request_url = @base_url || @client.base_url
920
+
921
+ options = {
922
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
923
+ skip_encoding_path_params: {'nextLink' => next_page_link},
924
+ headers: request_headers.merge(custom_headers || {}),
925
+ base_url: request_url
926
+ }
927
+ promise = @client.make_request_async(:get, path_template, options)
928
+
929
+ promise = promise.then do |result|
930
+ http_response = result.response
931
+ status_code = http_response.status
932
+ response_content = http_response.body
933
+ unless status_code == 200
934
+ error_model = JSON.load(response_content)
935
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
936
+ end
937
+
938
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
939
+ # Deserialize Response
940
+ if status_code == 200
941
+ begin
942
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
943
+ result_mapper = Azure::Sqlvirtualmachine::Mgmt::V2017_03_01_preview::Models::SqlVirtualMachineGroupListResult.mapper()
944
+ result.body = @client.deserialize(result_mapper, parsed_response)
945
+ rescue Exception => e
946
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
947
+ end
948
+ end
949
+
950
+ result
951
+ end
952
+
953
+ promise.execute
954
+ end
955
+
956
+ #
957
+ # Gets all SQL virtual machine groups in a resource group.
958
+ #
959
+ # @param resource_group_name [String] Name of the resource group that contains
960
+ # the resource. You can obtain this value from the Azure Resource Manager API
961
+ # or the portal.
962
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
963
+ # will be added to the HTTP request.
964
+ #
965
+ # @return [SqlVirtualMachineGroupListResult] which provide lazy access to pages
966
+ # of the response.
967
+ #
968
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
969
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
970
+ unless response.nil?
971
+ page = response.body
972
+ page.next_method = Proc.new do |next_page_link|
973
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
974
+ end
975
+ page
976
+ end
977
+ end
978
+
979
+ #
980
+ # Gets all SQL virtual machine groups in a subscription.
981
+ #
982
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
983
+ # will be added to the HTTP request.
984
+ #
985
+ # @return [SqlVirtualMachineGroupListResult] which provide lazy access to pages
986
+ # of the response.
987
+ #
988
+ def list_as_lazy(custom_headers:nil)
989
+ response = list_async(custom_headers:custom_headers).value!
990
+ unless response.nil?
991
+ page = response.body
992
+ page.next_method = Proc.new do |next_page_link|
993
+ list_next_async(next_page_link, custom_headers:custom_headers)
994
+ end
995
+ page
996
+ end
997
+ end
998
+
999
+ end
1000
+ end