azure_mgmt_subscriptions 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8714091e5ffee00f348303e0b2c4bb29c8b9c4e6
4
- data.tar.gz: 79f0524cee72e360193d5e08875b4162d39792d3
3
+ metadata.gz: 2e25b6ec42d8b5586cd0a56503cc209b00193c76
4
+ data.tar.gz: 846cbfff5854caf5720b40da83a3380cad149c8e
5
5
  SHA512:
6
- metadata.gz: 7066b61568f68d2f09e0dd0cb2c296d25a605493d6b68ca4ac850b49467fc1f06c4a05ecdb87f770c2b456edafd264e2b03e5e4dbc140d4322e9d9846e3244f1
7
- data.tar.gz: ea4b7b8ba76cd5380b7fab14b13450c31562761b4aa179716915a12dff7fa0bbaf289c55124bf2885c39a435e84d65f1ebdd3cb46cc4c466b147bbf958b34a07
6
+ metadata.gz: 12d8eddb19f68326c9d1cfb430a37691749393a243c62e3c091d37ee6d75b5f0cdf9ad444436555f820620f5941d870e2d17ac7300385ea53014cb6971463a07
7
+ data.tar.gz: c0a363da31c4e9df3d59129444a68ce867a41808d3a7503717b3090364349347b7f37c2ba89a0b2bae452e364050251146f62b939001e834a3cdc319bf46e9a6
@@ -31,10 +31,6 @@ module Azure::ARM::Subscriptions
31
31
  # is generated and included in each request. Default is true.
32
32
  attr_accessor :generate_client_request_id
33
33
 
34
- # @return Subscription credentials which uniquely identify client
35
- # subscription.
36
- attr_accessor :credentials
37
-
38
34
  # @return [Subscriptions] subscriptions
39
35
  attr_reader :subscriptions
40
36
 
@@ -63,5 +59,60 @@ module Azure::ARM::Subscriptions
63
59
  @generate_client_request_id = true
64
60
  end
65
61
 
62
+ #
63
+ # Makes a request and returns the body of the response.
64
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
65
+ # @param path [String] the path, relative to {base_url}.
66
+ # @param options [Hash{String=>String}] specifying any request options like :body.
67
+ # @return [Hash{String=>String}] containing the body of the response.
68
+ # Example:
69
+ #
70
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
71
+ # path = "/path"
72
+ # options = {
73
+ # body: request_content,
74
+ # query_params: {'api-version' => '2016-02-01'}
75
+ # }
76
+ # result = @client.make_request(:put, path, options)
77
+ #
78
+ def make_request(method, path, options = {})
79
+ result = make_request_with_http_info(method, path, options)
80
+ result.body unless result.nil?
81
+ end
82
+
83
+ #
84
+ # Makes a request and returns the operation 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 [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
89
+ #
90
+ def make_request_with_http_info(method, path, options = {})
91
+ result = make_request_async(method, path, options).value!
92
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
93
+ result
94
+ end
95
+
96
+ #
97
+ # Makes a request asynchronously.
98
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
99
+ # @param path [String] the path, relative to {base_url}.
100
+ # @param options [Hash{String=>String}] specifying any request options like :body.
101
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
102
+ #
103
+ def make_request_async(method, path, options = {})
104
+ fail ArgumentError, 'method is nil' if method.nil?
105
+ fail ArgumentError, 'path is nil' if path.nil?
106
+
107
+ request_url = options[:base_url] || @base_url
108
+
109
+ request_headers = @request_headers
110
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
111
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
112
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
113
+
114
+ super(request_url, method, path, options)
115
+ end
116
+
66
117
  end
67
118
  end
@@ -69,30 +69,27 @@ module Azure::ARM::Subscriptions
69
69
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
70
70
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
71
71
  path_template = '/subscriptions/{subscriptionId}/locations'
72
+
73
+ request_url = @base_url || @client.base_url
74
+
72
75
  options = {
73
76
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
77
  path_params: {'subscriptionId' => subscription_id},
75
78
  query_params: {'api-version' => @client.api_version},
76
- headers: request_headers.merge(custom_headers || {})
79
+ headers: request_headers.merge(custom_headers || {}),
80
+ base_url: request_url
77
81
  }
