azure_mgmt_resources 0.2.1 → 0.3.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 (64) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +1 -27
  3. data/azure_mgmt_resources.gemspec +1 -1
  4. data/lib/azure_mgmt_resources.rb +7 -10
  5. data/lib/azure_mgmt_resources/deployment_operations.rb +117 -16
  6. data/lib/azure_mgmt_resources/deployments.rb +416 -51
  7. data/lib/azure_mgmt_resources/models/basic_dependency.rb +1 -1
  8. data/lib/azure_mgmt_resources/models/debug_setting.rb +56 -0
  9. data/lib/azure_mgmt_resources/models/dependency.rb +1 -1
  10. data/lib/azure_mgmt_resources/models/deployment.rb +1 -1
  11. data/lib/azure_mgmt_resources/models/deployment_export_result.rb +56 -0
  12. data/lib/azure_mgmt_resources/models/deployment_extended.rb +1 -1
  13. data/lib/azure_mgmt_resources/models/deployment_extended_filter.rb +1 -1
  14. data/lib/azure_mgmt_resources/models/deployment_list_result.rb +1 -1
  15. data/lib/azure_mgmt_resources/models/deployment_mode.rb +1 -1
  16. data/lib/azure_mgmt_resources/models/deployment_operation.rb +1 -1
  17. data/lib/azure_mgmt_resources/models/deployment_operation_properties.rb +42 -1
  18. data/lib/azure_mgmt_resources/models/deployment_operations_list_result.rb +1 -1
  19. data/lib/azure_mgmt_resources/models/deployment_properties.rb +18 -1
  20. data/lib/azure_mgmt_resources/models/deployment_properties_extended.rb +18 -1
  21. data/lib/azure_mgmt_resources/models/deployment_validate_result.rb +1 -1
  22. data/lib/azure_mgmt_resources/models/export_template_request.rb +69 -0
  23. data/lib/azure_mgmt_resources/models/generic_resource.rb +1 -1
  24. data/lib/azure_mgmt_resources/models/generic_resource_filter.rb +1 -1
  25. data/lib/azure_mgmt_resources/models/http_message.rb +56 -0
  26. data/lib/azure_mgmt_resources/models/parameters_link.rb +1 -1
  27. data/lib/azure_mgmt_resources/models/plan.rb +1 -1
  28. data/lib/azure_mgmt_resources/models/provider.rb +1 -1
  29. data/lib/azure_mgmt_resources/models/provider_list_result.rb +1 -1
  30. data/lib/azure_mgmt_resources/models/provider_resource_type.rb +1 -1
  31. data/lib/azure_mgmt_resources/models/resource_group.rb +1 -1
  32. data/lib/azure_mgmt_resources/models/resource_group_export_result.rb +71 -0
  33. data/lib/azure_mgmt_resources/models/resource_group_filter.rb +1 -1
  34. data/lib/azure_mgmt_resources/models/resource_group_list_result.rb +1 -1
  35. data/lib/azure_mgmt_resources/models/resource_group_properties.rb +1 -1
  36. data/lib/azure_mgmt_resources/models/resource_list_result.rb +1 -1
  37. data/lib/azure_mgmt_resources/models/resource_management_error_with_details.rb +18 -5
  38. data/lib/azure_mgmt_resources/models/resource_provider_operation_definition.rb +1 -1
  39. data/lib/azure_mgmt_resources/models/resource_provider_operation_detail_list_result.rb +1 -1
  40. data/lib/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -1
  41. data/lib/azure_mgmt_resources/models/resources_move_info.rb +1 -1
  42. data/lib/azure_mgmt_resources/models/tag_count.rb +1 -1
  43. data/lib/azure_mgmt_resources/models/tag_details.rb +1 -1
  44. data/lib/azure_mgmt_resources/models/tag_value.rb +1 -1
  45. data/lib/azure_mgmt_resources/models/tags_list_result.rb +1 -1
  46. data/lib/azure_mgmt_resources/models/target_resource.rb +1 -1
  47. data/lib/azure_mgmt_resources/models/template_link.rb +1 -1
  48. data/lib/azure_mgmt_resources/module_definition.rb +1 -1
  49. data/lib/azure_mgmt_resources/providers.rb +181 -26
  50. data/lib/azure_mgmt_resources/resource_groups.rb +461 -54
  51. data/lib/azure_mgmt_resources/resource_management_client.rb +2 -10
  52. data/lib/azure_mgmt_resources/resource_provider_operation_details.rb +73 -11
  53. data/lib/azure_mgmt_resources/resources.rb +306 -57
  54. data/lib/azure_mgmt_resources/tags.rb +207 -31
  55. data/lib/azure_mgmt_resources/version.rb +2 -2
  56. metadata +31 -29
  57. data/lib/azure_mgmt_resources/models/policy_assignment.rb +0 -72
  58. data/lib/azure_mgmt_resources/models/policy_assignment_list_result.rb +0 -86
  59. data/lib/azure_mgmt_resources/models/policy_assignment_properties.rb +0 -74
  60. data/lib/azure_mgmt_resources/models/policy_definition.rb +0 -72
  61. data/lib/azure_mgmt_resources/models/policy_definition_properties.rb +0 -74
  62. data/lib/azure_mgmt_resources/models/resource_management_error.rb +0 -76
  63. data/lib/azure_mgmt_resources/policy_assignments.rb +0 -922
  64. data/lib/azure_mgmt_resources/policy_definitions.rb +0 -208
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -30,13 +30,47 @@ module Azure::ARM::Resources
30
30
  # @param filter [String] The filter to apply on the operation.
