azure_mgmt_subscriptions 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/location.rb +95 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +52 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb +86 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +94 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +54 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +54 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +94 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/subscription_client.rb +130 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/subscriptions.rb +385 -0
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/tenants.rb +213 -0
- data/lib/{generated → 2015-11-01/generated}/azure_mgmt_subscriptions/version.rb +2 -2
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions.rb +36 -0
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/location.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/location_list_result.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/spending_limit.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/subscription.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/subscription_list_result.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/subscription_policies.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/subscription_state.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/tenant_id_description.rb +1 -1
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/models/tenant_list_result.rb +1 -1
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/subscription_client.rb +3 -3
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/subscriptions.rb +5 -5
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions/tenants.rb +3 -3
- data/lib/{generated/azure_mgmt_subscriptions/module_definition.rb → 2016-06-01/generated/azure_mgmt_subscriptions/version.rb} +3 -3
- data/lib/{generated → 2016-06-01/generated}/azure_mgmt_subscriptions.rb +14 -14
- data/lib/azure_mgmt_subscriptions.rb +4 -1
- data/lib/module_definition.rb +9 -0
- data/lib/profiles/common/configurable.rb +73 -0
- data/lib/profiles/common/default.rb +68 -0
- data/lib/profiles/latest/modules/subscriptions_profile_module.rb +80 -0
- data/lib/profiles/latest/subscriptions_latest_profile_client.rb +33 -0
- data/lib/profiles/latest/subscriptions_module_definition.rb +9 -0
- data/lib/profiles/v2017_03_09/modules/subscriptions_profile_module.rb +80 -0
- data/lib/profiles/v2017_03_09/subscriptions_module_definition.rb +9 -0
- data/lib/profiles/v2017_03_09/subscriptions_v2017_03_09_profile_client.rb +33 -0
- data/lib/version.rb +7 -0
- metadata +40 -17
@@ -0,0 +1,385 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Subscriptions::Mgmt::V2015_11_01
|
7
|
+
#
|
8
|
+
# Subscriptions
|
9
|
+
#
|
10
|
+
class Subscriptions
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Subscriptions class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [SubscriptionClient] reference to the SubscriptionClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Gets a list of the subscription locations.
|
26
|
+
#
|
27
|
+
# @param subscription_id [String] Id of the subscription
|
28
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
29
|
+
# will be added to the HTTP request.
|
30
|
+
#
|
31
|
+
# @return [LocationListResult] operation results.
|
32
|
+
#
|
33
|
+
def list_locations(subscription_id, custom_headers = nil)
|
34
|
+
response = list_locations_async(subscription_id, custom_headers).value!
|
35
|
+
response.body unless response.nil?
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Gets a list of the subscription locations.
|
40
|
+
#
|
41
|
+
# @param subscription_id [String] Id of the subscription
|
42
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
43
|
+
# will be added to the HTTP request.
|
44
|
+
#
|
45
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
46
|
+
#
|
47
|
+
def list_locations_with_http_info(subscription_id, custom_headers = nil)
|
48
|
+
list_locations_async(subscription_id, custom_headers).value!
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Gets a list of the subscription locations.
|
53
|
+
#
|
54
|
+
# @param subscription_id [String] Id of the subscription
|
55
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
56
|
+
# to the HTTP request.
|
57
|
+
#
|
58
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
59
|
+
#
|
60
|
+
def list_locations_async(subscription_id, custom_headers = nil)
|
61
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
62
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
63
|
+
|
64
|
+
|
65
|
+
request_headers = {}
|
66
|
+
|
67
|
+
# Set Headers
|
68
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
69
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
70
|
+
path_template = 'subscriptions/{subscriptionId}/locations'
|
71
|
+
|
72
|
+
request_url = @base_url || @client.base_url
|
73
|
+
|
74
|
+
options = {
|
75
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
76
|
+
path_params: {'subscriptionId' => subscription_id},
|
77
|
+
query_params: {'api-version' => @client.api_version},
|
78
|
+
headers: request_headers.merge(custom_headers || {}),
|
79
|
+
base_url: request_url
|
80
|
+
}
|
81
|
+
promise = @client.make_request_async(:get, path_template, options)
|
82
|
+
|
83
|
+
promise = promise.then do |result|
|
84
|
+
http_response = result.response
|
85
|
+
status_code = http_response.status
|
86
|
+
response_content = http_response.body
|
87
|
+
unless status_code == 200
|
88
|
+
error_model = JSON.load(response_content)
|
89
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
90
|
+
end
|
91
|
+
|
92
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
93
|
+
# Deserialize Response
|
94
|
+
if status_code == 200
|
95
|
+
begin
|
96
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
97
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::LocationListResult.mapper()
|
98
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
99
|
+
rescue Exception => e
|
100
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
result
|
105
|
+
end
|
106
|
+
|
107
|
+
promise.execute
|
108
|
+
end
|
109
|
+
|
110
|
+
#
|
111
|
+
# Gets details about particular subscription.
|
112
|
+
#
|
113
|
+
# @param subscription_id [String] Id of the subscription.
|
114
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
115
|
+
# will be added to the HTTP request.
|
116
|
+
#
|
117
|
+
# @return [Subscription] operation results.
|
118
|
+
#
|
119
|
+
def get(subscription_id, custom_headers = nil)
|
120
|
+
response = get_async(subscription_id, custom_headers).value!
|
121
|
+
response.body unless response.nil?
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Gets details about particular subscription.
|
126
|
+
#
|
127
|
+
# @param subscription_id [String] Id of the subscription.
|
128
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
129
|
+
# will be added to the HTTP request.
|
130
|
+
#
|
131
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
132
|
+
#
|
133
|
+
def get_with_http_info(subscription_id, custom_headers = nil)
|
134
|
+
get_async(subscription_id, custom_headers).value!
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# Gets details about particular subscription.
|
139
|
+
#
|
140
|
+
# @param subscription_id [String] Id of the subscription.
|
141
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
142
|
+
# to the HTTP request.
|
143
|
+
#
|
144
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
145
|
+
#
|
146
|
+
def get_async(subscription_id, custom_headers = nil)
|
147
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
148
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
149
|
+
|
150
|
+
|
151
|
+
request_headers = {}
|
152
|
+
|
153
|
+
# Set Headers
|
154
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
155
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
156
|
+
path_template = 'subscriptions/{subscriptionId}'
|
157
|
+
|
158
|
+
request_url = @base_url || @client.base_url
|
159
|
+
|
160
|
+
options = {
|
161
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
162
|
+
path_params: {'subscriptionId' => subscription_id},
|
163
|
+
query_params: {'api-version' => @client.api_version},
|
164
|
+
headers: request_headers.merge(custom_headers || {}),
|
165
|
+
base_url: request_url
|
166
|
+
}
|
167
|
+
promise = @client.make_request_async(:get, path_template, options)
|
168
|
+
|
169
|
+
promise = promise.then do |result|
|
170
|
+
http_response = result.response
|
171
|
+
status_code = http_response.status
|
172
|
+
response_content = http_response.body
|
173
|
+
unless status_code == 200
|
174
|
+
error_model = JSON.load(response_content)
|
175
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
176
|
+
end
|
177
|
+
|
178
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
179
|
+
# Deserialize Response
|
180
|
+
if status_code == 200
|
181
|
+
begin
|
182
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
183
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::Subscription.mapper()
|
184
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
185
|
+
rescue Exception => e
|
186
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
result
|
191
|
+
end
|
192
|
+
|
193
|
+
promise.execute
|
194
|
+
end
|
195
|
+
|
196
|
+
#
|
197
|
+
# Gets a list of the subscriptionIds.
|
198
|
+
#
|
199
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
200
|
+
# will be added to the HTTP request.
|
201
|
+
#
|
202
|
+
# @return [Array<Subscription>] operation results.
|
203
|
+
#
|
204
|
+
def list(custom_headers = nil)
|
205
|
+
first_page = list_as_lazy(custom_headers)
|
206
|
+
first_page.get_all_items
|
207
|
+
end
|
208
|
+
|
209
|
+
#
|
210
|
+
# Gets a list of the subscriptionIds.
|
211
|
+
#
|
212
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
213
|
+
# will be added to the HTTP request.
|
214
|
+
#
|
215
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
216
|
+
#
|
217
|
+
def list_with_http_info(custom_headers = nil)
|
218
|
+
list_async(custom_headers).value!
|
219
|
+
end
|
220
|
+
|
221
|
+
#
|
222
|
+
# Gets a list of the subscriptionIds.
|
223
|
+
#
|
224
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
225
|
+
# to the HTTP request.
|
226
|
+
#
|
227
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
228
|
+
#
|
229
|
+
def list_async(custom_headers = nil)
|
230
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
231
|
+
|
232
|
+
|
233
|
+
request_headers = {}
|
234
|
+
|
235
|
+
# Set Headers
|
236
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
237
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
238
|
+
path_template = 'subscriptions'
|
239
|
+
|
240
|
+
request_url = @base_url || @client.base_url
|
241
|
+
|
242
|
+
options = {
|
243
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
244
|
+
query_params: {'api-version' => @client.api_version},
|
245
|
+
headers: request_headers.merge(custom_headers || {}),
|
246
|
+
base_url: request_url
|
247
|
+
}
|
248
|
+
promise = @client.make_request_async(:get, path_template, options)
|
249
|
+
|
250
|
+
promise = promise.then do |result|
|
251
|
+
http_response = result.response
|
252
|
+
status_code = http_response.status
|
253
|
+
response_content = http_response.body
|
254
|
+
unless status_code == 200
|
255
|
+
error_model = JSON.load(response_content)
|
256
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
257
|
+
end
|
258
|
+
|
259
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
260
|
+
# Deserialize Response
|
261
|
+
if status_code == 200
|
262
|
+
begin
|
263
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
264
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::SubscriptionListResult.mapper()
|
265
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
266
|
+
rescue Exception => e
|
267
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
result
|
272
|
+
end
|
273
|
+
|
274
|
+
promise.execute
|
275
|
+
end
|
276
|
+
|
277
|
+
#
|
278
|
+
# Gets a list of the subscriptionIds.
|
279
|
+
#
|
280
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
281
|
+
# to List operation.
|
282
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
283
|
+
# will be added to the HTTP request.
|
284
|
+
#
|
285
|
+
# @return [SubscriptionListResult] operation results.
|
286
|
+
#
|
287
|
+
def list_next(next_page_link, custom_headers = nil)
|
288
|
+
response = list_next_async(next_page_link, custom_headers).value!
|
289
|
+
response.body unless response.nil?
|
290
|
+
end
|
291
|
+
|
292
|
+
#
|
293
|
+
# Gets a list of the subscriptionIds.
|
294
|
+
#
|
295
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
296
|
+
# to List operation.
|
297
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
298
|
+
# will be added to the HTTP request.
|
299
|
+
#
|
300
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
301
|
+
#
|
302
|
+
def list_next_with_http_info(next_page_link, custom_headers = nil)
|
303
|
+
list_next_async(next_page_link, custom_headers).value!
|
304
|
+
end
|
305
|
+
|
306
|
+
#
|
307
|
+
# Gets a list of the subscriptionIds.
|
308
|
+
#
|
309
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
310
|
+
# to List operation.
|
311
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
312
|
+
# to the HTTP request.
|
313
|
+
#
|
314
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
315
|
+
#
|
316
|
+
def list_next_async(next_page_link, custom_headers = nil)
|
317
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
318
|
+
|
319
|
+
|
320
|
+
request_headers = {}
|
321
|
+
|
322
|
+
# Set Headers
|
323
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
324
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
325
|
+
path_template = '{nextLink}'
|
326
|
+
|
327
|
+
request_url = @base_url || @client.base_url
|
328
|
+
|
329
|
+
options = {
|
330
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
331
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
332
|
+
headers: request_headers.merge(custom_headers || {}),
|
333
|
+
base_url: request_url
|
334
|
+
}
|
335
|
+
promise = @client.make_request_async(:get, path_template, options)
|
336
|
+
|
337
|
+
promise = promise.then do |result|
|
338
|
+
http_response = result.response
|
339
|
+
status_code = http_response.status
|
340
|
+
response_content = http_response.body
|
341
|
+
unless status_code == 200
|
342
|
+
error_model = JSON.load(response_content)
|
343
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
344
|
+
end
|
345
|
+
|
346
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
347
|
+
# Deserialize Response
|
348
|
+
if status_code == 200
|
349
|
+
begin
|
350
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
351
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::SubscriptionListResult.mapper()
|
352
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
353
|
+
rescue Exception => e
|
354
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
result
|
359
|
+
end
|
360
|
+
|
361
|
+
promise.execute
|
362
|
+
end
|
363
|
+
|
364
|
+
#
|
365
|
+
# Gets a list of the subscriptionIds.
|
366
|
+
#
|
367
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
368
|
+
# will be added to the HTTP request.
|
369
|
+
#
|
370
|
+
# @return [SubscriptionListResult] which provide lazy access to pages of the
|
371
|
+
# response.
|
372
|
+
#
|
373
|
+
def list_as_lazy(custom_headers = nil)
|
374
|
+
response = list_async(custom_headers).value!
|
375
|
+
unless response.nil?
|
376
|
+
page = response.body
|
377
|
+
page.next_method = Proc.new do |next_page_link|
|
378
|
+
list_next_async(next_page_link, custom_headers)
|
379
|
+
end
|
380
|
+
page
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|
385
|
+
end
|
@@ -0,0 +1,213 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Subscriptions::Mgmt::V2015_11_01
|
7
|
+
#
|
8
|
+
# Tenants
|
9
|
+
#
|
10
|
+
class Tenants
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Tenants class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [SubscriptionClient] reference to the SubscriptionClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Gets a list of the tenantIds.
|
26
|
+
#
|
27
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
28
|
+
# will be added to the HTTP request.
|
29
|
+
#
|
30
|
+
# @return [Array<TenantIdDescription>] operation results.
|
31
|
+
#
|
32
|
+
def list(custom_headers = nil)
|
33
|
+
first_page = list_as_lazy(custom_headers)
|
34
|
+
first_page.get_all_items
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Gets a list of the tenantIds.
|
39
|
+
#
|
40
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
41
|
+
# will be added to the HTTP request.
|
42
|
+
#
|
43
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
44
|
+
#
|
45
|
+
def list_with_http_info(custom_headers = nil)
|
46
|
+
list_async(custom_headers).value!
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Gets a list of the tenantIds.
|
51
|
+
#
|
52
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
53
|
+
# to the HTTP request.
|
54
|
+
#
|
55
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
56
|
+
#
|
57
|
+
def list_async(custom_headers = nil)
|
58
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
59
|
+
|
60
|
+
|
61
|
+
request_headers = {}
|
62
|
+
|
63
|
+
# Set Headers
|
64
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
65
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
66
|
+
path_template = 'tenants'
|
67
|
+
|
68
|
+
request_url = @base_url || @client.base_url
|
69
|
+
|
70
|
+
options = {
|
71
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
72
|
+
query_params: {'api-version' => @client.api_version},
|
73
|
+
headers: request_headers.merge(custom_headers || {}),
|
74
|
+
base_url: request_url
|
75
|
+
}
|
76
|
+
promise = @client.make_request_async(:get, path_template, options)
|
77
|
+
|
78
|
+
promise = promise.then do |result|
|
79
|
+
http_response = result.response
|
80
|
+
status_code = http_response.status
|
81
|
+
response_content = http_response.body
|
82
|
+
unless status_code == 200
|
83
|
+
error_model = JSON.load(response_content)
|
84
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
85
|
+
end
|
86
|
+
|
87
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
88
|
+
# Deserialize Response
|
89
|
+
if status_code == 200
|
90
|
+
begin
|
91
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
92
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::TenantListResult.mapper()
|
93
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
94
|
+
rescue Exception => e
|
95
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
promise.execute
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# Gets a list of the tenantIds.
|
107
|
+
#
|
108
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
109
|
+
# to List operation.
|
110
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
111
|
+
# will be added to the HTTP request.
|
112
|
+
#
|
113
|
+
# @return [TenantListResult] operation results.
|
114
|
+
#
|
115
|
+
def list_next(next_page_link, custom_headers = nil)
|
116
|
+
response = list_next_async(next_page_link, custom_headers).value!
|
117
|
+
response.body unless response.nil?
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Gets a list of the tenantIds.
|
122
|
+
#
|
123
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
124
|
+
# to List operation.
|
125
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
126
|
+
# will be added to the HTTP request.
|
127
|
+
#
|
128
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
129
|
+
#
|
130
|
+
def list_next_with_http_info(next_page_link, custom_headers = nil)
|
131
|
+
list_next_async(next_page_link, custom_headers).value!
|
132
|
+
end
|
133
|
+
|
134
|
+
#
|
135
|
+
# Gets a list of the tenantIds.
|
136
|
+
#
|
137
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
138
|
+
# to List operation.
|
139
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
140
|
+
# to the HTTP request.
|
141
|
+
#
|
142
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
143
|
+
#
|
144
|
+
def list_next_async(next_page_link, custom_headers = nil)
|
145
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
146
|
+
|
147
|
+
|
148
|
+
request_headers = {}
|
149
|
+
|
150
|
+
# Set Headers
|
151
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
152
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
153
|
+
path_template = '{nextLink}'
|
154
|
+
|
155
|
+
request_url = @base_url || @client.base_url
|
156
|
+
|
157
|
+
options = {
|
158
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
159
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
160
|
+
headers: request_headers.merge(custom_headers || {}),
|
161
|
+
base_url: request_url
|
162
|
+
}
|
163
|
+
promise = @client.make_request_async(:get, path_template, options)
|
164
|
+
|
165
|
+
promise = promise.then do |result|
|
166
|
+
http_response = result.response
|
167
|
+
status_code = http_response.status
|
168
|
+
response_content = http_response.body
|
169
|
+
unless status_code == 200
|
170
|
+
error_model = JSON.load(response_content)
|
171
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
172
|
+
end
|
173
|
+
|
174
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
175
|
+
# Deserialize Response
|
176
|
+
if status_code == 200
|
177
|
+
begin
|
178
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
179
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2015_11_01::Models::TenantListResult.mapper()
|
180
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
181
|
+
rescue Exception => e
|
182
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
result
|
187
|
+
end
|
188
|
+
|
189
|
+
promise.execute
|
190
|
+
end
|
191
|
+
|
192
|
+
#
|
193
|
+
# Gets a list of the tenantIds.
|
194
|
+
#
|
195
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
196
|
+
# will be added to the HTTP request.
|
197
|
+
#
|
198
|
+
# @return [TenantListResult] which provide lazy access to pages of the
|
199
|
+
# response.
|
200
|
+
#
|
201
|
+
def list_as_lazy(custom_headers = nil)
|
202
|
+
response = list_async(custom_headers).value!
|
203
|
+
unless response.nil?
|
204
|
+
page = response.body
|
205
|
+
page.next_method = Proc.new do |next_page_link|
|
206
|
+
list_next_async(next_page_link, custom_headers)
|
207
|
+
end
|
208
|
+
page
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
require 'uri'
|
7
|
+
require 'cgi'
|
8
|
+
require 'date'
|
9
|
+
require 'json'
|
10
|
+
require 'base64'
|
11
|
+
require 'erb'
|
12
|
+
require 'securerandom'
|
13
|
+
require 'time'
|
14
|
+
require 'timeliness'
|
15
|
+
require 'faraday'
|
16
|
+
require 'faraday-cookie_jar'
|
17
|
+
require 'concurrent'
|
18
|
+
require 'ms_rest'
|
19
|
+
require '2015-11-01/generated/azure_mgmt_subscriptions/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::Subscriptions::Mgmt::V2015_11_01
|
23
|
+
autoload :Subscriptions, '2015-11-01/generated/azure_mgmt_subscriptions/subscriptions.rb'
|
24
|
+
autoload :Tenants, '2015-11-01/generated/azure_mgmt_subscriptions/tenants.rb'
|
25
|
+
autoload :SubscriptionClient, '2015-11-01/generated/azure_mgmt_subscriptions/subscription_client.rb'
|
26
|
+
|
27
|
+
module Models
|
28
|
+
autoload :Subscription, '2015-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb'
|
29
|
+
autoload :SubscriptionListResult, '2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb'
|
30
|
+
autoload :LocationListResult, '2015-11-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb'
|
31
|
+
autoload :TenantIdDescription, '2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb'
|
32
|
+
autoload :Location, '2015-11-01/generated/azure_mgmt_subscriptions/models/location.rb'
|
33
|
+
autoload :TenantListResult, '2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb'
|
34
|
+
autoload :SubscriptionPolicies, '2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb'
|
35
|
+
end
|
36
|
+
end
|