azure_mgmt_resources 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,10 +36,6 @@ module Azure::ARM::Resources
36
36
  # is generated and included in each request. Default is true.
37
37
  attr_accessor :generate_client_request_id
38
38
 
39
- # @return Subscription credentials which uniquely identify client
40
- # subscription.
41
- attr_accessor :credentials
42
-
43
39
  # @return [Deployments] deployments
44
40
  attr_reader :deployments
45
41
 
@@ -84,5 +80,60 @@ module Azure::ARM::Resources
84
80
  @generate_client_request_id = true
85
81
  end
86
82
 
83
+ #
84
+ # Makes a request and returns the body of the response.
85
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
86
+ # @param path [String] the path, relative to {base_url}.
87
+ # @param options [Hash{String=>String}] specifying any request options like :body.
88
+ # @return [Hash{String=>String}] containing the body of the response.
89
+ # Example:
90
+ #
91
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
92
+ # path = "/path"
93
+ # options = {
94
+ # body: request_content,
95
+ # query_params: {'api-version' => '2016-02-01'}
96
+ # }
97
+ # result = @client.make_request(:put, path, options)
98
+ #
99
+ def make_request(method, path, options = {})
100
+ result = make_request_with_http_info(method, path, options)
101
+ result.body unless result.nil?
102
+ end
103
+
104
+ #
105
+ # Makes a request and returns the operation response.
106
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
107
+ # @param path [String] the path, relative to {base_url}.
108
+ # @param options [Hash{String=>String}] specifying any request options like :body.
109
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
110
+ #
111
+ def make_request_with_http_info(method, path, options = {})
112
+ result = make_request_async(method, path, options).value!
113
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
114
+ result
115
+ end
116
+
117
+ #
118
+ # Makes a request asynchronously.
119
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
120
+ # @param path [String] the path, relative to {base_url}.
121
+ # @param options [Hash{String=>String}] specifying any request options like :body.
122
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
123
+ #
124
+ def make_request_async(method, path, options = {})
125
+ fail ArgumentError, 'method is nil' if method.nil?
126
+ fail ArgumentError, 'path is nil' if path.nil?
127
+
128
+ request_url = options[:base_url] || @base_url
129
+
130
+ request_headers = @request_headers
131
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
132
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
133
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
134
+
135
+ super(request_url, method, path, options)
136
+ end
137
+
87
138
  end
88
139
  end
@@ -123,31 +123,28 @@ module Azure::ARM::Resources
123
123
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
124
124
 
125
125
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'
126
+
127
+ request_url = @base_url || @client.base_url
128
+
126
129
  options = {
127
130
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
128
131
  path_params: {'sourceResourceGroupName' => source_resource_group_name,'subscriptionId' => @client.subscription_id},
129
132
  query_params: {'api-version' => @client.api_version},
130
133
  body: request_content,
131
- headers: request_headers.merge(custom_headers || {})
134
+ headers: request_headers.merge(custom_headers || {}),
135
+ base_url: request_url
132
136
  }
137
+ promise = @client.make_request_async(:post, path_template, options)
133
138
 
134
- request_url = @base_url || @client.base_url
135
-
136
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
137
- promise = request.run_promise do |req|
138
- @client.credentials.sign_request(req) unless @client.credentials.nil?
139
- end
140
-
141
- promise = promise.then do |http_response|
139
+ promise = promise.then do |result|
140
+ http_response = result.response
142
141
  status_code = http_response.status
143
142
  response_content = http_response.body
144
143
  unless status_code == 202 || status_code == 204
145
144
  error_model = JSON.load(response_content)
146
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
145
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
147
146
  end
148
147
 
149
- # Create Result
150
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
151
148
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
152
149
 
153
150
  result
@@ -173,8 +170,8 @@ module Azure::ARM::Resources
173
170
  response = list_async(filter, expand, top, custom_headers).value!
174
171
  unless response.nil?
175
172
  page = response.body