31
31
  # @param top [Integer] Query parameters. If null is passed returns all
32
32
  # resource groups.
33
- # @param [Hash{String => String}] The hash of custom headers need to be
34
- # applied to HTTP request.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
35
  #
36
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
37
- # response.
36
+ # @return [ResourceListResult] operation results.
38
37
  #
39
38
  def list_resources(resource_group_name, filter = nil, top = nil, custom_headers = nil)
39
+ response = list_resources_async(resource_group_name, filter, top, custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Get all of the resources under a subscription.
45
+ #
46
+ # @param resource_group_name [String] Query parameters. If null is passed
47
+ # returns all resource groups.
48
+ # @param filter [String] The filter to apply on the operation.
49
+ # @param top [Integer] Query parameters. If null is passed returns all
50
+ # resource groups.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_resources_with_http_info(resource_group_name, filter = nil, top = nil, custom_headers = nil)
57
+ list_resources_async(resource_group_name, filter, top, custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Get all of the resources under a subscription.
62
+ #
63
+ # @param resource_group_name [String] Query parameters. If null is passed
64
+ # returns all resource groups.
65
+ # @param filter [String] The filter to apply on the operation.
66
+ # @param top [Integer] Query parameters. If null is passed returns all
67
+ # resource groups.
68
+ # @param [Hash{String => String}] A hash of custom headers that will be added
69
+ # to the HTTP request.
70
+ #
71
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
72
+ #
73
+ def list_resources_async(resource_group_name, filter = nil, top = nil, custom_headers = nil)
40
74
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
41
75
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
42
76
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -52,7 +86,10 @@ module Azure::ARM::Resources
52
86
  query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
53
87
  headers: request_headers.merge(custom_headers || {})
54
88
  }
55
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
56
93
  promise = request.run_promise do |req|
57
94
  @client.credentials.sign_request(req) unless @client.credentials.nil?
58
95
  end
@@ -92,13 +129,41 @@ module Azure::ARM::Resources
92
129
  #
93
130
  # @param resource_group_name [String] The name of the resource group to check.
94
131
  # The name is case insensitive.
95
- # @param [Hash{String => String}] The hash of custom headers need to be
96
- # applied to HTTP request.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
97
134
  #
98
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
99
- # response.
135
+ # @return [Boolean] operation results.
100
136
  #
101
137
  def check_existence(resource_group_name, custom_headers = nil)
138
+ response = check_existence_async(resource_group_name, custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # Checks whether resource group exists.
144
+ #
145
+ # @param resource_group_name [String] The name of the resource group to check.
146
+ # The name is case insensitive.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
151
+ #
152
+ def check_existence_with_http_info(resource_group_name, custom_headers = nil)
153
+ check_existence_async(resource_group_name, custom_headers).value!
154
+ end
155
+
156
+ #
157
+ # Checks whether resource group exists.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group to check.
160
+ # The name is case insensitive.
161
+ # @param [Hash{String => String}] A hash of custom headers that will be added
162
+ # to the HTTP request.
163
+ #
164
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
165
+ #
166
+ def check_existence_async(resource_group_name, custom_headers = nil)
102
167
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
103
168
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
104
169
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -114,7 +179,10 @@ module Azure::ARM::Resources
114
179
  query_params: {'api-version' => @client.api_version},
115
180
  headers: request_headers.merge(custom_headers || {})
116
181
  }
117
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :head, options)
182
+
183
+ request_url = @base_url || @client.base_url
184
+
185
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :head, options)
118
186
  promise = request.run_promise do |req|
