azure_mgmt_web 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,8 +42,8 @@ module Azure::ARM::Web
42
42
  response = get_get_top_level_domains_async(custom_headers).value!
43
43
  unless response.nil?
44
44
  page = response.body
45
- page.next_method = Proc.new do |next_link|
46
- get_get_top_level_domains_next_async(next_link, custom_headers)
45
+ page.next_method = Proc.new do |next_page_link|
46
+ get_get_top_level_domains_next_async(next_page_link, custom_headers)
47
47
  end
48
48
  page
49
49
  end
@@ -93,30 +93,27 @@ module Azure::ARM::Web
93
93
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
94
94
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
95
95
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains'
96
+
97
+ request_url = @base_url || @client.base_url
98
+
96
99
  options = {
97
100
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
101
  path_params: {'subscriptionId' => @client.subscription_id},
99
102
  query_params: {'api-version' => @client.api_version},
100
- headers: request_headers.merge(custom_headers || {})
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
101
105
  }
106
+ promise = @client.make_request_async(:get, path_template, options)
102
107
 
103
- request_url = @base_url || @client.base_url
104
-
105
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
106
- promise = request.run_promise do |req|
107
- @client.credentials.sign_request(req) unless @client.credentials.nil?
108
- end
109
-
110
- promise = promise.then do |http_response|
108
+ promise = promise.then do |result|
109
+ http_response = result.response
111
110
  status_code = http_response.status
112
111
  response_content = http_response.body
113
112
  unless status_code == 200
114
113
  error_model = JSON.load(response_content)
115
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
114
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
116
115
  end
117
116
 
118
- # Create Result
119
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
120
117
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
121
118
  # Deserialize Response
122
119
  if status_code == 200
@@ -183,30 +180,27 @@ module Azure::ARM::Web
183
180
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
184
181
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
185
182
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}'
183
+
184
+ request_url = @base_url || @client.base_url
185
+
186
186
  options = {
187
187
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
188
188
  path_params: {'name' => name,'subscriptionId' => @client.subscription_id},
189
189
  query_params: {'api-version' => @client.api_version},
190
- headers: request_headers.merge(custom_headers || {})
190
+ headers: request_headers.merge(custom_headers || {}),
191
+ base_url: request_url
191
192
  }
193
+ promise = @client.make_request_async(:get, path_template, options)
192
194
 
193
- request_url = @base_url || @client.base_url
194
-
195
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
196
- promise = request.run_promise do |req|
197
- @client.credentials.sign_request(req) unless @client.credentials.nil?
198
- end
199
-
200
- promise = promise.then do |http_response|
195
+ promise = promise.then do |result|
196
+ http_response = result.response
201
197
  status_code = http_response.status
202
198
  response_content = http_response.body
203
199
  unless status_code == 200
204
200
  error_model = JSON.load(response_content)
205
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
201
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
206
202
  end
207
203
 
208
- # Create Result
209
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
210
204
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
211
205
  # Deserialize Response
212
206
  if status_code == 200
@@ -241,8 +235,8 @@ module Azure::ARM::Web
241
235
  response = list_top_level_domain_agreements_async(name, agreement_option, custom_headers).value!
242
236
  unless response.nil?
243
237
  page = response.body
244
- page.next_method = Proc.new do |next_link|
245
- list_top_level_domain_agreements_next_async(next_link, custom_headers)
238
+ page.next_method = Proc.new do |next_page_link|
239
+ list_top_level_domain_agreements_next_async(next_page_link, custom_headers)
246
240
  end
247
241
  page
248
242
  end
@@ -311,31 +305,28 @@ module Azure::ARM::Web
311
305
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
312
306
 
313
307
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements'
308
+
309
+ request_url = @base_url || @client.base_url
310
+
314
311
  options = {
315
312
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
316
313
  path_params: {'name' => name,'subscriptionId' => @client.subscription_id},
317
314
  query_params: {'api-version' => @client.api_version},
318
315
  body: request_content,
319
- headers: request_headers.merge(custom_headers || {})
316
+ headers: request_headers.merge(custom_headers || {}),
317
+ base_url: request_url
320
318
  }
319
+ promise = @client.make_request_async(:post, path_template, options)
321
320
 
322
- request_url = @base_url || @client.base_url
323
-
324
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
325
- promise = request.run_promise do |req|
326
- @client.credentials.sign_request(req) unless @client.credentials.nil?
327
- end
328
-
329
- promise = promise.then do |http_response|
321
+ promise = promise.then do |result|
322
+ http_response = result.response
330
323
  status_code = http_response.status
331
324
  response_content = http_response.body
332
325
  unless status_code == 200
333
326
  error_model = JSON.load(response_content)
334
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
327
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
335
328
  end
336
329
 
337
- # Create Result
338
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
339
330
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
340
331
  # Deserialize Response
341
332
  if status_code == 200
@@ -403,29 +394,26 @@ module Azure::ARM::Web
403
394
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
404
395
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
405
396
  path_template = '{nextLink}'
397
+
398
+ request_url = @base_url || @client.base_url
399
+
406
400
  options = {
407
401
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
408
402
  skip_encoding_path_params: {'nextLink' => next_page_link},
409
- headers: request_headers.merge(custom_headers || {})
403
+ headers: request_headers.merge(custom_headers || {}),
404
+ base_url: request_url
410
405
  }
406
+ promise = @client.make_request_async(:get, path_template, options)
411
407
 
412
- request_url = @base_url || @client.base_url
413
-
414
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
415
- promise = request.run_promise do |req|
416
- @client.credentials.sign_request(req) unless @client.credentials.nil?
417
- end
418
-
419
- promise = promise.then do |http_response|
408
+ promise = promise.then do |result|
409
+ http_response = result.response
420
410
  status_code = http_response.status