176
- page.next_method = Proc.new do |next_link|
177
- list_next_async(next_link, custom_headers)
173
+ page.next_method = Proc.new do |next_page_link|
174
+ list_next_async(next_page_link, custom_headers)
178
175
  end
179
176
  page
180
177
  end
@@ -236,30 +233,27 @@ module Azure::ARM::Resources
236
233
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
237
234
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
238
235
  path_template = '/subscriptions/{subscriptionId}/resources'
236
+
237
+ request_url = @base_url || @client.base_url
238
+
239
239
  options = {
240
240
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
241
241
  path_params: {'subscriptionId' => @client.subscription_id},
242
242
  query_params: {'$filter' => filter,'$expand' => expand,'$top' => top,'api-version' => @client.api_version},
243
- headers: request_headers.merge(custom_headers || {})
243
+ headers: request_headers.merge(custom_headers || {}),
244
+ base_url: request_url
244
245
  }
246
+ promise = @client.make_request_async(:get, path_template, options)
245
247
 
246
- request_url = @base_url || @client.base_url
247
-
248
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
249
- promise = request.run_promise do |req|
250
- @client.credentials.sign_request(req) unless @client.credentials.nil?
251
- end
252
-
253
- promise = promise.then do |http_response|
248
+ promise = promise.then do |result|
249
+ http_response = result.response
254
250
  status_code = http_response.status
255
251
  response_content = http_response.body
256
252
  unless status_code == 200
257
253
  error_model = JSON.load(response_content)
258
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
254
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
259
255
  end
260
256
 
261
- # Create Result
262
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
263
257
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
264
258
  # Deserialize Response
265
259
  if status_code == 200
@@ -348,31 +342,28 @@ module Azure::ARM::Resources
348
342
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
349
343
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
350
344
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
345
+
346
+ request_url = @base_url || @client.base_url
347
+
351
348
  options = {
352
349
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
353
350
  path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
354
351
  skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
355
352
  query_params: {'api-version' => api_version},
356
- headers: request_headers.merge(custom_headers || {})
353
+ headers: request_headers.merge(custom_headers || {}),
354
+ base_url: request_url
357
355
  }
356
+ promise = @client.make_request_async(:head, path_template, options)
358
357
 
359
- request_url = @base_url || @client.base_url
360
-
361
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :head, options)
362
- promise = request.run_promise do |req|
363
- @client.credentials.sign_request(req) unless @client.credentials.nil?
364
- end
365
-
366
- promise = promise.then do |http_response|
358
+ promise = promise.then do |result|
359
+ http_response = result.response
367
360
  status_code = http_response.status
368
361
  response_content = http_response.body
369
362
  unless status_code == 204 || status_code == 404
370
363
  error_model = JSON.load(response_content)
371
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
364
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
372
365
  end
373
366
 
374
- # Create Result
375
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
376
367
  result.body = (status_code == 204)
377
368
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
369
 
@@ -451,31 +442,28 @@ module Azure::ARM::Resources
451
442
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
452
443
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
453
444
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
445
+
446
+ request_url = @base_url || @client.base_url
447
+
454
448
  options = {
455
449
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
456
450
  path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
457
451
  skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
458
452
  query_params: {'api-version' => api_version},
459
- headers: request_headers.merge(custom_headers || {})
453
+ headers: request_headers.merge(custom_headers || {}),
454
+ base_url: request_url
460
455
  }
456
+ promise = @client.make_request_async(:delete, path_template, options)
461
457
 
462
- request_url = @base_url || @client.base_url
463
-
464
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
465
- promise = request.run_promise do |req|
466
- @client.credentials.sign_request(req) unless @client.credentials.nil?
467
- end
468
-
469
- promise = promise.then do |http_response|
458
+ promise = promise.then do |result|
459
+ http_response = result.response
470
460
  status_code = http_response.status
471
461
  response_content = http_response.body
472
462
  unless status_code == 200 || status_code == 204 || status_code == 202
473
463
  error_model = JSON.load(response_content)
474
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
464
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
475
465
  end
476
466
 
