azure_mgmt_subscriptions 0.3.1 → 0.4.0
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.
- checksums.yaml +5 -13
- data/azure_mgmt_subscriptions.gemspec +4 -5
- data/lib/azure_mgmt_subscriptions.rb +3 -34
- data/lib/generated/azure_mgmt_subscriptions.rb +36 -0
- data/lib/generated/azure_mgmt_subscriptions/models/location.rb +95 -0
- data/lib/generated/azure_mgmt_subscriptions/models/location_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_subscriptions/models/subscription.rb +86 -0
- data/lib/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +93 -0
- data/lib/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +54 -0
- data/lib/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +54 -0
- data/lib/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +93 -0
- data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/module_definition.rb +0 -0
- data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/subscription_client.rb +4 -4
- data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/subscriptions.rb +37 -107
- data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/tenants.rb +31 -11
- data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/version.rb +1 -1
- metadata +34 -54
- data/lib/azure_mgmt_subscriptions/models/location.rb +0 -102
- data/lib/azure_mgmt_subscriptions/models/location_list_result.rb +0 -76
- data/lib/azure_mgmt_subscriptions/models/subscription.rb +0 -99
- data/lib/azure_mgmt_subscriptions/models/subscription_list_result.rb +0 -86
- data/lib/azure_mgmt_subscriptions/models/subscription_policies.rb +0 -65
- data/lib/azure_mgmt_subscriptions/models/tenant_id_description.rb +0 -65
- data/lib/azure_mgmt_subscriptions/models/tenant_list_result.rb +0 -86
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Subscriptions
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Subscription policies.
|
10
|
+
#
|
11
|
+
class SubscriptionPolicies
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Gets or sets the subscription location placement Id.
|
16
|
+
attr_accessor :location_placement_id
|
17
|
+
|
18
|
+
# @return [String] Gets or sets the subscription quota Id.
|
19
|
+
attr_accessor :quota_id
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# Mapper for SubscriptionPolicies class as Ruby Hash.
|
24
|
+
# This will be used for serialization/deserialization.
|
25
|
+
#
|
26
|
+
def self.mapper()
|
27
|
+
{
|
28
|
+
required: false,
|
29
|
+
serialized_name: 'SubscriptionPolicies',
|
30
|
+
type: {
|
31
|
+
name: 'Composite',
|
32
|
+
class_name: 'SubscriptionPolicies',
|
33
|
+
model_properties: {
|
34
|
+
location_placement_id: {
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'locationPlacementId',
|
37
|
+
type: {
|
38
|
+
name: 'String'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
quota_id: {
|
42
|
+
required: false,
|
43
|
+
serialized_name: 'quotaId',
|
44
|
+
type: {
|
45
|
+
name: 'String'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Subscriptions
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Tenant Id information
|
10
|
+
#
|
11
|
+
class TenantIdDescription
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Gets or sets Id
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# @return [String] Gets or sets tenantId
|
19
|
+
attr_accessor :tenant_id
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# Mapper for TenantIdDescription class as Ruby Hash.
|
24
|
+
# This will be used for serialization/deserialization.
|
25
|
+
#
|
26
|
+
def self.mapper()
|
27
|
+
{
|
28
|
+
required: false,
|
29
|
+
serialized_name: 'TenantIdDescription',
|
30
|
+
type: {
|
31
|
+
name: 'Composite',
|
32
|
+
class_name: 'TenantIdDescription',
|
33
|
+
model_properties: {
|
34
|
+
id: {
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'id',
|
37
|
+
type: {
|
38
|
+
name: 'String'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
tenant_id: {
|
42
|
+
required: false,
|
43
|
+
serialized_name: 'tenantId',
|
44
|
+
type: {
|
45
|
+
name: 'String'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Subscriptions
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Tenant Ids information.
|
10
|
+
#
|
11
|
+
class TenantListResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Array<TenantIdDescription>] Gets or sets tenant Ids.
|
16
|
+
attr_accessor :value
|
17
|
+
|
18
|
+
# @return [String] Gets or sets the URL to get the next set of results.
|
19
|
+
attr_accessor :next_link
|
20
|
+
|
21
|
+
# return [Proc] with next page method call.
|
22
|
+
attr_accessor :next_method
|
23
|
+
|
24
|
+
#
|
25
|
+
# Gets the rest of the items for the request, enabling auto-pagination.
|
26
|
+
#
|
27
|
+
# @return [Array<TenantIdDescription>] operation results.
|
28
|
+
#
|
29
|
+
def get_all_items
|
30
|
+
items = @value
|
31
|
+
page = self
|
32
|
+
while page.next_link != nil do
|
33
|
+
page = page.get_next_page
|
34
|
+
items.concat(page.value)
|
35
|
+
end
|
36
|
+
items
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Gets the next page of results.
|
41
|
+
#
|
42
|
+
# @return [TenantListResult] with next page content.
|
43
|
+
#
|
44
|
+
def get_next_page
|
45
|
+
response = @next_method.call(@next_link).value! unless @next_method.nil?
|
46
|
+
unless response.nil?
|
47
|
+
@next_link = response.body.next_link
|
48
|
+
@value = response.body.value
|
49
|
+
self
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Mapper for TenantListResult class as Ruby Hash.
|
55
|
+
# This will be used for serialization/deserialization.
|
56
|
+
#
|
57
|
+
def self.mapper()
|
58
|
+
{
|
59
|
+
required: false,
|
60
|
+
serialized_name: 'TenantListResult',
|
61
|
+
type: {
|
62
|
+
name: 'Composite',
|
63
|
+
class_name: 'TenantListResult',
|
64
|
+
model_properties: {
|
65
|
+
value: {
|
66
|
+
required: false,
|
67
|
+
serialized_name: 'value',
|
68
|
+
type: {
|
69
|
+
name: 'Sequence',
|
70
|
+
element: {
|
71
|
+
required: false,
|
72
|
+
serialized_name: 'TenantIdDescriptionElementType',
|
73
|
+
type: {
|
74
|
+
name: 'Composite',
|
75
|
+
class_name: 'TenantIdDescription'
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
},
|
80
|
+
next_link: {
|
81
|
+
required: true,
|
82
|
+
serialized_name: 'nextLink',
|
83
|
+
type: {
|
84
|
+
name: 'String'
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/module_definition.rb
RENAMED
File without changes
|
data/lib/{azure_mgmt_subscriptions → generated/azure_mgmt_subscriptions}/subscription_client.rb
RENAMED
@@ -8,13 +8,13 @@ module Azure::ARM::Subscriptions
|
|
8
8
|
# A service client - single point of access to the REST API.
|
9
9
|
#
|
10
10
|
class SubscriptionClient < MsRestAzure::AzureServiceClient
|
11
|
-
include
|
11
|
+
include MsRest::Serialization
|
12
12
|
include MsRestAzure
|
13
13
|
|
14
14
|
# @return [String] the base URI of the service.
|
15
15
|
attr_accessor :base_url
|
16
16
|
|
17
|
-
# @return
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
18
|
attr_reader :credentials
|
19
19
|
|
20
20
|
# @return [String] Client Api Version.
|
@@ -35,10 +35,10 @@ module Azure::ARM::Subscriptions
|
|
35
35
|
# subscription.
|
36
36
|
attr_accessor :credentials
|
37
37
|
|
38
|
-
# @return subscriptions
|
38
|
+
# @return [Subscriptions] subscriptions
|
39
39
|
attr_reader :subscriptions
|
40
40
|
|
41
|
-
# @return tenants
|
41
|
+
# @return [Tenants] tenants
|
42
42
|
attr_reader :tenants
|
43
43
|
|
44
44
|
#
|
@@ -61,6 +61,8 @@ module Azure::ARM::Subscriptions
|
|
61
61
|
def list_locations_async(subscription_id, custom_headers = nil)
|
62
62
|
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
63
63
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
64
|
+
|
65
|
+
|
64
66
|
request_headers = {}
|
65
67
|
|
66
68
|
# Set Headers
|
@@ -96,10 +98,8 @@ module Azure::ARM::Subscriptions
|
|
96
98
|
if status_code == 200
|
97
99
|
begin
|
98
100
|
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
99
|
-
|
100
|
-
|
101
|
-
end
|
102
|
-
result.body = parsed_response
|
101
|
+
result_mapper = LocationListResult.mapper()
|
102
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
103
103
|
rescue Exception => e
|
104
104
|
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
105
105
|
end
|
@@ -150,6 +150,8 @@ module Azure::ARM::Subscriptions
|
|
150
150
|
def get_async(subscription_id, custom_headers = nil)
|
151
151
|
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
152
152
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
153
|
+
|
154
|
+
|
153
155
|
request_headers = {}
|
154
156
|
|
155
157
|
# Set Headers
|
@@ -185,10 +187,8 @@ module Azure::ARM::Subscriptions
|
|
185
187
|
if status_code == 200
|
186
188
|
begin
|
187
189
|
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
188
|
-
|
189
|
-
|
190
|
-
end
|
191
|
-
result.body = parsed_response
|
190
|
+
result_mapper = Subscription.mapper()
|
191
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
192
192
|
rescue Exception => e
|
193
193
|
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
194
194
|
end
|
@@ -206,134 +206,66 @@ module Azure::ARM::Subscriptions
|
|
206
206
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
207
207
|
# will be added to the HTTP request.
|
208
208
|
#
|
209
|
-
# @return [SubscriptionListResult]
|
209
|
+
# @return [SubscriptionListResult] which provide lazy access to pages of the
|
210
|
+
# response.
|
210
211
|
#
|
211
|
-
def
|
212
|
+
def list_as_lazy(custom_headers = nil)
|
212
213
|
response = list_async(custom_headers).value!
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
# Gets a list of the subscriptionIds.
|
218
|
-
#
|
219
|
-
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
220
|
-
# will be added to the HTTP request.
|
221
|
-
#
|
222
|
-
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
223
|
-
#
|
224
|
-
def list_with_http_info(custom_headers = nil)
|
225
|
-
list_async(custom_headers).value!
|
226
|
-
end
|
227
|
-
|
228
|
-
#
|
229
|
-
# Gets a list of the subscriptionIds.
|
230
|
-
#
|
231
|
-
# @param [Hash{String => String}] A hash of custom headers that will be added
|
232
|
-
# to the HTTP request.
|
233
|
-
#
|
234
|
-
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
235
|
-
#
|
236
|
-
def list_async(custom_headers = nil)
|
237
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
238
|
-
request_headers = {}
|
239
|
-
|
240
|
-
# Set Headers
|
241
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
242
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
243
|
-
path_template = '/subscriptions'
|
244
|
-
options = {
|
245
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
246
|
-
query_params: {'api-version' => @client.api_version},
|
247
|
-
headers: request_headers.merge(custom_headers || {})
|
248
|
-
}
|
249
|
-
|
250
|
-
request_url = @base_url || @client.base_url
|
251
|
-
|
252
|
-
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
253
|
-
promise = request.run_promise do |req|
|
254
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
255
|
-
end
|
256
|
-
|
257
|
-
promise = promise.then do |http_response|
|
258
|
-
status_code = http_response.status
|
259
|
-
response_content = http_response.body
|
260
|
-
unless status_code == 200
|
261
|
-
error_model = JSON.load(response_content)
|
262
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
214
|
+
unless response.nil?
|
215
|
+
page = response.body
|
216
|
+
page.next_method = Proc.new do |next_link|
|
217
|
+
list_next_async(next_link, custom_headers)
|
263
218
|
end
|
264
|
-
|
265
|
-
# Create Result
|
266
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
267
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
268
|
-
# Deserialize Response
|
269
|
-
if status_code == 200
|
270
|
-
begin
|
271
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
272
|
-
unless parsed_response.nil?
|
273
|
-
parsed_response = SubscriptionListResult.deserialize_object(parsed_response)
|
274
|
-
end
|
275
|
-
result.body = parsed_response
|
276
|
-
rescue Exception => e
|
277
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
result
|
219
|
+
page
|
282
220
|
end
|
283
|
-
|
284
|
-
promise.execute
|
285
221
|
end
|
286
222
|
|
287
223
|
#
|
288
|
-
# Gets a list of the
|
224
|
+
# Gets a list of the subscriptionIds.
|
289
225
|
#
|
290
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
291
|
-
# call to List operation.
|
292
226
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
293
227
|
# will be added to the HTTP request.
|
294
228
|
#
|
295
|
-
# @return [
|
229
|
+
# @return [Array<Subscription>] operation results.
|
296
230
|
#
|
297
|
-
def
|
298
|
-
|
299
|
-
|
231
|
+
def list(custom_headers = nil)
|
232
|
+
first_page = list_as_lazy(custom_headers)
|
233
|
+
first_page.get_all_items
|
300
234
|
end
|
301
235
|
|
302
236
|
#
|
303
|
-
# Gets a list of the
|
237
|
+
# Gets a list of the subscriptionIds.
|
304
238
|
#
|
305
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
306
|
-
# call to List operation.
|
307
239
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
308
240
|
# will be added to the HTTP request.
|
309
241
|
#
|
310
242
|
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
311
243
|
#
|
312
|
-
def
|
313
|
-
|
244
|
+
def list_with_http_info(custom_headers = nil)
|
245
|
+
list_async(custom_headers).value!
|
314
246
|
end
|
315
247
|
|
316
248
|
#
|
317
|
-
# Gets a list of the
|
249
|
+
# Gets a list of the subscriptionIds.
|
318
250
|
#
|
319
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
320
|
-
# call to List operation.
|
321
251
|
# @param [Hash{String => String}] A hash of custom headers that will be added
|
322
252
|
# to the HTTP request.
|
323
253
|
#
|
324
254
|
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
325
255
|
#
|
326
|
-
def
|
327
|
-
fail ArgumentError, '
|
256
|
+
def list_async(custom_headers = nil)
|
257
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
258
|
+
|
259
|
+
|
328
260
|
request_headers = {}
|
329
261
|
|
330
262
|
# Set Headers
|
331
263
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
332
264
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
333
|
-
path_template = '
|
265
|
+
path_template = '/subscriptions'
|
334
266
|
options = {
|
335
267
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
336
|
-
|
268
|
+
query_params: {'api-version' => @client.api_version},
|
337
269
|
headers: request_headers.merge(custom_headers || {})
|
338
270
|
}
|
339
271
|
|
@@ -359,10 +291,8 @@ module Azure::ARM::Subscriptions
|
|
359
291
|
if status_code == 200
|
360
292
|
begin
|
361
293
|
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
362
|
-
|
363
|
-
|
364
|
-
end
|
365
|
-
result.body = parsed_response
|
294
|
+
result_mapper = SubscriptionListResult.mapper()
|
295
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
366
296
|
rescue Exception => e
|
367
297
|
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
368
298
|
end
|
@@ -415,6 +345,8 @@ module Azure::ARM::Subscriptions
|
|
415
345
|
#
|
416
346
|
def list_next_async(next_page_link, custom_headers = nil)
|
417
347
|
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
348
|
+
|
349
|
+
|
418
350
|
request_headers = {}
|
419
351
|
|
420
352
|
# Set Headers
|
@@ -449,10 +381,8 @@ module Azure::ARM::Subscriptions
|
|
449
381
|
if status_code == 200
|
450
382
|
begin
|
451
383
|
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
452
|
-
|
453
|
-
|
454
|
-
end
|
455
|
-
result.body = parsed_response
|
384
|
+
result_mapper = SubscriptionListResult.mapper()
|
385
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
456
386
|
rescue Exception => e
|
457
387
|
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
458
388
|
end
|