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.
- checksums.yaml +4 -4
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
- data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions.rb +43 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location.rb +108 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +55 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription.rb +145 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +98 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +76 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +61 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +98 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscriptions.rb +409 -0
- data/lib/2019-06-01/generated/azure_mgmt_subscriptions/tenants.rb +222 -0
- data/lib/azure_mgmt_subscriptions.rb +1 -0
- data/lib/profiles/latest/modules/subscriptions_profile_module.rb +68 -56
- data/lib/version.rb +1 -1
- metadata +21 -2
@@ -0,0 +1,61 @@
|
|
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
|
+
module Models
|
8
|
+
#
|
9
|
+
# Tenant Id information.
|
10
|
+
#
|
11
|
+
class TenantIdDescription
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] The fully qualified ID of the tenant. For example,
|
16
|
+
# /tenants/00000000-0000-0000-0000-000000000000.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# @return [String] The tenant ID. For example,
|
20
|
+
# 00000000-0000-0000-0000-000000000000.
|
21
|
+
attr_accessor :tenant_id
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Mapper for TenantIdDescription class as Ruby Hash.
|
26
|
+
# This will be used for serialization/deserialization.
|
27
|
+
#
|
28
|
+
def self.mapper()
|
29
|
+
{
|
30
|
+
client_side_validation: true,
|
31
|
+
required: false,
|
32
|
+
serialized_name: 'TenantIdDescription',
|
33
|
+
type: {
|
34
|
+
name: 'Composite',
|
35
|
+
class_name: 'TenantIdDescription',
|
36
|
+
model_properties: {
|
37
|
+
id: {
|
38
|
+
client_side_validation: true,
|
39
|
+
required: false,
|
40
|
+
read_only: true,
|
41
|
+
serialized_name: 'id',
|
42
|
+
type: {
|
43
|
+
name: 'String'
|
44
|
+
}
|
45
|
+
},
|
46
|
+
tenant_id: {
|
47
|
+
client_side_validation: true,
|
48
|
+
required: false,
|
49
|
+
read_only: true,
|
50
|
+
serialized_name: 'tenantId',
|
51
|
+
type: {
|
52
|
+
name: 'String'
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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
|
+
module Models
|
8
|
+
#
|
9
|
+
# Tenant Ids information.
|
10
|
+
#
|
11
|
+
class TenantListResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
include MsRest::JSONable
|
16
|
+
# @return [Array<TenantIdDescription>] An array of tenants.
|
17
|
+
attr_accessor :value
|
18
|
+
|
19
|
+
# @return [String] The URL to use for getting the next set of results.
|
20
|
+
attr_accessor :next_link
|
21
|
+
|
22
|
+
# return [Proc] with next page method call.
|
23
|
+
attr_accessor :next_method
|
24
|
+
|
25
|
+
#
|
26
|
+
# Gets the rest of the items for the request, enabling auto-pagination.
|
27
|
+
#
|
28
|
+
# @return [Array<TenantIdDescription>] operation results.
|
29
|
+
#
|
30
|
+
def get_all_items
|
31
|
+
items = @value
|
32
|
+
page = self
|
33
|
+
while page.next_link != nil && !page.next_link.strip.empty? do
|
34
|
+
page = page.get_next_page
|
35
|
+
items.concat(page.value)
|
36
|
+
end
|
37
|
+
items
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Gets the next page of results.
|
42
|
+
#
|
43
|
+
# @return [TenantListResult] with next page content.
|
44
|
+
#
|
45
|
+
def get_next_page
|
46
|
+
response = @next_method.call(@next_link).value! unless @next_method.nil?
|
47
|
+
unless response.nil?
|
48
|
+
@next_link = response.body.next_link
|
49
|
+
@value = response.body.value
|
50
|
+
self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Mapper for TenantListResult class as Ruby Hash.
|
56
|
+
# This will be used for serialization/deserialization.
|
57
|
+
#
|
58
|
+
def self.mapper()
|
59
|
+
{
|
60
|
+
client_side_validation: true,
|
61
|
+
required: false,
|
62
|
+
serialized_name: 'TenantListResult',
|
63
|
+
type: {
|
64
|
+
name: 'Composite',
|
65
|
+
class_name: 'TenantListResult',
|
66
|
+
model_properties: {
|
67
|
+
value: {
|
68
|
+
client_side_validation: true,
|
69
|
+
required: false,
|
70
|
+
serialized_name: 'value',
|
71
|
+
type: {
|
72
|
+
name: 'Sequence',
|
73
|
+
element: {
|
74
|
+
client_side_validation: true,
|
75
|
+
required: false,
|
76
|
+
serialized_name: 'TenantIdDescriptionElementType',
|
77
|
+
type: {
|
78
|
+
name: 'Composite',
|
79
|
+
class_name: 'TenantIdDescription'
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
},
|
84
|
+
next_link: {
|
85
|
+
client_side_validation: true,
|
86
|
+
required: true,
|
87
|
+
serialized_name: 'nextLink',
|
88
|
+
type: {
|
89
|
+
name: 'String'
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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 end
|
7
|
+
module Azure::Subscriptions end
|
8
|
+
module Azure::Subscriptions::Mgmt end
|
9
|
+
module Azure::Subscriptions::Mgmt::V2019_06_01 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 Operations
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
#
|
17
|
+
# Creates and initializes a new instance of the Operations 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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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<Operation>] 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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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 = 'providers/Microsoft.Resources/operations'
|
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::OperationListResult.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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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 [OperationListResult] 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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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::OperationListResult.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
|
+
# Lists all of the available Microsoft.Resources REST API operations.
|
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 [OperationListResult] 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
|
@@ -0,0 +1,136 @@
|
|
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
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class SubscriptionClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] The API version to use for the operation.
|
21
|
+
attr_reader :api_version
|
22
|
+
|
23
|
+
# @return [String] The preferred language for the response.
|
24
|
+
attr_accessor :accept_language
|
25
|
+
|
26
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
27
|
+
# Operations. Default value is 30.
|
28
|
+
attr_accessor :long_running_operation_retry_timeout
|
29
|
+
|
30
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
31
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
32
|
+
# generated and included in each request. Default is true.
|
33
|
+
attr_accessor :generate_client_request_id
|
34
|
+
|
35
|
+
# @return [Operations] operations
|
36
|
+
attr_reader :operations
|
37
|
+
|
38
|
+
# @return [Subscriptions] subscriptions
|
39
|
+
attr_reader :subscriptions
|
40
|
+
|
41
|
+
# @return [Tenants] 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 = nil, base_url = nil, options = nil)
|
51
|
+
super(credentials, options)
|
52
|
+
@base_url = base_url || 'https://management.azure.com'
|
53
|
+
|
54
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
55
|
+
@credentials = credentials
|
56
|
+
|
57
|
+
@operations = Operations.new(self)
|
58
|
+
@subscriptions = Subscriptions.new(self)
|
59
|
+
@tenants = Tenants.new(self)
|
60
|
+
@api_version = '2019-06-01'
|
61
|
+
@accept_language = 'en-US'
|
62
|
+
@long_running_operation_retry_timeout = 30
|
63
|
+
@generate_client_request_id = true
|
64
|
+
add_telemetry
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# Makes a request and returns the body of the response.
|
69
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
70
|
+
# @param path [String] the path, relative to {base_url}.
|
71
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
72
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
73
|
+
# Example:
|
74
|
+
#
|
75
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
76
|
+
# path = "/path"
|
77
|
+
# options = {
|
78
|
+
# body: request_content,
|
79
|
+
# query_params: {'api-version' => '2016-02-01'}
|
80
|
+
# }
|
81
|
+
# result = @client.make_request(:put, path, options)
|
82
|
+
#
|
83
|
+
def make_request(method, path, options = {})
|
84
|
+
result = make_request_with_http_info(method, path, options)
|
85
|
+
result.body unless result.nil?
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# Makes a request and returns the operation response.
|
90
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
91
|
+
# @param path [String] the path, relative to {base_url}.
|
92
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
93
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
94
|
+
#
|
95
|
+
def make_request_with_http_info(method, path, options = {})
|
96
|
+
result = make_request_async(method, path, options).value!
|
97
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
98
|
+
result
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Makes a request asynchronously.
|
103
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
104
|
+
# @param path [String] the path, relative to {base_url}.
|
105
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
106
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
107
|
+
#
|
108
|
+
def make_request_async(method, path, options = {})
|
109
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
110
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
111
|
+
|
112
|
+
request_url = options[:base_url] || @base_url
|
113
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
114
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
115
|
+
end
|
116
|
+
|
117
|
+
request_headers = @request_headers
|
118
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
119
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
120
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
121
|
+
|
122
|
+
super(request_url, method, path, options)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
private
|
127
|
+
#
|
128
|
+
# Adds telemetry information.
|
129
|
+
#
|
130
|
+
def add_telemetry
|
131
|
+
sdk_information = 'azure_mgmt_subscriptions'
|
132
|
+
sdk_information = "#{sdk_information}/0.18.1"
|
133
|
+
add_user_agent_information(sdk_information)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|