477
- # Create Result
478
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
479
467
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
480
468
 
481
469
  result
@@ -566,32 +554,29 @@ module Azure::ARM::Resources
566
554
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
567
555
 
568
556
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
557
+
558
+ request_url = @base_url || @client.base_url
559
+
569
560
  options = {
570
561
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
571
562
  path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
572
563
  skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
573
564
  query_params: {'api-version' => api_version},
574
565
  body: request_content,
575
- headers: request_headers.merge(custom_headers || {})
566
+ headers: request_headers.merge(custom_headers || {}),
567
+ base_url: request_url
576
568
  }
569
+ promise = @client.make_request_async(:put, path_template, options)
577
570
 
578
- request_url = @base_url || @client.base_url
579
-
580
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
581
- promise = request.run_promise do |req|
582
- @client.credentials.sign_request(req) unless @client.credentials.nil?
583
- end
584
-
585
- promise = promise.then do |http_response|
571
+ promise = promise.then do |result|
572
+ http_response = result.response
586
573
  status_code = http_response.status
587
574
  response_content = http_response.body
588
575
  unless status_code == 201 || status_code == 200
589
576
  error_model = JSON.load(response_content)
590
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
577
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
591
578
  end
592
579
 
593
- # Create Result
594
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
595
580
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
596
581
  # Deserialize Response
597
582
  if status_code == 201
@@ -690,31 +675,28 @@ module Azure::ARM::Resources
690
675
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
691
676
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
692
677
  path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'
678
+
679
+ request_url = @base_url || @client.base_url
680
+
693
681
  options = {
694
682
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
695
683
  path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
696
684
  skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
697
685
  query_params: {'api-version' => api_version},
698
- headers: request_headers.merge(custom_headers || {})
686
+ headers: request_headers.merge(custom_headers || {}),
687
+ base_url: request_url
699
688
  }
689
+ promise = @client.make_request_async(:get, path_template, options)
700
690
 
701
- request_url = @base_url || @client.base_url
702
-
703
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
704
- promise = request.run_promise do |req|
705
- @client.credentials.sign_request(req) unless @client.credentials.nil?
706
- end
707
-
708
- promise = promise.then do |http_response|
691
+ promise = promise.then do |result|
692
+ http_response = result.response
709
693
  status_code = http_response.status
710
694
  response_content = http_response.body
711
695
  unless status_code == 200
712
696
  error_model = JSON.load(response_content)
713
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
697
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
714
698
  end
715
699
 
716
- # Create Result
717
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
718
700
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
719
701
  # Deserialize Response
720
702
  if status_code == 200
@@ -782,29 +764,26 @@ module Azure::ARM::Resources
782
764
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
783
765
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
784
766
  path_template = '{nextLink}'
767
+
768
+ request_url = @base_url || @client.base_url
769
+
785
770
  options = {
786
771
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
787
772
  skip_encoding_path_params: {'nextLink' => next_page_link},
788
- headers: request_headers.merge(custom_headers || {})
773
+ headers: request_headers.merge(custom_headers || {}),
774
+ base_url: request_url
789
775
  }
776
+ promise = @client.make_request_async(:get, path_template, options)
790
777
 
791
- request_url = @base_url || @client.base_url
792
-
793
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
794
- promise = request.run_promise do |req|
795
- @client.credentials.sign_request(req) unless @client.credentials.nil?
796
- end
797
-
798
- promise = promise.then do |http_response|
778
+ promise = promise.then do |result|
779
+ http_response = result.response
799
780
  status_code = http_response.status
800
781
  response_content = http_response.body
801
782
  unless status_code == 200
802
783
  error_model = JSON.load(response_content)
803
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
784
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
804
785
  end
805
786
 
806
- # Create Result
807
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
808
787
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
809
788
  # Deserialize Response
810
789
  if status_code == 200
@@ -73,30 +73,27 @@ module Azure::ARM::Resources
73
73
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
74
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
75
  path_template = '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