119
187
  @client.credentials.sign_request(req) unless @client.credentials.nil?
120
188
  end
@@ -145,13 +213,45 @@ module Azure::ARM::Resources
145
213
  # created or updated.
146
214
  # @param parameters [ResourceGroup] Parameters supplied to the create or
147
215
  # update resource group service operation.
148
- # @param [Hash{String => String}] The hash of custom headers need to be
149
- # applied to HTTP request.
216
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
217
+ # will be added to the HTTP request.
150
218
  #
151
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
152
- # response.
219
+ # @return [ResourceGroup] operation results.
153
220
  #
154
221
  def create_or_update(resource_group_name, parameters, custom_headers = nil)
222
+ response = create_or_update_async(resource_group_name, parameters, custom_headers).value!
223
+ response.body unless response.nil?
224
+ end
225
+
226
+ #
227
+ # Create a resource group.
228
+ #
229
+ # @param resource_group_name [String] The name of the resource group to be
230
+ # created or updated.
231
+ # @param parameters [ResourceGroup] Parameters supplied to the create or
232
+ # update resource group service operation.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
237
+ #
238
+ def create_or_update_with_http_info(resource_group_name, parameters, custom_headers = nil)
239
+ create_or_update_async(resource_group_name, parameters, custom_headers).value!
240
+ end
241
+
242
+ #
243
+ # Create a resource group.
244
+ #
245
+ # @param resource_group_name [String] The name of the resource group to be
246
+ # created or updated.
247
+ # @param parameters [ResourceGroup] Parameters supplied to the create or
248
+ # update resource group service operation.
249
+ # @param [Hash{String => String}] A hash of custom headers that will be added
250
+ # to the HTTP request.
251
+ #
252
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
253
+ #
254
+ def create_or_update_async(resource_group_name, parameters, custom_headers = nil)
155
255
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
156
256
  fail ArgumentError, 'parameters is nil' if parameters.nil?
157
257
  parameters.validate unless parameters.nil?
@@ -168,7 +268,7 @@ module Azure::ARM::Resources
168
268
  unless parameters.nil?
169
269
  parameters = ResourceGroup.serialize_object(parameters)
170
270
  end
171
- request_content = JSON.generate(parameters, quirks_mode: true)
271
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
172
272
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
173
273
  options = {
174
274
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -177,7 +277,10 @@ module Azure::ARM::Resources
177
277
  body: request_content,
178
278
  headers: request_headers.merge(custom_headers || {})
179
279
  }
180
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
280
+
281
+ request_url = @base_url || @client.base_url
282
+
283
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
181
284
  promise = request.run_promise do |req|
182
285
  @client.credentials.sign_request(req) unless @client.credentials.nil?
183
286
  end
@@ -225,8 +328,7 @@ module Azure::ARM::Resources
225
328
  end
226
329
 
227
330
  #
228
- # Begin deleting resource group.To determine whether the operation has
229
- # finished processing the request, call GetLongRunningOperationStatus.
331
+ # Delete resource group.
230
332
  #
231
333
  # @param resource_group_name [String] The name of the resource group to be
232
334
  # deleted. The name is case insensitive.
@@ -235,7 +337,7 @@ module Azure::ARM::Resources
235
337
  #
236
338
  def delete(resource_group_name, custom_headers = nil)
237
339
  # Send request
238
- promise = begin_delete(resource_group_name, custom_headers)
340
+ promise = begin_delete_async(resource_group_name, custom_headers)
239
341
 
240
342
  promise = promise.then do |response|
241
343
  # Defining deserialization method.
