azure_mgmt_subscriptions 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  3. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
  4. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  5. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  6. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  7. data/lib/2019-06-01/generated/azure_mgmt_subscriptions.rb +43 -0
  8. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location.rb +108 -0
  9. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +55 -0
  10. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
  11. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  12. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
  13. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
  14. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
  15. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription.rb +145 -0
  16. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +98 -0
  17. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +76 -0
  18. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
  19. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +61 -0
  20. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +98 -0
  21. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  22. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
  23. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
  24. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscriptions.rb +409 -0
  25. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/tenants.rb +222 -0
  26. data/lib/azure_mgmt_subscriptions.rb +1 -0
  27. data/lib/profiles/latest/modules/subscriptions_profile_module.rb +68 -56
  28. data/lib/version.rb +1 -1
  29. metadata +21 -2
@@ -0,0 +1,409 @@
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::V2019_06_01
7
+ #
8
+ # All resource groups and resources exist within subscriptions. These
9
+ # operation enable you get information about your subscriptions and tenants.
10
+ # A tenant is a dedicated instance of Azure Active Directory (Azure AD) for
11
+ # your organization.
12
+ #
13
+ class Subscriptions
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Subscriptions class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SubscriptionClient] reference to the SubscriptionClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets all available geo-locations.
29
+ #
30
+ # This operation provides all the locations that are available for resource
31
+ # providers; however, each resource provider may support a subset of this list.
32
+ #
33
+ # @param subscription_id [String] The ID of the target subscription.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [LocationListResult] operation results.
38
+ #
39
+ def list_locations(subscription_id, custom_headers:nil)
40
+ response = list_locations_async(subscription_id, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Gets all available geo-locations.
46
+ #
47
+ # This operation provides all the locations that are available for resource
48
+ # providers; however, each resource provider may support a subset of this list.
49
+ #
50
+ # @param subscription_id [String] The ID of the target subscription.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_locations_with_http_info(subscription_id, custom_headers:nil)
57
+ list_locations_async(subscription_id, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Gets all available geo-locations.
62
+ #
63
+ # This operation provides all the locations that are available for resource
64
+ # providers; however, each resource provider may support a subset of this list.
65
+ #
66
+ # @param subscription_id [String] The ID of the target subscription.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_locations_async(subscription_id, custom_headers:nil)
73
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'subscriptions/{subscriptionId}/locations'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'subscriptionId' => subscription_id},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
107
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::LocationListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Gets details about a specified subscription.
127
+ #
128
+ # @param subscription_id [String] The ID of the target subscription.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [Subscription] operation results.
133
+ #
134
+ def get(subscription_id, custom_headers:nil)
135
+ response = get_async(subscription_id, custom_headers:custom_headers).value!
136
+ response.body unless response.nil?
137
+ end
138
+
139
+ #
140
+ # Gets details about a specified subscription.
141
+ #
142
+ # @param subscription_id [String] The ID of the target subscription.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
147
+ #
148
+ def get_with_http_info(subscription_id, custom_headers:nil)
149
+ get_async(subscription_id, custom_headers:custom_headers).value!
150
+ end
151
+
152
+ #
153
+ # Gets details about a specified subscription.
154
+ #
155
+ # @param subscription_id [String] The ID of the target subscription.
156
+ # @param [Hash{String => String}] A hash of custom headers that will be added
157
+ # to the HTTP request.
158
+ #
159
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
160
+ #
161
+ def get_async(subscription_id, custom_headers:nil)
162
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
163
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
164
+
165
+
166
+ request_headers = {}
167
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
168
+
169
+ # Set Headers
170
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
171
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
172
+ path_template = 'subscriptions/{subscriptionId}'
173
+
174
+ request_url = @base_url || @client.base_url
175
+
176
+ options = {
177
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
178
+ path_params: {'subscriptionId' => subscription_id},
179
+ query_params: {'api-version' => @client.api_version},
180
+ headers: request_headers.merge(custom_headers || {}),
181
+ base_url: request_url
182
+ }
183
+ promise = @client.make_request_async(:get, path_template, options)
184
+
185
+ promise = promise.then do |result|
186
+ http_response = result.response
187
+ status_code = http_response.status
188
+ response_content = http_response.body
189
+ unless status_code == 200
190
+ error_model = JSON.load(response_content)
191
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
192
+ end
193
+
194
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
195
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
196
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
197
+ # Deserialize Response
198
+ if status_code == 200
199
+ begin
200
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
201
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::Subscription.mapper()
202
+ result.body = @client.deserialize(result_mapper, parsed_response)
203
+ rescue Exception => e
204
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
205
+ end
206
+ end
207
+
208
+ result
209
+ end
210
+
211
+ promise.execute
212
+ end
213
+
214
+ #
215
+ # Gets all subscriptions for a tenant.
216
+ #
217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
218
+ # will be added to the HTTP request.
219
+ #
220
+ # @return [Array<Subscription>] operation results.
221
+ #
222
+ def list(custom_headers:nil)
223
+ first_page = list_as_lazy(custom_headers:custom_headers)
224
+ first_page.get_all_items
225
+ end
226
+
227
+ #
228
+ # Gets all subscriptions for a tenant.
229
+ #
230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
231
+ # will be added to the HTTP request.
232
+ #
233
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
234
+ #
235
+ def list_with_http_info(custom_headers:nil)
236
+ list_async(custom_headers:custom_headers).value!
237
+ end
238
+
239
+ #
240
+ # Gets all subscriptions for a tenant.
241
+ #
242
+ # @param [Hash{String => String}] A hash of custom headers that will be added
243
+ # to the HTTP request.
244
+ #
245
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
246
+ #
247
+ def list_async(custom_headers:nil)
248
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
249
+
250
+
251
+ request_headers = {}
252
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
253
+
254
+ # Set Headers
255
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
256
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
257
+ path_template = 'subscriptions'
258
+
259
+ request_url = @base_url || @client.base_url
260
+
261
+ options = {
262
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
263
+ query_params: {'api-version' => @client.api_version},
264
+ headers: request_headers.merge(custom_headers || {}),
265
+ base_url: request_url
266
+ }
267
+ promise = @client.make_request_async(:get, path_template, options)
268
+
269
+ promise = promise.then do |result|
270
+ http_response = result.response
271
+ status_code = http_response.status
272
+ response_content = http_response.body
273
+ unless status_code == 200
274
+ error_model = JSON.load(response_content)
275
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
276
+ end
277
+
278
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
279
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
280
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
281
+ # Deserialize Response
282
+ if status_code == 200
283
+ begin
284
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
285
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::SubscriptionListResult.mapper()
286
+ result.body = @client.deserialize(result_mapper, parsed_response)
287
+ rescue Exception => e
288
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
289
+ end
290
+ end
291
+
292
+ result
293
+ end
294
+
295
+ promise.execute
296
+ end
297
+
298
+ #
299
+ # Gets all subscriptions for a tenant.
300
+ #
301
+ # @param next_page_link [String] The NextLink from the previous successful call
302
+ # to List operation.
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [SubscriptionListResult] operation results.
307
+ #
308
+ def list_next(next_page_link, custom_headers:nil)
309
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
310
+ response.body unless response.nil?
311
+ end
312
+
313
+ #
314
+ # Gets all subscriptions for a tenant.
315
+ #
316
+ # @param next_page_link [String] The NextLink from the previous successful call
317
+ # to List operation.
318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
319
+ # will be added to the HTTP request.
320
+ #
321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
322
+ #
323
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
324
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
325
+ end
326
+
327
+ #
328
+ # Gets all subscriptions for a tenant.
329
+ #
330
+ # @param next_page_link [String] The NextLink from the previous successful call
331
+ # to List operation.
332
+ # @param [Hash{String => String}] A hash of custom headers that will be added
333
+ # to the HTTP request.
334
+ #
335
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
336
+ #
337
+ def list_next_async(next_page_link, custom_headers:nil)
338
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
339
+
340
+
341
+ request_headers = {}
342
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
343
+
344
+ # Set Headers
345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
347
+ path_template = '{nextLink}'
348
+
349
+ request_url = @base_url || @client.base_url
350
+
351
+ options = {
352
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
353
+ skip_encoding_path_params: {'nextLink' => next_page_link},
354
+ headers: request_headers.merge(custom_headers || {}),
355
+ base_url: request_url
356
+ }
357
+ promise = @client.make_request_async(:get, path_template, options)
358
+
359
+ promise = promise.then do |result|
360
+ http_response = result.response
361
+ status_code = http_response.status
362
+ response_content = http_response.body
363
+ unless status_code == 200
364
+ error_model = JSON.load(response_content)
365
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
366
+ end
367
+
368
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
370
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
371
+ # Deserialize Response
372
+ if status_code == 200
373
+ begin
374
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
375
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::SubscriptionListResult.mapper()
376
+ result.body = @client.deserialize(result_mapper, parsed_response)
377
+ rescue Exception => e
378
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
379
+ end
380
+ end
381
+
382
+ result
383
+ end
384
+
385
+ promise.execute
386
+ end
387
+
388
+ #
389
+ # Gets all subscriptions for a tenant.
390
+ #
391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
392
+ # will be added to the HTTP request.
393
+ #
394
+ # @return [SubscriptionListResult] which provide lazy access to pages of the
395
+ # response.
396
+ #
397
+ def list_as_lazy(custom_headers:nil)
398
+ response = list_async(custom_headers:custom_headers).value!
399
+ unless response.nil?
400
+ page = response.body
401
+ page.next_method = Proc.new do |next_page_link|
402
+ list_next_async(next_page_link, custom_headers:custom_headers)
403
+ end
404
+ page
405
+ end
406
+ end
407
+
408
+ end
409
+ end
@@ -0,0 +1,222 @@
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::V2019_06_01
7
+ #
8
+ # All resource groups and resources exist within subscriptions. These
9
+ # operation enable you get information about your subscriptions and tenants.
10
+ # A tenant is a dedicated instance of Azure Active Directory (Azure AD) for
11
+ # your organization.
12
+ #
13
+ class Tenants
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Tenants class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SubscriptionClient] reference to the SubscriptionClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets the tenants for your account.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<TenantIdDescription>] operation results.
34
+ #
35
+ def list(custom_headers:nil)
36
+ first_page = list_as_lazy(custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets the tenants for your account.
42
+ #
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def list_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Gets the tenants for your account.
54
+ #
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_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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 = 'tenants'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
93
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
94
+ # Deserialize Response
95
+ if status_code == 200
96
+ begin
97
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
98
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::TenantListResult.mapper()
99
+ result.body = @client.deserialize(result_mapper, parsed_response)
100
+ rescue Exception => e
101
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
102
+ end
103
+ end
104
+
105
+ result
106
+ end
107
+
108
+ promise.execute
109
+ end
110
+
111
+ #
112
+ # Gets the tenants for your account.
113
+ #
114
+ # @param next_page_link [String] The NextLink from the previous successful call
115
+ # to List operation.
116
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
117
+ # will be added to the HTTP request.
118
+ #
119
+ # @return [TenantListResult] operation results.
120
+ #
121
+ def list_next(next_page_link, custom_headers:nil)
122
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
123
+ response.body unless response.nil?
124
+ end
125
+
126
+ #
127
+ # Gets the tenants for your account.
128
+ #
129
+ # @param next_page_link [String] The NextLink from the previous successful call
130
+ # to List operation.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
135
+ #
136
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
137
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
138
+ end
139
+
140
+ #
141
+ # Gets the tenants for your account.
142
+ #
143
+ # @param next_page_link [String] The NextLink from the previous successful call
144
+ # to List operation.
145
+ # @param [Hash{String => String}] A hash of custom headers that will be added
146
+ # to the HTTP request.
147
+ #
148
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
149
+ #
150
+ def list_next_async(next_page_link, custom_headers:nil)
151
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
152
+
153
+
154
+ request_headers = {}
155
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
156
+
157
+ # Set Headers
158
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
159
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
160
+ path_template = '{nextLink}'
161
+
162
+ request_url = @base_url || @client.base_url
163
+
164
+ options = {
165
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
166
+ skip_encoding_path_params: {'nextLink' => next_page_link},
167
+ headers: request_headers.merge(custom_headers || {}),
168
+ base_url: request_url
169
+ }
170
+ promise = @client.make_request_async(:get, path_template, options)
171
+
172
+ promise = promise.then do |result|
173
+ http_response = result.response
174
+ status_code = http_response.status
175
+ response_content = http_response.body
176
+ unless status_code == 200
177
+ error_model = JSON.load(response_content)
178
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
179
+ end
180
+
181
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
182
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
183
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
184
+ # Deserialize Response
185
+ if status_code == 200
186
+ begin
187
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
188
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::TenantListResult.mapper()
189
+ result.body = @client.deserialize(result_mapper, parsed_response)
190
+ rescue Exception => e
191
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
192
+ end
193
+ end
194
+
195
+ result
196
+ end
197
+
198
+ promise.execute
199
+ end
200
+
201
+ #
202
+ # Gets the tenants for your account.
203
+ #
204
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
205
+ # will be added to the HTTP request.
206
+ #
207
+ # @return [TenantListResult] which provide lazy access to pages of the
208
+ # response.
209
+ #
210
+ def list_as_lazy(custom_headers:nil)
211
+ response = list_async(custom_headers:custom_headers).value!
212
+ unless response.nil?
213
+ page = response.body
214
+ page.next_method = Proc.new do |next_page_link|
215
+ list_next_async(next_page_link, custom_headers:custom_headers)
216
+ end
217
+ page
218
+ end
219
+ end
220
+
221
+ end
222
+ end