76
79
  options = {
77
80
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
81
  path_params: {'tagName' => tag_name,'tagValue' => tag_value,'subscriptionId' => @client.subscription_id},
79
82
  query_params: {'api-version' => @client.api_version},
80
- headers: request_headers.merge(custom_headers || {})
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
81
85
  }
86
+ promise = @client.make_request_async(:delete, path_template, options)
82
87
 
83
- request_url = @base_url || @client.base_url
84
-
85
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
86
- promise = request.run_promise do |req|
87
- @client.credentials.sign_request(req) unless @client.credentials.nil?
88
- end
89
-
90
- promise = promise.then do |http_response|
88
+ promise = promise.then do |result|
89
+ http_response = result.response
91
90
  status_code = http_response.status
92
91
  response_content = http_response.body
93
92
  unless status_code == 200 || status_code == 204
94
93
  error_model = JSON.load(response_content)
95
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
94
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
96
95
  end
97
96
 
98
- # Create Result
99
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
100
97
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
98
 
102
99
  result
@@ -157,30 +154,27 @@ module Azure::ARM::Resources
157
154
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
158
155
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
159
156
  path_template = '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'
157
+
158
+ request_url = @base_url || @client.base_url
159
+
160
160
  options = {
161
161
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
162
162
  path_params: {'tagName' => tag_name,'tagValue' => tag_value,'subscriptionId' => @client.subscription_id},
163
163
  query_params: {'api-version' => @client.api_version},
164
- headers: request_headers.merge(custom_headers || {})
164
+ headers: request_headers.merge(custom_headers || {}),
165
+ base_url: request_url
165
166
  }
167
+ promise = @client.make_request_async(:put, path_template, options)
166
168
 
167
- request_url = @base_url || @client.base_url
168
-
169
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
170
- promise = request.run_promise do |req|
171
- @client.credentials.sign_request(req) unless @client.credentials.nil?
172
- end
173
-
174
- promise = promise.then do |http_response|
169
+ promise = promise.then do |result|
170
+ http_response = result.response
175
171
  status_code = http_response.status
176
172
  response_content = http_response.body
177
173
  unless status_code == 200 || status_code == 201
178
174
  error_model = JSON.load(response_content)
179
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
175
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
180
176
  end
181
177
 
182
- # Create Result
183
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
184
178
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
185
179
  # Deserialize Response
186
180
  if status_code == 200
@@ -257,30 +251,27 @@ module Azure::ARM::Resources
257
251
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
258
252
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
259
253
  path_template = '/subscriptions/{subscriptionId}/tagNames/{tagName}'
254
+
255
+ request_url = @base_url || @client.base_url
256
+
260
257
  options = {
261
258
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
262
259
  path_params: {'tagName' => tag_name,'subscriptionId' => @client.subscription_id},
263
260
  query_params: {'api-version' => @client.api_version},
264
- headers: request_headers.merge(custom_headers || {})
261
+ headers: request_headers.merge(custom_headers || {}),
262
+ base_url: request_url
265
263
  }
264
+ promise = @client.make_request_async(:put, path_template, options)
266
265
 
267
- request_url = @base_url || @client.base_url
268
-
269
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
270
- promise = request.run_promise do |req|
271
- @client.credentials.sign_request(req) unless @client.credentials.nil?
272
- end
273
-
274
- promise = promise.then do |http_response|
266
+ promise = promise.then do |result|
267
+ http_response = result.response
275
268
  status_code = http_response.status
276
269
  response_content = http_response.body
277
270
  unless status_code == 200 || status_code == 201
278
271
  error_model = JSON.load(response_content)
279
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
272
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
280
273
  end
281
274
 
282
- # Create Result
283
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
284
275
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
285
276
  # Deserialize Response
286
277
  if status_code == 200
@@ -356,30 +347,27 @@ module Azure::ARM::Resources
356
347
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
357
348
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
358
349
  path_template = '/subscriptions/{subscriptionId}/tagNames/{tagName}'