@@ -243,25 +345,51 @@ module Azure::ARM::Resources
243
345
  end
244
346
 
245
347
  # Waiting for response.
246
- @client.get_post_or_delete_operation_result(response, deserialize_method)
348
+ @client.get_long_running_operation_result(response, deserialize_method)
247
349
  end
248
350
 
249
351
  promise
250
352
  end
251
353
 
252
354
  #
253
- # Begin deleting resource group.To determine whether the operation has
254
- # finished processing the request, call GetLongRunningOperationStatus.
355
+ # Delete resource group.
255
356
  #
256
357
  # @param resource_group_name [String] The name of the resource group to be
257
358
  # deleted. The name is case insensitive.
258
- # @param [Hash{String => String}] The hash of custom headers need to be
259
- # applied to HTTP request.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
260
361
  #
261
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
262
- # response.
263
362
  #
264
363
  def begin_delete(resource_group_name, custom_headers = nil)
364
+ response = begin_delete_async(resource_group_name, custom_headers).value!
365
+ nil
366
+ end
367
+
368
+ #
369
+ # Delete resource group.
370
+ #
371
+ # @param resource_group_name [String] The name of the resource group to be
372
+ # deleted. The name is case insensitive.
373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
374
+ # will be added to the HTTP request.
375
+ #
376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
377
+ #
378
+ def begin_delete_with_http_info(resource_group_name, custom_headers = nil)
379
+ begin_delete_async(resource_group_name, custom_headers).value!
380
+ end
381
+
382
+ #
383
+ # Delete resource group.
384
+ #
385
+ # @param resource_group_name [String] The name of the resource group to be
386
+ # deleted. The name is case insensitive.
387
+ # @param [Hash{String => String}] A hash of custom headers that will be added
388
+ # to the HTTP request.
389
+ #
390
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
391
+ #
392
+ def begin_delete_async(resource_group_name, custom_headers = nil)
265
393
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
266
394
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
267
395
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -277,7 +405,10 @@ module Azure::ARM::Resources
277
405
  query_params: {'api-version' => @client.api_version},
278
406
  headers: request_headers.merge(custom_headers || {})
279
407
  }
280
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
408
+
409
+ request_url = @base_url || @client.base_url
410
+
411
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
281
412
  promise = request.run_promise do |req|
282
413
  @client.credentials.sign_request(req) unless @client.credentials.nil?
283
414
  end
@@ -305,13 +436,41 @@ module Azure::ARM::Resources
305
436
  #
306
437
  # @param resource_group_name [String] The name of the resource group to get.
307
438
  # The name is case insensitive.
308
- # @param [Hash{String => String}] The hash of custom headers need to be
309
- # applied to HTTP request.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
310
441
  #
311
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
312
- # response.
442
+ # @return [ResourceGroup] operation results.
313
443
  #
314
444
  def get(resource_group_name, custom_headers = nil)
445
+ response = get_async(resource_group_name, custom_headers).value!
446
+ response.body unless response.nil?
447
+ end
448
+
449
+ #
450
+ # Get a resource group.
451
+ #
452
+ # @param resource_group_name [String] The name of the resource group to get.
453
+ # The name is case insensitive.
454
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
455
+ # will be added to the HTTP request.
456
+ #
457
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
458
+ #
459
+ def get_with_http_info(resource_group_name, custom_headers = nil)
460
+ get_async(resource_group_name, custom_headers).value!
461
+ end
462
+
463
+ #
464
+ # Get a resource group.
465
+ #
466
+ # @param resource_group_name [String] The name of the resource group to get.
467
+ # The name is case insensitive.
468
+ # @param [Hash{String => String}] A hash of custom headers that will be added
469
+ # to the HTTP request.
470
+ #
471
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
472
+ #
473
+ def get_async(resource_group_name, custom_headers = nil)
315
474
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
316
475
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
317
476
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -327,7 +486,10 @@ module Azure::ARM::Resources
327
486
  query_params: {'api-version' => @client.api_version},
328
487
  headers: request_headers.merge(custom_headers || {})
329
488
  }
330
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
489
+
490
+ request_url = @base_url || @client.base_url
491
+
492
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
331
493
  promise = request.run_promise do |req|
