ms_rest_azure2 0.12.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/{ms_rest_azure → ms_rest_azure2}/active_directory_service_settings.rb +6 -6
- data/lib/{ms_rest_azure → ms_rest_azure2}/async_operation_status.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/azure_cli_error.rb +1 -1
- data/lib/{ms_rest_azure → ms_rest_azure2}/azure_environment.rb +1 -1
- data/lib/{ms_rest_azure → ms_rest_azure2}/azure_operation_error.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/azure_operation_response.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/azure_service_client.rb +30 -30
- data/lib/{ms_rest_azure → ms_rest_azure2}/cloud_error_data.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/common/configurable.rb +10 -10
- data/lib/{ms_rest_azure → ms_rest_azure2}/common/default.rb +4 -4
- data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/application_token_provider.rb +3 -3
- data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/azure_cli_token_provider.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/cognitive_services_credentials.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/msi_token_provider.rb +5 -5
- data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/topic_credentials.rb +2 -2
- data/lib/{ms_rest_azure → ms_rest_azure2}/final_state_via.rb +1 -1
- data/lib/{ms_rest_azure → ms_rest_azure2}/polling_state.rb +5 -5
- data/lib/{ms_rest_azure → ms_rest_azure2}/serialization.rb +5 -5
- data/lib/{ms_rest_azure → ms_rest_azure2}/typed_error_info.rb +1 -1
- data/lib/{ms_rest_azure → ms_rest_azure2}/version.rb +2 -2
- data/lib/ms_rest_azure2.rb +32 -0
- metadata +30 -30
- data/lib/ms_rest_azure.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8273d614651e57948efc84f6beb26d73a4c243b1fa29f1dbb41bc3280f126341
|
4
|
+
data.tar.gz: 49b2b0aca01720af6cd7d892e2395b5778b69523d651d5749de4672bfc284bef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a1863315d5b1bb20e1b1a846713840a005e3bec286d61af2fa0f35df1575feae01b414762cf7b93acefd48e636bb5a1e4dc98caa8c52b82bc931c962baa914
|
7
|
+
data.tar.gz: e99d917295ae6f90513be3ab3835b0ff2744deb2a912fc288870c4170c598e1f569f5f50edf0e8ac0db2bc7502f45914a1b2690264259d294a87a97dfb527c6e
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ MSI support has been enabled in `ms_rest_azure` version `0.9.0`. Below code snip
|
|
47
47
|
|
48
48
|
```ruby
|
49
49
|
provider = MsRestAzure::MSITokenProvider.new()
|
50
|
-
credentials =
|
50
|
+
credentials = MsRest2::TokenCredentials.new(provider)
|
51
51
|
```
|
52
52
|
|
53
53
|
**Note**: As of 04/04/2018, there are 2 supported ways to get MSI Token.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents an settings for Azure AD authentication.
|
8
8
|
#
|
@@ -19,7 +19,7 @@ module MsRestAzure
|
|
19
19
|
#
|
20
20
|
# @return [ActiveDirectoryServiceSettings] settings required for authentication.
|
21
21
|
def self.get_azure_settings
|
22
|
-
get_settings(
|
22
|
+
get_settings(MsRestAzure2::AzureEnvironments::AzureCloud)
|
23
23
|
end
|
24
24
|
|
25
25
|
#
|
@@ -27,7 +27,7 @@ module MsRestAzure
|
|
27
27
|
#
|
28
28
|
# @return [ActiveDirectoryServiceSettings] settings required for authentication.
|
29
29
|
def self.get_azure_china_settings
|
30
|
-
get_settings(
|
30
|
+
get_settings(MsRestAzure2::AzureEnvironments::AzureChinaCloud)
|
31
31
|
end
|
32
32
|
|
33
33
|
#
|
@@ -35,7 +35,7 @@ module MsRestAzure
|
|
35
35
|
#
|
36
36
|
# @return [ActiveDirectoryServiceSettings] settings required for authentication.
|
37
37
|
def self.get_azure_german_settings
|
38
|
-
get_settings(
|
38
|
+
get_settings(MsRestAzure2::AzureEnvironments::AzureGermanCloud)
|
39
39
|
end
|
40
40
|
|
41
41
|
#
|
@@ -43,7 +43,7 @@ module MsRestAzure
|
|
43
43
|
#
|
44
44
|
# @return [ActiveDirectoryServiceSettings] settings required for authentication.
|
45
45
|
def self.get_azure_us_government_settings
|
46
|
-
get_settings(
|
46
|
+
get_settings(MsRestAzure2::AzureEnvironments::AzureUSGovernment)
|
47
47
|
end
|
48
48
|
|
49
49
|
private
|
@@ -53,7 +53,7 @@ module MsRestAzure
|
|
53
53
|
#
|
54
54
|
# @param azure_environment [AzureEnvironment] An instance of AzureEnvironment.
|
55
55
|
# @return [ActiveDirectoryServiceSettings] settings required for authentication.
|
56
|
-
def self.get_settings(azure_environment =
|
56
|
+
def self.get_settings(azure_environment = MsRestAzure2::AzureEnvironments::Azure)
|
57
57
|
settings = ActiveDirectoryServiceSettings.new
|
58
58
|
settings.authentication_endpoint = azure_environment.active_directory_endpoint_url
|
59
59
|
settings.token_audience = azure_environment.active_directory_resource_id
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Defines values for AsyncOperationStatus enum.
|
8
8
|
#
|
@@ -23,7 +23,7 @@ module MsRestAzure
|
|
23
23
|
# @return [Integer] delay in seconds which should be used for polling for result of async operation.
|
24
24
|
attr_accessor :retry_after
|
25
25
|
|
26
|
-
# @return [
|
26
|
+
# @return [MsRestAzure2::CloudErrorData] error information about async operation.
|
27
27
|
attr_accessor :error
|
28
28
|
|
29
29
|
# @return [Stirng] status of polling.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
module AzureEnvironments
|
7
7
|
#
|
8
8
|
# An instance of this class describes an environment in Azure
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents an Azure error.
|
8
8
|
#
|
9
|
-
class AzureOperationError <
|
9
|
+
class AzureOperationError < MsRest2::HttpOperationError
|
10
10
|
|
11
11
|
# @return [String] the error message.
|
12
12
|
attr_accessor :error_message
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents the data received and deserialized from Azure service.
|
8
8
|
#
|
9
|
-
class AzureOperationResponse <
|
9
|
+
class AzureOperationResponse < MsRest2::HttpOperationResponse
|
10
10
|
|
11
11
|
# @return [String] identificator of the request.
|
12
12
|
attr_accessor :request_id
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents a point of access to the REST API.
|
8
8
|
#
|
9
|
-
class AzureServiceClient <
|
9
|
+
class AzureServiceClient < MsRest2::ServiceClient
|
10
10
|
|
11
11
|
# @return [Integer] execution interval for long running operations.
|
12
12
|
attr_accessor :long_running_operation_retry_timeout
|
@@ -22,17 +22,17 @@ module MsRestAzure
|
|
22
22
|
'Content-Type' => 'application/json;charset=utf-8',
|
23
23
|
'Accept' => 'application/json'
|
24
24
|
}
|
25
|
-
add_user_agent_information("
|
25
|
+
add_user_agent_information("ms_rest_azure2/#{MsRestAzure2::VERSION}")
|
26
26
|
add_user_agent_information("Azure-SDK-For-Ruby")
|
27
27
|
end
|
28
28
|
|
29
29
|
#
|
30
30
|
# Retrieves the result of 'POST','DELETE','PUT' or 'PATCH' operation. Performs polling of required.
|
31
|
-
# @param azure_response [
|
31
|
+
# @param azure_response [MsRestAzure2::AzureOperationResponse] response from Azure service.
|
32
32
|
# @param custom_deserialization_block [Proc] custom logic for response deserialization.
|
33
|
-
# @param final_state_via [
|
33
|
+
# @param final_state_via [MsRestAzure2::FinalStateVia] Final State via value
|
34
34
|
#
|
35
|
-
# @return [
|
35
|
+
# @return [MsRest2::HttpOperationResponse] the response.
|
36
36
|
#
|
37
37
|
def get_long_running_operation_result(azure_response, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
|
38
38
|
check_for_status_code_failure(azure_response)
|
@@ -50,7 +50,7 @@ module MsRestAzure
|
|
50
50
|
elsif !polling_state.location_header_link.nil?
|
51
51
|
update_state_from_location_header(polling_state.get_request(headers: request.headers, base_uri: request.base_uri, user_agent_extended: user_agent_extended), polling_state, custom_deserialization_block, final_state_via)
|
52
52
|
elsif http_method === :put
|
53
|
-
get_request =
|
53
|
+
get_request = MsRest2::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, {query_params: request.query_params, headers: request.headers, user_agent_extended: user_agent_extended})
|
54
54
|
update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block)
|
55
55
|
else
|
56
56
|
task.shutdown
|
@@ -89,7 +89,7 @@ module MsRestAzure
|
|
89
89
|
if AsyncOperationStatus.is_successful_status(polling_state.status)
|
90
90
|
# Process long-running PUT/PATCH
|
91
91
|
if (http_method === :put || http_method === :patch) && polling_state.resource.nil?
|
92
|
-
get_request =
|
92
|
+
get_request = MsRest2::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, {query_params: request.query_params, headers: request.headers})
|
93
93
|
update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block)
|
94
94
|
end
|
95
95
|
|
@@ -117,12 +117,12 @@ module MsRestAzure
|
|
117
117
|
|
118
118
|
#
|
119
119
|
# Verifies for unexpected polling status code
|
120
|
-
# @param azure_response [
|
120
|
+
# @param azure_response [MsRestAzure2::AzureOperationResponse] response from Azure service.
|
121
121
|
#
|
122
122
|
def check_for_status_code_failure(azure_response)
|
123
|
-
fail
|
124
|
-
fail
|
125
|
-
fail
|
123
|
+
fail MsRest2::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
|
124
|
+
fail MsRest2::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
|
125
|
+
fail MsRest2::ValidationError, 'Azure response cannot have empty request object' if azure_response.request.nil?
|
126
126
|
|
127
127
|
status_code = azure_response.response.status
|
128
128
|
http_method = azure_response.request.method
|
@@ -134,8 +134,8 @@ module MsRestAzure
|
|
134
134
|
|
135
135
|
#
|
136
136
|
# Updates polling state based on location header for PUT HTTP requests.
|
137
|
-
# @param request [
|
138
|
-
# @param polling_state [
|
137
|
+
# @param request [MsRest2::HttpOperationRequest] The url retrieve data from.
|
138
|
+
# @param polling_state [MsRestAzure2::PollingState] polling state to update.
|
139
139
|
# @param custom_deserialization_block [Proc] custom deserialization method for parsing response.
|
140
140
|
#
|
141
141
|
def update_state_from_get_resource_operation(request, polling_state, custom_deserialization_block)
|
@@ -165,10 +165,10 @@ module MsRestAzure
|
|
165
165
|
|
166
166
|
#
|
167
167
|
# Updates polling state based on location header for HTTP requests.
|
168
|
-
# @param request [
|
169
|
-
# @param polling_state [
|
168
|
+
# @param request [MsRest2::HttpOperationRequest] The url retrieve data from.
|
169
|
+
# @param polling_state [MsRestAzure2::PollingState] polling state to update.
|
170
170
|
# @param custom_deserialization_block [Proc] custom deserialization method for parsing response.
|
171
|
-
# @param final_state_via [
|
171
|
+
# @param final_state_via [MsRestAzure2::FinalStateVia] Final State via value
|
172
172
|
#
|
173
173
|
def update_state_from_location_header(request, polling_state, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
|
174
174
|
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
|
@@ -199,7 +199,7 @@ module MsRestAzure
|
|
199
199
|
|
200
200
|
#
|
201
201
|
# Updates polling state from Azure async operation header.
|
202
|
-
# @param polling_state [
|
202
|
+
# @param polling_state [MsRestAzure2::PollingState] polling state.
|
203
203
|
#
|
204
204
|
def update_state_from_azure_async_operation_header(request, polling_state)
|
205
205
|
result = get_async_with_async_operation_deserialization(request)
|
@@ -217,10 +217,10 @@ module MsRestAzure
|
|
217
217
|
|
218
218
|
#
|
219
219
|
# Retrieves data by given URL.
|
220
|
-
# @param request [
|
220
|
+
# @param request [MsRest2::HttpOperationRequest] the URL.
|
221
221
|
# @param custom_deserialization_block [Proc] function to perform deserialization of the HTTP response.
|
222
222
|
#
|
223
|
-
# @return [
|
223
|
+
# @return [MsRest2::HttpOperationResponse] the response.
|
224
224
|
#
|
225
225
|
def get_async_with_custom_deserialization(request, custom_deserialization_block)
|
226
226
|
result = get_async_common(request)
|
@@ -229,7 +229,7 @@ module MsRestAzure
|
|
229
229
|
begin
|
230
230
|
result.body = custom_deserialization_block.call(result.body)
|
231
231
|
rescue Exception => e
|
232
|
-
fail
|
232
|
+
fail MsRest2::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, http_response.body)
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
@@ -238,9 +238,9 @@ module MsRestAzure
|
|
238
238
|
|
239
239
|
#
|
240
240
|
# Retrieves data by given URL.
|
241
|
-
# @param request [
|
241
|
+
# @param request [MsRest2::HttpOperationRequest] the URL.
|
242
242
|
#
|
243
|
-
# @return [
|
243
|
+
# @return [MsRest2::HttpOperationResponse] the response.
|
244
244
|
#
|
245
245
|
def get_async_with_async_operation_deserialization(request)
|
246
246
|
result = get_async_common(request)
|
@@ -252,14 +252,14 @@ module MsRestAzure
|
|
252
252
|
|
253
253
|
#
|
254
254
|
# Retrieves data by given URL.
|
255
|
-
# @param request [
|
255
|
+
# @param request [MsRest2::HttpOperationRequest] the URL.
|
256
256
|
#
|
257
|
-
# @return [
|
257
|
+
# @return [MsRest2::HttpOperationResponse] the response.
|
258
258
|
#
|
259
259
|
def get_async_common(request)
|
260
260
|
fail ValidationError, 'Request cannot be nil' if request.nil?
|
261
261
|
|
262
|
-
request.middlewares = [[
|
262
|
+
request.middlewares = [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]
|
263
263
|
request.headers.merge!({'x-ms-client-request-id' => SecureRandom.uuid}) unless request.headers.key?('x-ms-client-request-id')
|
264
264
|
request.headers.merge!({'Content-Type' => 'application/json'}) unless request.headers.key?('Content-Type')
|
265
265
|
|
@@ -277,12 +277,12 @@ module MsRestAzure
|
|
277
277
|
fail AzureOperationError.new request, http_response, error_data, "Long running operation failed with status #{status_code}"
|
278
278
|
end
|
279
279
|
|
280
|
-
result =
|
280
|
+
result = MsRest2::HttpOperationResponse.new(request, http_response, http_response.body)
|
281
281
|
|
282
282
|
begin
|
283
283
|
result.body = JSON.load(http_response.body) unless http_response.body.to_s.empty?
|
284
284
|
rescue Exception => e
|
285
|
-
fail
|
285
|
+
fail MsRest2::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, result)
|
286
286
|
end
|
287
287
|
|
288
288
|
result
|
@@ -291,10 +291,10 @@ module MsRestAzure
|
|
291
291
|
private
|
292
292
|
#
|
293
293
|
# Retrieves a new instance of the AzureOperationResponse class.
|
294
|
-
# @param [
|
294
|
+
# @param [MsRest2::HttpOperationRequest] request the HTTP request object.
|
295
295
|
# @param [Faraday::Response] response the HTTP response object.
|
296
296
|
# @param [String] body the HTTP response body.
|
297
|
-
# @return [
|
297
|
+
# @return [MsRestAzure2::AzureOperationResponse] the operation response.
|
298
298
|
#
|
299
299
|
def create_response(request, http_response, body = nil)
|
300
300
|
AzureOperationResponse.new(request, http_response, body)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents keeps aux data about Azure invalid response.
|
8
8
|
#
|
@@ -38,7 +38,7 @@ module MsRestAzure
|
|
38
38
|
unless object['additionalInfo'].nil?
|
39
39
|
output_object.additionalInfo = []
|
40
40
|
object['additionalInfo'].each do |info|
|
41
|
-
output_object.additionalInfo <<
|
41
|
+
output_object.additionalInfo << MsRestAzure2::TypedErrorInfo.deserialize_object(info)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2::Common
|
6
6
|
# The Azure::Common::Configurable module provides basic configuration for Azure activities.
|
7
7
|
module Configurable
|
8
8
|
# @return [String] Azure tenant id (also known as domain).
|
@@ -17,10 +17,10 @@ module MsRestAzure::Common
|
|
17
17
|
# @return [String] Azure subscription id.
|
18
18
|
attr_accessor :subscription_id
|
19
19
|
|
20
|
-
# @return [
|
20
|
+
# @return [MsRestAzure2::ActiveDirectoryServiceSettings] Azure active directory service settings.
|
21
21
|
attr_accessor :active_directory_settings
|
22
22
|
|
23
|
-
# @return [
|
23
|
+
# @return [MsRest2::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
24
24
|
attr_accessor :credentials
|
25
25
|
|
26
26
|
class << self
|
@@ -42,11 +42,11 @@ module MsRestAzure::Common
|
|
42
42
|
|
43
43
|
#
|
44
44
|
# Resets the configurable options to provided options or defaults.
|
45
|
-
# This will also creates
|
45
|
+
# This will also creates MsRest2::TokenCredentials to be used for subsequent Azure Resource Manager clients.
|
46
46
|
#
|
47
47
|
def reset!(options = {})
|
48
|
-
|
49
|
-
default_value =
|
48
|
+
MsRestAzure2::Common::Configurable.keys.each do |key|
|
49
|
+
default_value = MsRestAzure2::Common::Default.options[key]
|
50
50
|
instance_variable_set(:"@#{key}", options.fetch(key, default_value))
|
51
51
|
end
|
52
52
|
|
@@ -58,8 +58,8 @@ module MsRestAzure::Common
|
|
58
58
|
fail ArgumentError, 'client_secret is nil' if self.client_secret.nil?
|
59
59
|
fail ArgumentError, 'active_directory_settings is nil' if self.active_directory_settings.nil?
|
60
60
|
|
61
|
-
self.credentials =
|
62
|
-
|
61
|
+
self.credentials = MsRest2::TokenCredentials.new(
|
62
|
+
MsRestAzure2::ApplicationTokenProvider.new(
|
63
63
|
self.tenant_id, self.client_id, self.client_secret, self.active_directory_settings))
|
64
64
|
else
|
65
65
|
self.credentials = options[:credentials]
|
@@ -79,8 +79,8 @@ module MsRestAzure::Common
|
|
79
79
|
#
|
80
80
|
def setup_default_options
|
81
81
|
opts = {}
|
82
|
-
|
83
|
-
opts[key] =
|
82
|
+
MsRestAzure2::Common::Configurable.keys.map do |key|
|
83
|
+
opts[key] = MsRestAzure2::Common::Default.options[key]
|
84
84
|
end
|
85
85
|
|
86
86
|
opts
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2::Common
|
6
6
|
module Default
|
7
7
|
class << self
|
8
8
|
#
|
@@ -39,10 +39,10 @@ module MsRestAzure::Common
|
|
39
39
|
|
40
40
|
#
|
41
41
|
# Default Azure Active Directory Service Settings.
|
42
|
-
# @return [
|
42
|
+
# @return [MsRestAzure2::ActiveDirectoryServiceSettings] Azure Active Directory Service Settings.
|
43
43
|
#
|
44
44
|
def active_directory_settings
|
45
|
-
|
45
|
+
MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_settings
|
46
46
|
end
|
47
47
|
|
48
48
|
#
|
@@ -50,7 +50,7 @@ module MsRestAzure::Common
|
|
50
50
|
# @return [Hash] Configuration options.
|
51
51
|
#
|
52
52
|
def options
|
53
|
-
Hash[
|
53
|
+
Hash[MsRestAzure2::Common::Configurable.keys.map { |key| [key, send(key)]}]
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class that provides access to authentication token.
|
8
8
|
#
|
9
|
-
class ApplicationTokenProvider <
|
9
|
+
class ApplicationTokenProvider < MsRest2::TokenProvider
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -97,7 +97,7 @@ module MsRestAzure
|
|
97
97
|
|
98
98
|
url = URI.parse(token_acquire_url)
|
99
99
|
|
100
|
-
connection = Faraday.new(:url => url, :ssl =>
|
100
|
+
connection = Faraday.new(:url => url, :ssl => MsRest2.ssl_options) do |builder|
|
101
101
|
builder.adapter Faraday.default_adapter
|
102
102
|
end
|
103
103
|
|
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
require 'time'
|
6
6
|
|
7
|
-
module
|
7
|
+
module MsRestAzure2
|
8
8
|
#
|
9
9
|
# Class that provides access to access tokens generated by the azure cli.
|
10
10
|
#
|
11
|
-
class AzureCliTokenProvider <
|
11
|
+
class AzureCliTokenProvider < MsRest2::TokenProvider
|
12
12
|
private
|
13
13
|
|
14
14
|
# @return [String] the type of token.
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class that provides access to authentication token.
|
8
8
|
#
|
9
|
-
class CognitiveServicesCredentials <
|
9
|
+
class CognitiveServicesCredentials < MsRest2::ServiceClientCredentials
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class that provides access to authentication token via Managed Service Identity.
|
8
8
|
#
|
9
|
-
class MSITokenProvider <
|
9
|
+
class MSITokenProvider < MsRest2::TokenProvider
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -105,7 +105,7 @@ module MsRestAzure
|
|
105
105
|
token_acquire_url = (token_acquire_url + '&' + append_header('msi_res_id', ERB::Util.url_encode(@msi_res_id))) unless @msi_res_id.nil?
|
106
106
|
url = URI.parse(token_acquire_url)
|
107
107
|
|
108
|
-
connection = Faraday.new(:url => url, :ssl =>
|
108
|
+
connection = Faraday.new(:url => url, :ssl => MsRest2.ssl_options) do |builder|
|
109
109
|
builder.adapter Faraday.default_adapter
|
110
110
|
end
|
111
111
|
|
@@ -123,7 +123,7 @@ module MsRestAzure
|
|
123
123
|
while retry_value <= max_retry && total_wait < user_defined_time_limit
|
124
124
|
response = connection.get do |request|
|
125
125
|
request.headers['Metadata'] = 'true'
|
126
|
-
request.headers['User-Agent'] = "Azure-SDK-For-Ruby/
|
126
|
+
request.headers['User-Agent'] = "Azure-SDK-For-Ruby/ms_rest_azure2/#{MsRestAzure2::VERSION}"
|
127
127
|
end
|
128
128
|
|
129
129
|
if response.status == 410 || response.status == 429 || response.status == 404 || (response.status > 499 && response.status < 600)
|
@@ -173,7 +173,7 @@ module MsRestAzure
|
|
173
173
|
|
174
174
|
url = URI.parse(token_acquire_url)
|
175
175
|
|
176
|
-
connection = Faraday.new(:url => url, :ssl =>
|
176
|
+
connection = Faraday.new(:url => url, :ssl => MsRest2.ssl_options) do |builder|
|
177
177
|
builder.adapter Faraday.default_adapter
|
178
178
|
end
|
179
179
|
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class that provides access to authentication token.
|
8
8
|
#
|
9
|
-
class TopicCredentials <
|
9
|
+
class TopicCredentials < MsRest2::ServiceClientCredentials
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents a final state via of Azure long running operation.
|
8
8
|
#
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents a state of Azure long running operation.
|
8
8
|
#
|
@@ -96,7 +96,7 @@ module MsRestAzure
|
|
96
96
|
#
|
97
97
|
# returns the Azure's response.
|
98
98
|
#
|
99
|
-
# @return [
|
99
|
+
# @return [MsRestAzure2::AzureOperationResponse] Azure's response.
|
100
100
|
def get_operation_response
|
101
101
|
azure_response = AzureOperationResponse.new(@request, @response, @resource)
|
102
102
|
azure_response
|
@@ -113,7 +113,7 @@ module MsRestAzure
|
|
113
113
|
def get_request(options = {})
|
114
114
|
link = @azure_async_operation_header_link || @location_header_link
|
115
115
|
options[:connection] = create_connection(options[:base_uri])
|
116
|
-
|
116
|
+
MsRest2::HttpOperationRequest.new(nil, link, :get, options)
|
117
117
|
end
|
118
118
|
|
119
119
|
private
|
@@ -124,8 +124,8 @@ module MsRestAzure
|
|
124
124
|
attr_accessor :connection
|
125
125
|
|
126
126
|
def create_connection(base_url)
|
127
|
-
@connection ||= Faraday.new(:url => base_url, :ssl =>
|
128
|
-
[[
|
127
|
+
@connection ||= Faraday.new(:url => base_url, :ssl => MsRest2.ssl_options) do |faraday|
|
128
|
+
[[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]].each{ |args| faraday.use(*args) }
|
129
129
|
faraday.adapter Faraday.default_adapter
|
130
130
|
faraday.headers = request.headers
|
131
131
|
logging = ENV['AZURE_HTTP_LOGGING'] || request.log
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
# Base module for Azure Ruby serialization and deserialization.
|
7
7
|
#
|
8
8
|
# Provides methods to serialize Ruby object into Ruby Hash and
|
9
9
|
# to deserialize Ruby Hash into Ruby object.
|
10
10
|
module Serialization
|
11
|
-
include
|
11
|
+
include MsRest2::Serialization
|
12
12
|
|
13
13
|
private
|
14
14
|
|
@@ -22,7 +22,7 @@ module MsRestAzure
|
|
22
22
|
#
|
23
23
|
# Class to handle serialization & deserialization.
|
24
24
|
#
|
25
|
-
class Serialization <
|
25
|
+
class Serialization < MsRest2::Serialization::Serialization
|
26
26
|
|
27
27
|
#
|
28
28
|
# Retrieves model of the model_name
|
@@ -33,8 +33,8 @@ module MsRestAzure
|
|
33
33
|
begin
|
34
34
|
Object.const_get(@context.class.to_s.split('::')[0...-1].join('::') + "::Models::#{model_name}")
|
35
35
|
rescue NameError
|
36
|
-
# Look into
|
37
|
-
Object.const_get("
|
36
|
+
# Look into MsRestAzure2 namespace if model name not found in the ARM's models namespace
|
37
|
+
Object.const_get("MsRestAzure2::#{model_name}")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRestAzure2
|
6
6
|
#
|
7
7
|
# Class which represents the error type and information.
|
8
8
|
#
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require 'ms_rest2'
|
6
|
+
require 'ms_rest_azure2/active_directory_service_settings.rb'
|
7
|
+
require 'ms_rest_azure2/async_operation_status.rb'
|
8
|
+
require 'ms_rest_azure2/azure_environment.rb'
|
9
|
+
require 'ms_rest_azure2/azure_operation_error.rb'
|
10
|
+
require 'ms_rest_azure2/azure_operation_response.rb'
|
11
|
+
require 'ms_rest_azure2/azure_service_client.rb'
|
12
|
+
require 'ms_rest_azure2/cloud_error_data.rb'
|
13
|
+
require 'ms_rest_azure2/final_state_via.rb'
|
14
|
+
require 'ms_rest_azure2/credentials/application_token_provider.rb'
|
15
|
+
require 'ms_rest_azure2/credentials/cognitive_services_credentials.rb'
|
16
|
+
require 'ms_rest_azure2/credentials/topic_credentials.rb'
|
17
|
+
require 'ms_rest_azure2/credentials/msi_token_provider.rb'
|
18
|
+
require 'ms_rest_azure2/credentials/azure_cli_token_provider.rb'
|
19
|
+
require 'ms_rest_azure2/azure_cli_error.rb'
|
20
|
+
require 'ms_rest_azure2/polling_state.rb'
|
21
|
+
require 'ms_rest_azure2/serialization.rb'
|
22
|
+
require 'ms_rest_azure2/typed_error_info.rb'
|
23
|
+
require 'ms_rest_azure2/version'
|
24
|
+
require 'ms_rest_azure2/common/configurable'
|
25
|
+
require 'ms_rest_azure2/common/default'
|
26
|
+
|
27
|
+
module MsRestAzure2 end
|
28
|
+
module MsRestAzure2::Serialization end
|
29
|
+
module MsRestAzure2::AzureEnvironments end
|
30
|
+
module MsRestAzure2::Common end
|
31
|
+
module MsRestAzure2::Common::Configurable end
|
32
|
+
module MsRestAzure2::Common::Default end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ms_rest_azure2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0
|
109
|
+
version: '1.0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0
|
116
|
+
version: '1.0'
|
117
117
|
description: Azure Client Library for Ruby.
|
118
118
|
email: azsdkteam@microsoft.com
|
119
119
|
executables: []
|
@@ -123,27 +123,27 @@ files:
|
|
123
123
|
- CHANGELOG.md
|
124
124
|
- LICENSE.txt
|
125
125
|
- README.md
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
- lib/
|
139
|
-
- lib/
|
140
|
-
- lib/
|
141
|
-
- lib/
|
142
|
-
- lib/
|
143
|
-
- lib/
|
144
|
-
- lib/
|
145
|
-
- lib/
|
146
|
-
- lib/
|
126
|
+
- lib/ms_rest_azure2.rb
|
127
|
+
- lib/ms_rest_azure2/active_directory_service_settings.rb
|
128
|
+
- lib/ms_rest_azure2/async_operation_status.rb
|
129
|
+
- lib/ms_rest_azure2/azure_cli_error.rb
|
130
|
+
- lib/ms_rest_azure2/azure_environment.rb
|
131
|
+
- lib/ms_rest_azure2/azure_operation_error.rb
|
132
|
+
- lib/ms_rest_azure2/azure_operation_response.rb
|
133
|
+
- lib/ms_rest_azure2/azure_service_client.rb
|
134
|
+
- lib/ms_rest_azure2/cloud_error_data.rb
|
135
|
+
- lib/ms_rest_azure2/common/configurable.rb
|
136
|
+
- lib/ms_rest_azure2/common/default.rb
|
137
|
+
- lib/ms_rest_azure2/credentials/application_token_provider.rb
|
138
|
+
- lib/ms_rest_azure2/credentials/azure_cli_token_provider.rb
|
139
|
+
- lib/ms_rest_azure2/credentials/cognitive_services_credentials.rb
|
140
|
+
- lib/ms_rest_azure2/credentials/msi_token_provider.rb
|
141
|
+
- lib/ms_rest_azure2/credentials/topic_credentials.rb
|
142
|
+
- lib/ms_rest_azure2/final_state_via.rb
|
143
|
+
- lib/ms_rest_azure2/polling_state.rb
|
144
|
+
- lib/ms_rest_azure2/serialization.rb
|
145
|
+
- lib/ms_rest_azure2/typed_error_info.rb
|
146
|
+
- lib/ms_rest_azure2/version.rb
|
147
147
|
homepage: https://github.com/chef/azure-sdk-for-ruby/tree/master/runtime/ms_rest_azure
|
148
148
|
licenses:
|
149
149
|
- MIT
|
@@ -152,8 +152,8 @@ metadata:
|
|
152
152
|
changelog_uri: https://github.com/chef/azure-sdk-for-ruby/blob/master/runtime/ms_rest_azure/CHANGELOG.md
|
153
153
|
documentation_uri: https://azure.microsoft.com/en-us/develop/ruby/
|
154
154
|
homepage_uri: https://github.com/chef/azure-sdk-for-ruby
|
155
|
-
source_code_uri: https://github.com/chef/azure-sdk-for-ruby/tree/ms_rest_azure-
|
156
|
-
post_install_message:
|
155
|
+
source_code_uri: https://github.com/chef/azure-sdk-for-ruby/tree/ms_rest_azure-v1.0.0
|
156
|
+
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
require_paths:
|
159
159
|
- lib
|
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.3.
|
172
|
-
signing_key:
|
171
|
+
rubygems_version: 3.3.3
|
172
|
+
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Azure Client Library for Ruby.
|
175
175
|
test_files: []
|
data/lib/ms_rest_azure.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
-
|
5
|
-
require 'ms_rest'
|
6
|
-
require 'ms_rest_azure/active_directory_service_settings.rb'
|
7
|
-
require 'ms_rest_azure/async_operation_status.rb'
|
8
|
-
require 'ms_rest_azure/azure_environment.rb'
|
9
|
-
require 'ms_rest_azure/azure_operation_error.rb'
|
10
|
-
require 'ms_rest_azure/azure_operation_response.rb'
|
11
|
-
require 'ms_rest_azure/azure_service_client.rb'
|
12
|
-
require 'ms_rest_azure/cloud_error_data.rb'
|
13
|
-
require 'ms_rest_azure/final_state_via.rb'
|
14
|
-
require 'ms_rest_azure/credentials/application_token_provider.rb'
|
15
|
-
require 'ms_rest_azure/credentials/cognitive_services_credentials.rb'
|
16
|
-
require 'ms_rest_azure/credentials/topic_credentials.rb'
|
17
|
-
require 'ms_rest_azure/credentials/msi_token_provider.rb'
|
18
|
-
require 'ms_rest_azure/credentials/azure_cli_token_provider.rb'
|
19
|
-
require 'ms_rest_azure/azure_cli_error.rb'
|
20
|
-
require 'ms_rest_azure/polling_state.rb'
|
21
|
-
require 'ms_rest_azure/serialization.rb'
|
22
|
-
require 'ms_rest_azure/typed_error_info.rb'
|
23
|
-
require 'ms_rest_azure/version'
|
24
|
-
require 'ms_rest_azure/common/configurable'
|
25
|
-
require 'ms_rest_azure/common/default'
|
26
|
-
|
27
|
-
module MsRestAzure end
|
28
|
-
module MsRestAzure::Serialization end
|
29
|
-
module MsRestAzure::AzureEnvironments end
|
30
|
-
module MsRestAzure::Common end
|
31
|
-
module MsRestAzure::Common::Configurable end
|
32
|
-
module MsRestAzure::Common::Default end
|