350
+
351
+ request_url = @base_url || @client.base_url
352
+
359
353
  options = {
360
354
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
355
  path_params: {'tagName' => tag_name,'subscriptionId' => @client.subscription_id},
362
356
  query_params: {'api-version' => @client.api_version},
363
- headers: request_headers.merge(custom_headers || {})
357
+ headers: request_headers.merge(custom_headers || {}),
358
+ base_url: request_url
364
359
  }
360
+ promise = @client.make_request_async(:delete, path_template, options)
365
361
 
366
- request_url = @base_url || @client.base_url
367
-
368
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
369
- promise = request.run_promise do |req|
370
- @client.credentials.sign_request(req) unless @client.credentials.nil?
371
- end
372
-
373
- promise = promise.then do |http_response|
362
+ promise = promise.then do |result|
363
+ http_response = result.response
374
364
  status_code = http_response.status
375
365
  response_content = http_response.body
376
366
  unless status_code == 200 || status_code == 204
377
367
  error_model = JSON.load(response_content)
378
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
368
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
379
369
  end
380
370
 
381
- # Create Result
382
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
383
371
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
384
372
 
385
373
  result
@@ -400,8 +388,8 @@ module Azure::ARM::Resources
400
388
  response = list_async(custom_headers).value!
401
389
  unless response.nil?
402
390
  page = response.body
403
- page.next_method = Proc.new do |next_link|
404
- list_next_async(next_link, custom_headers)
391
+ page.next_method = Proc.new do |next_page_link|
392
+ list_next_async(next_page_link, custom_headers)
405
393
  end
406
394
  page
407
395
  end
@@ -451,30 +439,27 @@ module Azure::ARM::Resources
451
439
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
452
440
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
453
441
  path_template = '/subscriptions/{subscriptionId}/tagNames'
442
+
443
+ request_url = @base_url || @client.base_url
444
+
454
445
  options = {
455
446
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
456
447
  path_params: {'subscriptionId' => @client.subscription_id},
457
448
  query_params: {'api-version' => @client.api_version},
458
- headers: request_headers.merge(custom_headers || {})
449
+ headers: request_headers.merge(custom_headers || {}),
450
+ base_url: request_url
459
451
  }
452
+ promise = @client.make_request_async(:get, path_template, options)
460
453
 
461
- request_url = @base_url || @client.base_url
462
-
463
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
464
- promise = request.run_promise do |req|
465
- @client.credentials.sign_request(req) unless @client.credentials.nil?
466
- end
467
-
468
- promise = promise.then do |http_response|
454
+ promise = promise.then do |result|
455
+ http_response = result.response
469
456
  status_code = http_response.status
470
457
  response_content = http_response.body
471
458
  unless status_code == 200
472
459
  error_model = JSON.load(response_content)
473
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
460
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
474
461
  end
475
462
 
476
- # Create Result
477
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
478
463
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
479
464
  # Deserialize Response
480
465
  if status_code == 200
@@ -542,29 +527,26 @@ module Azure::ARM::Resources
542
527
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
543
528
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
544
529
  path_template = '{nextLink}'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
545
533
  options = {
546
534
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
547
535
  skip_encoding_path_params: {'nextLink' => next_page_link},
548
- headers: request_headers.merge(custom_headers || {})
536
+ headers: request_headers.merge(custom_headers || {}),
537
+ base_url: request_url
549
538
  }
539
+ promise = @client.make_request_async(:get, path_template, options)
550
540
 
551
- request_url = @base_url || @client.base_url
552
-
553
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
554
- promise = request.run_promise do |req|
555
- @client.credentials.sign_request(req) unless @client.credentials.nil?
556
- end
557
-
558
- promise = promise.then do |http_response|
541
+ promise = promise.then do |result|
542
+ http_response = result.response
559
543
  status_code = http_response.status
560
544
  response_content = http_response.body
561
545
  unless status_code == 200
562
546
  error_model = JSON.load(response_content)
563
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
547
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
564
548
  end
565
549
 
566
- # Create Result
567
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
568
550
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
569
551
  # Deserialize Response
570
552
  if status_code == 200