82
+ promise = @client.make_request_async(:get, path_template, options)
78
83
 
79
- request_url = @base_url || @client.base_url
80
-
81
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
82
- promise = request.run_promise do |req|
83
- @client.credentials.sign_request(req) unless @client.credentials.nil?
84
- end
85
-
86
- promise = promise.then do |http_response|
84
+ promise = promise.then do |result|
85
+ http_response = result.response
87
86
  status_code = http_response.status
88
87
  response_content = http_response.body
89
88
  unless status_code == 200
90
89
  error_model = JSON.load(response_content)
91
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
90
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
92
91
  end
93
92
 
94
- # Create Result
95
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
96
93
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
97
94
  # Deserialize Response
98
95
  if status_code == 200
@@ -158,30 +155,27 @@ module Azure::ARM::Subscriptions
158
155
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
159
156
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
160
157
  path_template = '/subscriptions/{subscriptionId}'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
161
  options = {
162
162
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
163
  path_params: {'subscriptionId' => subscription_id},
164
164
  query_params: {'api-version' => @client.api_version},
165
- headers: request_headers.merge(custom_headers || {})
165
+ headers: request_headers.merge(custom_headers || {}),
166
+ base_url: request_url
166
167
  }
168
+ promise = @client.make_request_async(:get, path_template, options)
167
169
 
168
- request_url = @base_url || @client.base_url
169
-
170
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
171
- promise = request.run_promise do |req|
172
- @client.credentials.sign_request(req) unless @client.credentials.nil?
173
- end
174
-
175
- promise = promise.then do |http_response|
170
+ promise = promise.then do |result|
171
+ http_response = result.response
176
172
  status_code = http_response.status
177
173
  response_content = http_response.body
178
174
  unless status_code == 200
179
175
  error_model = JSON.load(response_content)
180
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
176
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
181
177
  end
182
178
 
183
- # Create Result
184
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
185
179
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
186
180
  # Deserialize Response
187
181
  if status_code == 200
@@ -213,8 +207,8 @@ module Azure::ARM::Subscriptions
213
207
  response = list_async(custom_headers).value!
214
208
  unless response.nil?
215
209
  page = response.body
216
- page.next_method = Proc.new do |next_link|
217
- list_next_async(next_link, custom_headers)
210
+ page.next_method = Proc.new do |next_page_link|
211
+ list_next_async(next_page_link, custom_headers)
218
212
  end
219
213
  page
220
214
  end
@@ -263,29 +257,26 @@ module Azure::ARM::Subscriptions
263
257
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
264
258
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
265
259
  path_template = '/subscriptions'
260
+
261
+ request_url = @base_url || @client.base_url
262
+
266
263
  options = {
267
264
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
268
265
  query_params: {'api-version' => @client.api_version},
269
- headers: request_headers.merge(custom_headers || {})
266
+ headers: request_headers.merge(custom_headers || {}),
267
+ base_url: request_url
270
268
  }
269
+ promise = @client.make_request_async(:get, path_template, options)
271
270
 
272
- request_url = @base_url || @client.base_url
273
-
274
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
275
- promise = request.run_promise do |req|
276
- @client.credentials.sign_request(req) unless @client.credentials.nil?
277
- end
278
-
279
- promise = promise.then do |http_response|
271
+ promise = promise.then do |result|
272
+ http_response = result.response
280
273
  status_code = http_response.status
281
274
  response_content = http_response.body
282
275
  unless status_code == 200
283
276
  error_model = JSON.load(response_content)
284
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
277
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
285
278
  end
286
279
 
287
- # Create Result
288
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
289
280
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
290
281
  # Deserialize Response
291
282
  if status_code == 200
@@ -353,29 +344,26 @@ module Azure::ARM::Subscriptions
353
344
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
345
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
346
  path_template = '{nextLink}'
347
+
348
+ request_url = @base_url || @client.base_url
349
+
356
350
  options = {
357
351
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
358
352
  skip_encoding_path_params: {'nextLink' => next_page_link},
359
- headers: request_headers.merge(custom_headers || {})
353
+ headers: request_headers.merge(custom_headers || {}),
354
+ base_url: request_url
360
355
  }
