azure_mgmt_subscriptions 0.2.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 +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_subscriptions.gemspec +35 -0
- data/lib/azure_mgmt_subscriptions.rb +35 -0
- data/lib/azure_mgmt_subscriptions/models/location.rb +102 -0
- data/lib/azure_mgmt_subscriptions/models/location_list_result.rb +76 -0
- data/lib/azure_mgmt_subscriptions/models/subscription.rb +99 -0
- data/lib/azure_mgmt_subscriptions/models/subscription_list_result.rb +86 -0
- data/lib/azure_mgmt_subscriptions/models/subscription_policies.rb +65 -0
- data/lib/azure_mgmt_subscriptions/models/tenant_id_description.rb +65 -0
- data/lib/azure_mgmt_subscriptions/models/tenant_list_result.rb +86 -0
- data/lib/azure_mgmt_subscriptions/module_definition.rb +8 -0
- data/lib/azure_mgmt_subscriptions/subscription_client.rb +67 -0
- data/lib/azure_mgmt_subscriptions/subscriptions.rb +321 -0
- data/lib/azure_mgmt_subscriptions/tenants.rb +142 -0
- data/lib/azure_mgmt_subscriptions/version.rb +8 -0
- metadata +145 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.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
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
# Nothing to validate
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.location_placement_id
|
38
|
+
output_object['locationPlacementId'] = serialized_property unless serialized_property.nil?
|
39
|
+
|
40
|
+
serialized_property = object.quota_id
|
41
|
+
output_object['quotaId'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
output_object
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Deserializes given Ruby Hash into Model object.
|
48
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
49
|
+
# @return [SubscriptionPolicies] Deserialized object.
|
50
|
+
#
|
51
|
+
def self.deserialize_object(object)
|
52
|
+
return if object.nil?
|
53
|
+
output_object = SubscriptionPolicies.new
|
54
|
+
|
55
|
+
deserialized_property = object['locationPlacementId']
|
56
|
+
output_object.location_placement_id = deserialized_property
|
57
|
+
|
58
|
+
deserialized_property = object['quotaId']
|
59
|
+
output_object.quota_id = deserialized_property
|
60
|
+
|
61
|
+
output_object
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.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
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
# Nothing to validate
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.id
|
38
|
+
output_object['id'] = serialized_property unless serialized_property.nil?
|
39
|
+
|
40
|
+
serialized_property = object.tenant_id
|
41
|
+
output_object['tenantId'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
output_object
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Deserializes given Ruby Hash into Model object.
|
48
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
49
|
+
# @return [TenantIdDescription] Deserialized object.
|
50
|
+
#
|
51
|
+
def self.deserialize_object(object)
|
52
|
+
return if object.nil?
|
53
|
+
output_object = TenantIdDescription.new
|
54
|
+
|
55
|
+
deserialized_property = object['id']
|
56
|
+
output_object.id = deserialized_property
|
57
|
+
|
58
|
+
deserialized_property = object['tenantId']
|
59
|
+
output_object.tenant_id = deserialized_property
|
60
|
+
|
61
|
+
output_object
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.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
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
fail MsRest::ValidationError, 'property next_link is nil' if @next_link.nil?
|
26
|
+
@value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Serializes given Model object into Ruby Hash.
|
31
|
+
# @param object Model object to serialize.
|
32
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
33
|
+
#
|
34
|
+
def self.serialize_object(object)
|
35
|
+
object.validate
|
36
|
+
output_object = {}
|
37
|
+
|
38
|
+
serialized_property = object.next_link
|
39
|
+
output_object['nextLink'] = serialized_property unless serialized_property.nil?
|
40
|
+
|
41
|
+
serialized_property = object.value
|
42
|
+
unless serialized_property.nil?
|
43
|
+
serializedArray = []
|
44
|
+
serialized_property.each do |element|
|
45
|
+
unless element.nil?
|
46
|
+
element = TenantIdDescription.serialize_object(element)
|
47
|
+
end
|
48
|
+
serializedArray.push(element)
|
49
|
+
end
|
50
|
+
serialized_property = serializedArray
|
51
|
+
end
|
52
|
+
output_object['value'] = serialized_property unless serialized_property.nil?
|
53
|
+
|
54
|
+
output_object
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Deserializes given Ruby Hash into Model object.
|
59
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
60
|
+
# @return [TenantListResult] Deserialized object.
|
61
|
+
#
|
62
|
+
def self.deserialize_object(object)
|
63
|
+
return if object.nil?
|
64
|
+
output_object = TenantListResult.new
|
65
|
+
|
66
|
+
deserialized_property = object['nextLink']
|
67
|
+
output_object.next_link = deserialized_property
|
68
|
+
|
69
|
+
deserialized_property = object['value']
|
70
|
+
unless deserialized_property.nil?
|
71
|
+
deserialized_array = []
|
72
|
+
deserialized_property.each do |element1|
|
73
|
+
unless element1.nil?
|
74
|
+
element1 = TenantIdDescription.deserialize_object(element1)
|
75
|
+
end
|
76
|
+
deserialized_array.push(element1)
|
77
|
+
end
|
78
|
+
deserialized_property = deserialized_array
|
79
|
+
end
|
80
|
+
output_object.value = deserialized_property
|
81
|
+
|
82
|
+
output_object
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.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
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class SubscriptionClient < MsRestAzure::AzureServiceClient
|
11
|
+
include Azure::ARM::Subscriptions::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Gets Azure subscription credentials.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] Client Api Version.
|
21
|
+
attr_reader :api_version
|
22
|
+
|
23
|
+
# @return [String] Gets or sets the preferred language for the response.
|
24
|
+
attr_accessor :accept_language
|
25
|
+
|
26
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
27
|
+
# Running Operations. Default value is 30.
|
28
|
+
attr_accessor :long_running_operation_retry_timeout
|
29
|
+
|
30
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
31
|
+
# is generated and included in each request. Default is true.
|
32
|
+
attr_accessor :generate_client_request_id
|
33
|
+
|
34
|
+
# @return Subscription credentials which uniquely identify client
|
35
|
+
# subscription.
|
36
|
+
attr_accessor :credentials
|
37
|
+
|
38
|
+
# @return subscriptions
|
39
|
+
attr_reader :subscriptions
|
40
|
+
|
41
|
+
# @return tenants
|
42
|
+
attr_reader :tenants
|
43
|
+
|
44
|
+
#
|
45
|
+
# Creates initializes a new instance of the SubscriptionClient class.
|
46
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
47
|
+
# @param base_url [String] the base URI of the service.
|
48
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
49
|
+
#
|
50
|
+
def initialize(credentials, base_url = nil, options = nil)
|
51
|
+
super(credentials, options)
|
52
|
+
@base_url = base_url || 'https://management.azure.com'
|
53
|
+
|
54
|
+
fail ArgumentError, 'credentials is nil' if credentials.nil?
|
55
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
|
56
|
+
@credentials = credentials
|
57
|
+
|
58
|
+
@subscriptions = Subscriptions.new(self)
|
59
|
+
@tenants = Tenants.new(self)
|
60
|
+
@api_version = '2015-11-01'
|
61
|
+
@accept_language = 'en-US'
|
62
|
+
@long_running_operation_retry_timeout = 30
|
63
|
+
@generate_client_request_id = true
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,321 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.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
|
+
#
|
8
|
+
# Subscriptions
|
9
|
+
#
|
10
|
+
class Subscriptions
|
11
|
+
include Azure::ARM::Subscriptions::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Subscriptions class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the SubscriptionClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Gets a list of the subscription locations.
|
27
|
+
#
|
28
|
+
# @param subscription_id [String] Id of the subscription
|
29
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
30
|
+
# applied to HTTP request.
|
31
|
+
#
|
32
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
33
|
+
# response.
|
34
|
+
#
|
35
|
+
def list_locations(subscription_id, custom_headers = nil)
|
36
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
37
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
38
|
+
request_headers = {}
|
39
|
+
|
40
|
+
# Set Headers
|
41
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
42
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
43
|
+
path_template = '/subscriptions/{subscriptionId}/locations'
|
44
|
+
options = {
|
45
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
46
|
+
path_params: {'subscriptionId' => subscription_id},
|
47
|
+
query_params: {'api-version' => @client.api_version},
|
48
|
+
headers: request_headers.merge(custom_headers || {})
|
49
|
+
}
|
50
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
51
|
+
promise = request.run_promise do |req|
|
52
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
53
|
+
end
|
54
|
+
|
55
|
+
promise = promise.then do |http_response|
|
56
|
+
status_code = http_response.status
|
57
|
+
response_content = http_response.body
|
58
|
+
unless status_code == 200
|
59
|
+
error_model = JSON.load(response_content)
|
60
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Create Result
|
64
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
65
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
66
|
+
# Deserialize Response
|
67
|
+
if status_code == 200
|
68
|
+
begin
|
69
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
70
|
+
unless parsed_response.nil?
|
71
|
+
parsed_response = LocationListResult.deserialize_object(parsed_response)
|
72
|
+
end
|
73
|
+
result.body = parsed_response
|
74
|
+
rescue Exception => e
|
75
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
82
|
+
promise.execute
|
83
|
+
end
|
84
|
+
|
85
|
+
#
|
86
|
+
# Gets details about particular subscription.
|
87
|
+
#
|
88
|
+
# @param subscription_id [String] Id of the subscription.
|
89
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
90
|
+
# applied to HTTP request.
|
91
|
+
#
|
92
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
93
|
+
# response.
|
94
|
+
#
|
95
|
+
def get(subscription_id, custom_headers = nil)
|
96
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
97
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
98
|
+
request_headers = {}
|
99
|
+
|
100
|
+
# Set Headers
|
101
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
102
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
103
|
+
path_template = '/subscriptions/{subscriptionId}'
|
104
|
+
options = {
|
105
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
106
|
+
path_params: {'subscriptionId' => subscription_id},
|
107
|
+
query_params: {'api-version' => @client.api_version},
|
108
|
+
headers: request_headers.merge(custom_headers || {})
|
109
|
+
}
|
110
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
111
|
+
promise = request.run_promise do |req|
|
112
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
113
|
+
end
|
114
|
+
|
115
|
+
promise = promise.then do |http_response|
|
116
|
+
status_code = http_response.status
|
117
|
+
response_content = http_response.body
|
118
|
+
unless status_code == 200
|
119
|
+
error_model = JSON.load(response_content)
|
120
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Create Result
|
124
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
125
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
126
|
+
# Deserialize Response
|
127
|
+
if status_code == 200
|
128
|
+
begin
|
129
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
130
|
+
unless parsed_response.nil?
|
131
|
+
parsed_response = Subscription.deserialize_object(parsed_response)
|
132
|
+
end
|
133
|
+
result.body = parsed_response
|
134
|
+
rescue Exception => e
|
135
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
result
|
140
|
+
end
|
141
|
+
|
142
|
+
promise.execute
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
# Gets a list of the subscriptionIds.
|
147
|
+
#
|
148
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
149
|
+
# applied to HTTP request.
|
150
|
+
#
|
151
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
152
|
+
# response.
|
153
|
+
#
|
154
|
+
def list(custom_headers = nil)
|
155
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
156
|
+
request_headers = {}
|
157
|
+
|
158
|
+
# Set Headers
|
159
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
160
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
161
|
+
path_template = '/subscriptions'
|
162
|
+
options = {
|
163
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
164
|
+
query_params: {'api-version' => @client.api_version},
|
165
|
+
headers: request_headers.merge(custom_headers || {})
|
166
|
+
}
|
167
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
168
|
+
promise = request.run_promise do |req|
|
169
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
170
|
+
end
|
171
|
+
|
172
|
+
promise = promise.then do |http_response|
|
173
|
+
status_code = http_response.status
|
174
|
+
response_content = http_response.body
|
175
|
+
unless status_code == 200
|
176
|
+
error_model = JSON.load(response_content)
|
177
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Create Result
|
181
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
182
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
183
|
+
# Deserialize Response
|
184
|
+
if status_code == 200
|
185
|
+
begin
|
186
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
187
|
+
unless parsed_response.nil?
|
188
|
+
parsed_response = SubscriptionListResult.deserialize_object(parsed_response)
|
189
|
+
end
|
190
|
+
result.body = parsed_response
|
191
|
+
rescue Exception => e
|
192
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
result
|
197
|
+
end
|
198
|
+
|
199
|
+
promise.execute
|
200
|
+
end
|
201
|
+
|
202
|
+
#
|
203
|
+
# Gets a list of the subscription locations.
|
204
|
+
#
|
205
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
206
|
+
# call to List operation.
|
207
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
208
|
+
# applied to HTTP request.
|
209
|
+
#
|
210
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
211
|
+
# response.
|
212
|
+
#
|
213
|
+
def list_locations_next(next_page_link, custom_headers = nil)
|
214
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
215
|
+
request_headers = {}
|
216
|
+
|
217
|
+
# Set Headers
|
218
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
219
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
220
|
+
path_template = '{nextLink}'
|
221
|
+
options = {
|
222
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
223
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
224
|
+
headers: request_headers.merge(custom_headers || {})
|
225
|
+
}
|
226
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
227
|
+
promise = request.run_promise do |req|
|
228
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
229
|
+
end
|
230
|
+
|
231
|
+
promise = promise.then do |http_response|
|
232
|
+
status_code = http_response.status
|
233
|
+
response_content = http_response.body
|
234
|
+
unless status_code == 200
|
235
|
+
error_model = JSON.load(response_content)
|
236
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
237
|
+
end
|
238
|
+
|
239
|
+
# Create Result
|
240
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
241
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
242
|
+
# Deserialize Response
|
243
|
+
if status_code == 200
|
244
|
+
begin
|
245
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
246
|
+
unless parsed_response.nil?
|
247
|
+
parsed_response = LocationListResult.deserialize_object(parsed_response)
|
248
|
+
end
|
249
|
+
result.body = parsed_response
|
250
|
+
rescue Exception => e
|
251
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
result
|
256
|
+
end
|
257
|
+
|
258
|
+
promise.execute
|
259
|
+
end
|
260
|
+
|
261
|
+
#
|
262
|
+
# Gets a list of the subscriptionIds.
|
263
|
+
#
|
264
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
265
|
+
# call to List operation.
|
266
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
267
|
+
# applied to HTTP request.
|
268
|
+
#
|
269
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
270
|
+
# response.
|
271
|
+
#
|
272
|
+
def list_next(next_page_link, custom_headers = nil)
|
273
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
274
|
+
request_headers = {}
|
275
|
+
|
276
|
+
# Set Headers
|
277
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
278
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
279
|
+
path_template = '{nextLink}'
|
280
|
+
options = {
|
281
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
282
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
283
|
+
headers: request_headers.merge(custom_headers || {})
|
284
|
+
}
|
285
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
286
|
+
promise = request.run_promise do |req|
|
287
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
288
|
+
end
|
289
|
+
|
290
|
+
promise = promise.then do |http_response|
|
291
|
+
status_code = http_response.status
|
292
|
+
response_content = http_response.body
|
293
|
+
unless status_code == 200
|
294
|
+
error_model = JSON.load(response_content)
|
295
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
296
|
+
end
|
297
|
+
|
298
|
+
# Create Result
|
299
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
300
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
301
|
+
# Deserialize Response
|
302
|
+
if status_code == 200
|
303
|
+
begin
|
304
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
305
|
+
unless parsed_response.nil?
|
306
|
+
parsed_response = SubscriptionListResult.deserialize_object(parsed_response)
|
307
|
+
end
|
308
|
+
result.body = parsed_response
|
309
|
+
rescue Exception => e
|
310
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
result
|
315
|
+
end
|
316
|
+
|
317
|
+
promise.execute
|
318
|
+
end
|
319
|
+
|
320
|
+
end
|
321
|
+
end
|