332
494
  @client.credentials.sign_request(req) unless @client.credentials.nil?
333
495
  end
@@ -372,13 +534,51 @@ module Azure::ARM::Resources
372
534
  # created or updated. The name is case insensitive.
373
535
  # @param parameters [ResourceGroup] Parameters supplied to the update state
374
536
  # resource group service operation.
375
- # @param [Hash{String => String}] The hash of custom headers need to be
376
- # applied to HTTP request.
537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
538
+ # will be added to the HTTP request.
377
539
  #
378
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
379
- # response.
540
+ # @return [ResourceGroup] operation results.
380
541
  #
381
542
  def patch(resource_group_name, parameters, custom_headers = nil)
543
+ response = patch_async(resource_group_name, parameters, custom_headers).value!
544
+ response.body unless response.nil?
545
+ end
546
+
547
+ #
548
+ # Resource groups can be updated through a simple PATCH operation to a group
549
+ # address. The format of the request is the same as that for creating a
550
+ # resource groups, though if a field is unspecified current value will be
551
+ # carried over.
552
+ #
553
+ # @param resource_group_name [String] The name of the resource group to be
554
+ # created or updated. The name is case insensitive.
555
+ # @param parameters [ResourceGroup] Parameters supplied to the update state
556
+ # resource group service operation.
557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
558
+ # will be added to the HTTP request.
559
+ #
560
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
561
+ #
562
+ def patch_with_http_info(resource_group_name, parameters, custom_headers = nil)
563
+ patch_async(resource_group_name, parameters, custom_headers).value!
564
+ end
565
+
566
+ #
567
+ # Resource groups can be updated through a simple PATCH operation to a group
568
+ # address. The format of the request is the same as that for creating a
569
+ # resource groups, though if a field is unspecified current value will be
570
+ # carried over.
571
+ #
572
+ # @param resource_group_name [String] The name of the resource group to be
573
+ # created or updated. The name is case insensitive.
574
+ # @param parameters [ResourceGroup] Parameters supplied to the update state
575
+ # resource group service operation.
576
+ # @param [Hash{String => String}] A hash of custom headers that will be added
577
+ # to the HTTP request.
578
+ #
579
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
580
+ #
581
+ def patch_async(resource_group_name, parameters, custom_headers = nil)
382
582
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
383
583
  fail ArgumentError, 'parameters is nil' if parameters.nil?
384
584
  parameters.validate unless parameters.nil?
@@ -395,7 +595,7 @@ module Azure::ARM::Resources
395
595
  unless parameters.nil?
396
596
  parameters = ResourceGroup.serialize_object(parameters)
397
597
  end
398
- request_content = JSON.generate(parameters, quirks_mode: true)
598
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
399
599
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
400
600
  options = {
401
601
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -404,7 +604,10 @@ module Azure::ARM::Resources
404
604
  body: request_content,
405
605
  headers: request_headers.merge(custom_headers || {})
406
606
  }
407
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
607
+
608
+ request_url = @base_url || @client.base_url
609
+
610
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
408
611
  promise = request.run_promise do |req|
409
612
  @client.credentials.sign_request(req) unless @client.credentials.nil?
410
613
  end
@@ -439,19 +642,158 @@ module Azure::ARM::Resources
439
642
  promise.execute
440
643
  end
441
644
 