421
411
  response_content = http_response.body
422
412
  unless status_code == 200
423
413
  error_model = JSON.load(response_content)
424
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
414
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
425
415
  end
426
416
 
427
- # Create Result
428
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
429
417
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
430
418
  # Deserialize Response
431
419
  if status_code == 200
@@ -493,29 +481,26 @@ module Azure::ARM::Web
493
481
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
494
482
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
495
483
  path_template = '{nextLink}'
484
+
485
+ request_url = @base_url || @client.base_url
486
+
496
487
  options = {
497
488
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
498
489
  skip_encoding_path_params: {'nextLink' => next_page_link},
499
- headers: request_headers.merge(custom_headers || {})
490
+ headers: request_headers.merge(custom_headers || {}),
491
+ base_url: request_url
500
492
  }
493
+ promise = @client.make_request_async(:post, path_template, options)
501
494
 
502
- request_url = @base_url || @client.base_url
503
-
504
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
505
- promise = request.run_promise do |req|
506
- @client.credentials.sign_request(req) unless @client.credentials.nil?
507
- end
508
-
509
- promise = promise.then do |http_response|
495
+ promise = promise.then do |result|
496
+ http_response = result.response
510
497
  status_code = http_response.status
511
498
  response_content = http_response.body
512
499
  unless status_code == 200
513
500
  error_model = JSON.load(response_content)
514
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
501
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
515
502
  end
516
503
 
517
- # Create Result
518
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
519
504
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
520
505
  # Deserialize Response
521
506
  if status_code == 200
@@ -89,30 +89,27 @@ module Azure::ARM::Web
89
89
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
90
90
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
91
91
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web.Admin/environments/{environmentName}/usage'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
92
95
  options = {
93
96
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
94
97
  path_params: {'resourceGroupName' => resource_group_name,'environmentName' => environment_name,'subscriptionId' => @client.subscription_id},
95
98
  query_params: {'lastId' => last_id,'batchSize' => batch_size,'api-version' => @client.api_version},
96
- headers: request_headers.merge(custom_headers || {})
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
97
101
  }
102
+ promise = @client.make_request_async(:get, path_template, options)
98
103
 
99
- request_url = @base_url || @client.base_url
100
-
101
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
102
- promise = request.run_promise do |req|
103
- @client.credentials.sign_request(req) unless @client.credentials.nil?
104
- end
105
-
106
- promise = promise.then do |http_response|
104
+ promise = promise.then do |result|
105
+ http_response = result.response
107
106
  status_code = http_response.status
108
107
  response_content = http_response.body
109
108
  unless status_code == 200
110
109
  error_model = JSON.load(response_content)
111
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
110
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
112
111
  end
113
112
 
114
- # Create Result
115
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
116
113
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
114
 
118
115
  result
@@ -4,5 +4,5 @@
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Web
7
- VERSION = '0.6.0'
7
+ VERSION = '0.7.0'
8
8
  end
@@ -34,10 +34,6 @@ module Azure::ARM::Web
34
34
  # is generated and included in each request. Default is true.
35
35
  attr_accessor :generate_client_request_id
36
36
 
37
- # @return Subscription credentials which uniquely identify client
38
- # subscription.
39
- attr_accessor :credentials
40
-
41
37
  # @return [CertificateOrders] certificate_orders
42
38
  attr_reader :certificate_orders
43
39
 
@@ -122,5 +118,60 @@ module Azure::ARM::Web
122
118
  @generate_client_request_id = true
123
119
  end
124
120
 
121
+ #
122
+ # Makes a request and returns the body of the response.
123
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
124
+ # @param path [String] the path, relative to {base_url}.
125
+ # @param options [Hash{String=>String}] specifying any request options like :body.
126
+ # @return [Hash{String=>String}] containing the body of the response.
127
+ # Example:
128
+ #
129
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
130
+ # path = "/path"
131
+ # options = {
132
+ # body: request_content,
133
+ # query_params: {'api-version' => '2016-02-01'}
134
+ # }
135
+ # result = @client.make_request(:put, path, options)
136
+ #
137
+ def make_request(method, path, options = {})
138
+ result = make_request_with_http_info(method, path, options)
139
+ result.body unless result.nil?
140
+ end
141
+
142
+ #
143
+ # Makes a request and returns the operation response.
144
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
145
+ # @param path [String] the path, relative to {base_url}.
146
+ # @param options [Hash{String=>String}] specifying any request options like :body.
147
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
148
+ #
149
+ def make_request_with_http_info(method, path, options = {})
150
+ result = make_request_async(method, path, options).value!
151
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
152
+ result
153
+ end
154
+
155
+ #
156
+ # Makes a request asynchronously.
157
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
158
+ # @param path [String] the path, relative to {base_url}.
159
+ # @param options [Hash{String=>String}] specifying any request options like :body.
160
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
161
+ #
162
+ def make_request_async(method, path, options = {})
163
+ fail ArgumentError, 'method is nil' if method.nil?
164
+ fail ArgumentError, 'path is nil' if path.nil?
165
+
166
+ request_url = options[:base_url] || @base_url
167
+
168
+ request_headers = @request_headers
169
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
170
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
171
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
172
+
173
+ super(request_url, method, path, options)
174
+ end
175
+
125
176
  end
126
177
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure_mgmt_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.6.0
83
83
  description: Microsoft Azure Web Apps Management Client Library for Ruby
84
84
  email: azrubyteam@microsoft.com
85
85
  executables: []
@@ -297,7 +297,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
297
  requirements:
298
298
  - - ">="
299
299
  - !ruby/object:Gem::Version
300
- version: 1.9.3
300
+ version: 2.0.0
301
301
  required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  requirements:
303
303
  - - ">="