356
+ promise = @client.make_request_async(:get, path_template, options)
361
357
 
362
- request_url = @base_url || @client.base_url
363
-
364
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
365
- promise = request.run_promise do |req|
366
- @client.credentials.sign_request(req) unless @client.credentials.nil?
367
- end
368
-
369
- promise = promise.then do |http_response|
358
+ promise = promise.then do |result|
359
+ http_response = result.response
370
360
  status_code = http_response.status
371
361
  response_content = http_response.body
372
362
  unless status_code == 200
373
363
  error_model = JSON.load(response_content)
374
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
364
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
365
  end
376
366
 
377
- # Create Result
378
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
379
367
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
380
368
  # Deserialize Response
381
369
  if status_code == 200
@@ -35,8 +35,8 @@ module Azure::ARM::Subscriptions
35
35
  response = list_async(custom_headers).value!
36
36
  unless response.nil?
37
37
  page = response.body
38
- page.next_method = Proc.new do |next_link|
39
- list_next_async(next_link, custom_headers)
38
+ page.next_method = Proc.new do |next_page_link|
39
+ list_next_async(next_page_link, custom_headers)
40
40
  end
41
41
  page
42
42
  end
@@ -85,29 +85,26 @@ module Azure::ARM::Subscriptions
85
85
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
86
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
87
  path_template = '/tenants'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
88
91
  options = {
89
92
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
93
  query_params: {'api-version' => @client.api_version},
91
- headers: request_headers.merge(custom_headers || {})
94
+ headers: request_headers.merge(custom_headers || {}),
95
+ base_url: request_url
92
96
  }
97
+ promise = @client.make_request_async(:get, path_template, options)
93
98
 
94
- request_url = @base_url || @client.base_url
95
-
96
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
97
- promise = request.run_promise do |req|
98
- @client.credentials.sign_request(req) unless @client.credentials.nil?
99
- end
100
-
101
- promise = promise.then do |http_response|
99
+ promise = promise.then do |result|
100
+ http_response = result.response
102
101
  status_code = http_response.status
103
102
  response_content = http_response.body
104
103
  unless status_code == 200
105
104
  error_model = JSON.load(response_content)
106
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
105
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
107
106
  end
108
107
 
109
- # Create Result
110
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
111
108
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
109
  # Deserialize Response
113
110
  if status_code == 200
@@ -175,29 +172,26 @@ module Azure::ARM::Subscriptions
175
172
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
176
173
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
177
174
  path_template = '{nextLink}'
175
+
176
+ request_url = @base_url || @client.base_url
177
+
178
178
  options = {
179
179
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
180
180
  skip_encoding_path_params: {'nextLink' => next_page_link},
181
- headers: request_headers.merge(custom_headers || {})
181
+ headers: request_headers.merge(custom_headers || {}),
182
+ base_url: request_url
182
183
  }
184
+ promise = @client.make_request_async(:get, path_template, options)
183
185
 
184
- request_url = @base_url || @client.base_url
185
-
186
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
187
- promise = request.run_promise do |req|
188
- @client.credentials.sign_request(req) unless @client.credentials.nil?
189
- end
190
-
191
- promise = promise.then do |http_response|
186
+ promise = promise.then do |result|
187
+ http_response = result.response
192
188
  status_code = http_response.status
193
189
  response_content = http_response.body
194
190
  unless status_code == 200
195
191
  error_model = JSON.load(response_content)
196
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
192
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
197
193
  end
198
194
 
199
- # Create Result
200
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
201
195
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
196
  # Deserialize Response
203
197
  if status_code == 200
@@ -4,5 +4,5 @@
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Subscriptions
7
- VERSION = '0.6.0'
7
+ VERSION = '0.7.0'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure_mgmt_subscriptions
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 Subscription Management Client Library for Ruby
84
84
  email: azrubyteam@microsoft.com
85
85
  executables: []
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: 1.9.3
116
+ version: 2.0.0
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="