645
+ #
646
+ # Captures the specified resource group as a template.
647
+ #
648
+ # @param resource_group_name [String] The name of the resource group to be
649
+ # created or updated.
650
+ # @param parameters [ExportTemplateRequest] Parameters supplied to the export
651
+ # template resource group operation.
652
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
653
+ # will be added to the HTTP request.
654
+ #
655
+ # @return [ResourceGroupExportResult] operation results.
656
+ #
657
+ def export_template(resource_group_name, parameters, custom_headers = nil)
658
+ response = export_template_async(resource_group_name, parameters, custom_headers).value!
659
+ response.body unless response.nil?
660
+ end
661
+
662
+ #
663
+ # Captures the specified resource group as a template.
664
+ #
665
+ # @param resource_group_name [String] The name of the resource group to be
666
+ # created or updated.
667
+ # @param parameters [ExportTemplateRequest] Parameters supplied to the export
668
+ # template resource group operation.
669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
670
+ # will be added to the HTTP request.
671
+ #
672
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
673
+ #
674
+ def export_template_with_http_info(resource_group_name, parameters, custom_headers = nil)
675
+ export_template_async(resource_group_name, parameters, custom_headers).value!
676
+ end
677
+
678
+ #
679
+ # Captures the specified resource group as a template.
680
+ #
681
+ # @param resource_group_name [String] The name of the resource group to be
682
+ # created or updated.
683
+ # @param parameters [ExportTemplateRequest] Parameters supplied to the export
684
+ # template resource group operation.
685
+ # @param [Hash{String => String}] A hash of custom headers that will be added
686
+ # to the HTTP request.
687
+ #
688
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
689
+ #
690
+ def export_template_async(resource_group_name, parameters, custom_headers = nil)
691
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
692
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
693
+ parameters.validate unless parameters.nil?
694
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
695
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
696
+ request_headers = {}
697
+
698
+ # Set Headers
699
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
700
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
701
+
702
+ # Serialize Request
703
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
704
+ unless parameters.nil?
705
+ parameters = ExportTemplateRequest.serialize_object(parameters)
706
+ end
707
+ request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil
708
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'
709
+ options = {
710
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
711
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
712
+ query_params: {'api-version' => @client.api_version},
713
+ body: request_content,
714
+ headers: request_headers.merge(custom_headers || {})
715
+ }
716
+
717
+ request_url = @base_url || @client.base_url
718
+
719
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
720
+ promise = request.run_promise do |req|
721
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
722
+ end
723
+
724
+ promise = promise.then do |http_response|
725
+ status_code = http_response.status
726
+ response_content = http_response.body
727
+ unless status_code == 200
728
+ error_model = JSON.load(response_content)
729
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
730
+ end
731
+
732
+ # Create Result
733
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
734
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
735
+ # Deserialize Response
736
+ if status_code == 200
737
+ begin
738
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
739
+ unless parsed_response.nil?
740
+ parsed_response = ResourceGroupExportResult.deserialize_object(parsed_response)
741
+ end
742
+ result.body = parsed_response
743
+ rescue Exception => e
744
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
745
+ end
746
+ end
747
+
748
+ result
749
+ end
750
+
751
+ promise.execute
752
+ end
753
+
442
754
  #
443
755
  # Gets a collection of resource groups.
444
756
  #
445
757
  # @param filter [String] The filter to apply on the operation.
446
758
  # @param top [Integer] Query parameters. If null is passed returns all
447
759
  # resource groups.
448
- # @param [Hash{String => String}] The hash of custom headers need to be
449
- # applied to HTTP request.
760
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
761
+ # will be added to the HTTP request.
450
762
  #
451
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
452
- # response.
763
+ # @return [ResourceGroupListResult] operation results.
453
764
  #
454
765
  def list(filter = nil, top = nil, custom_headers = nil)
766
+ response = list_async(filter, top, custom_headers).value!
767
+ response.body unless response.nil?
768
+ end
769
+
770
+ #
771
+ # Gets a collection of resource groups.
772
+ #
773
+ # @param filter [String] The filter to apply on the operation.
774
+ # @param top [Integer] Query parameters. If null is passed returns all
775
+ # resource groups.
776
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
777
+ # will be added to the HTTP request.
778
+ #
779
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
780
+ #
781
+ def list_with_http_info(filter = nil, top = nil, custom_headers = nil)
782
+ list_async(filter, top, custom_headers).value!
783
+ end
784
+
785
+ #
786
+ # Gets a collection of resource groups.
787
+ #
788
+ # @param filter [String] The filter to apply on the operation.
789
+ # @param top [Integer] Query parameters. If null is passed returns all
790
+ # resource groups.
791
+ # @param [Hash{String => String}] A hash of custom headers that will be added
792
+ # to the HTTP request.
793
+ #
794
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
795
+ #
796
+ def list_async(filter = nil, top = nil, custom_headers = nil)
455
797
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
456
798
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
457
799
  request_headers = {}
@@ -466,7 +808,10 @@ module Azure::ARM::Resources
466
808
  query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
467
809
  headers: request_headers.merge(custom_headers || {})
468
810
  }
469
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
811
+
812
+ request_url = @base_url || @client.base_url
813
+
814
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
470
815
  promise = request.run_promise do |req|
471
816
  @client.credentials.sign_request(req) unless @client.credentials.nil?
472
817
  end
@@ -506,13 +851,41 @@ module Azure::ARM::Resources
506
851
  #
507
852
  # @param next_page_link [String] The NextLink from the previous successful
508
853
  # call to List operation.
509
- # @param [Hash{String => String}] The hash of custom headers need to be
510
- # applied to HTTP request.
854
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
855
+ # will be added to the HTTP request.
511
856
  #
512
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
513
- # response.
857
+ # @return [ResourceListResult] operation results.
514
858
  #
515
859
  def list_resources_next(next_page_link, custom_headers = nil)
860
+ response = list_resources_next_async(next_page_link, custom_headers).value!
861
+ response.body unless response.nil?
862
+ end
863
+
864
+ #
865
+ # Get all of the resources under a subscription.
866
+ #
867
+ # @param next_page_link [String] The NextLink from the previous successful
868
+ # call to List operation.
869
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
870
+ # will be added to the HTTP request.
871
+ #
872
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
873
+ #
874
+ def list_resources_next_with_http_info(next_page_link, custom_headers = nil)
875
+ list_resources_next_async(next_page_link, custom_headers).value!
876
+ end
877
+
878
+ #
879
+ # Get all of the resources under a subscription.
880
+ #
881
+ # @param next_page_link [String] The NextLink from the previous successful
882
+ # call to List operation.
883
+ # @param [Hash{String => String}] A hash of custom headers that will be added
884
+ # to the HTTP request.
885
+ #
886
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
887
+ #
888
+ def list_resources_next_async(next_page_link, custom_headers = nil)
516
889
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
517
890
  request_headers = {}
518
891
 
@@ -525,7 +898,10 @@ module Azure::ARM::Resources
525
898
  skip_encoding_path_params: {'nextLink' => next_page_link},
526
899
  headers: request_headers.merge(custom_headers || {})
527
900
  }
528
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
901
+
902
+ request_url = @base_url || @client.base_url
903
+
904
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
529
905
  promise = request.run_promise do |req|
530
906
  @client.credentials.sign_request(req) unless @client.credentials.nil?
531
907
  end
@@ -565,13 +941,41 @@ module Azure::ARM::Resources
565
941
  #
566
942
  # @param next_page_link [String] The NextLink from the previous successful
567
943
  # call to List operation.
568
- # @param [Hash{String => String}] The hash of custom headers need to be
569
- # applied to HTTP request.
944
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
945
+ # will be added to the HTTP request.
570
946
  #
571
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
572
- # response.
947
+ # @return [ResourceGroupListResult] operation results.
573
948
  #
574
949
  def list_next(next_page_link, custom_headers = nil)
950
+ response = list_next_async(next_page_link, custom_headers).value!
951
+ response.body unless response.nil?
952
+ end
953
+
954
+ #
955
+ # Gets a collection of resource groups.
956
+ #
957
+ # @param next_page_link [String] The NextLink from the previous successful
958
+ # call to List operation.
959
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
960
+ # will be added to the HTTP request.
961
+ #
962
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
963
+ #
964
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
965
+ list_next_async(next_page_link, custom_headers).value!
966
+ end
967
+
968
+ #
969
+ # Gets a collection of resource groups.
970
+ #
971
+ # @param next_page_link [String] The NextLink from the previous successful
972
+ # call to List operation.
973
+ # @param [Hash{String => String}] A hash of custom headers that will be added
974
+ # to the HTTP request.
975
+ #
976
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
977
+ #
978
+ def list_next_async(next_page_link, custom_headers = nil)
575
979
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
576
980
  request_headers = {}
577
981
 
@@ -584,7 +988,10 @@ module Azure::ARM::Resources
584
988
  skip_encoding_path_params: {'nextLink' => next_page_link},
585
989
  headers: request_headers.merge(custom_headers || {})
586
990
  }
587
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
991
+
992
+ request_url = @base_url || @client.base_url
993
+
994
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
588
995
  promise = request.run_promise do |req|
589
996
  @client.credentials.sign_request(req) unless @client.credentials.nil?
590
997
  end