ms_rest_azure2 0.12.1 → 1.1.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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/{ms_rest_azure → ms_rest_azure2}/active_directory_service_settings.rb +6 -6
  4. data/lib/{ms_rest_azure → ms_rest_azure2}/async_operation_status.rb +2 -2
  5. data/lib/{ms_rest_azure → ms_rest_azure2}/azure_cli_error.rb +1 -1
  6. data/lib/{ms_rest_azure → ms_rest_azure2}/azure_environment.rb +1 -1
  7. data/lib/{ms_rest_azure → ms_rest_azure2}/azure_operation_error.rb +2 -2
  8. data/lib/{ms_rest_azure → ms_rest_azure2}/azure_operation_response.rb +2 -2
  9. data/lib/{ms_rest_azure → ms_rest_azure2}/azure_service_client.rb +30 -30
  10. data/lib/{ms_rest_azure → ms_rest_azure2}/cloud_error_data.rb +2 -2
  11. data/lib/{ms_rest_azure → ms_rest_azure2}/common/configurable.rb +10 -10
  12. data/lib/{ms_rest_azure → ms_rest_azure2}/common/default.rb +4 -4
  13. data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/application_token_provider.rb +3 -3
  14. data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/azure_cli_token_provider.rb +11 -11
  15. data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/cognitive_services_credentials.rb +2 -2
  16. data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/msi_token_provider.rb +5 -5
  17. data/lib/{ms_rest_azure → ms_rest_azure2}/credentials/topic_credentials.rb +2 -2
  18. data/lib/{ms_rest_azure → ms_rest_azure2}/final_state_via.rb +1 -1
  19. data/lib/{ms_rest_azure → ms_rest_azure2}/polling_state.rb +5 -5
  20. data/lib/{ms_rest_azure → ms_rest_azure2}/serialization.rb +5 -5
  21. data/lib/{ms_rest_azure → ms_rest_azure2}/typed_error_info.rb +1 -1
  22. data/lib/{ms_rest_azure → ms_rest_azure2}/version.rb +2 -2
  23. data/lib/ms_rest_azure2.rb +32 -0
  24. metadata +30 -33
  25. data/lib/ms_rest_azure.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 920be1384ac116cac5ed9e79a0f6ff60635a476d31b2b4d4b7ab4e432fe580d8
4
- data.tar.gz: 601f4fc857a42fc8f4af7877035e623fa09ce5870c7f34a05cf4f95660624a71
3
+ metadata.gz: b40251445a031f3a884a76ef4de80ca24c465bd8bca0bc95493129f5c1ca7b31
4
+ data.tar.gz: 697a93169075188aaf649ffde445bf63f95087082412ee47685850dc481cdb5e
5
5
  SHA512:
6
- metadata.gz: de7297f65863a2862b5b7baf0b455863e1b320b5c72ad05daa465f142debf2665d002348c41144d1448f20bfa2ffbe4f4d947eb88e6924378e952370c4d48416
7
- data.tar.gz: d73afb888d5b5e7cb5f26569dc0de235564f2afcdda6617a181944ee98505b05d543462c693bd685a87a74ea118755e17aafe729f091ad4aa08fba83e518dbc4
6
+ metadata.gz: 8c48144e9f2d84ab4288b9937c290ea9ad06e6e145b185698435c54fc3c9738531f2ffda924af5f3d585d90ade857f91bc6e54107c1632e0c9b17450b11f51d7
7
+ data.tar.gz: c5db2395993d560ba112df27f3c0b8c7af65d33ef5df2aab4694ed91ab22bffdb72a41198729c1490a0c2f3021e5b85f6d440752aa5fca47971e73735fc64ea6
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 = MsRest::TokenCredentials.new(provider)
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 MsRestAzure
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(MsRestAzure::AzureEnvironments::AzureCloud)
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(MsRestAzure::AzureEnvironments::AzureChinaCloud)
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(MsRestAzure::AzureEnvironments::AzureGermanCloud)
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(MsRestAzure::AzureEnvironments::AzureUSGovernment)
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 = MsRestAzure::AzureEnvironments::Azure)
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 MsRestAzure
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 [MsRestAzure::CloudErrorData] error information about async operation.
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class which represents an error with the Azure CLI.
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 MsRestAzure
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class which represents an Azure error.
8
8
  #
9
- class AzureOperationError < MsRest::HttpOperationError
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class which represents the data received and deserialized from Azure service.
8
8
  #
9
- class AzureOperationResponse < MsRest::HttpOperationResponse
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class which represents a point of access to the REST API.
8
8
  #
9
- class AzureServiceClient < MsRest::ServiceClient
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("ms_rest_azure/#{MsRestAzure::VERSION}")
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 [MsRestAzure::AzureOperationResponse] response from Azure service.
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 [MsRestAzure::FinalStateVia] Final State via value
33
+ # @param final_state_via [MsRestAzure2::FinalStateVia] Final State via value
34
34
  #
35
- # @return [MsRest::HttpOperationResponse] the response.
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 = MsRest::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})
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 = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, {query_params: request.query_params, headers: request.headers})
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 [MsRestAzure::AzureOperationResponse] response from Azure service.
120
+ # @param azure_response [MsRestAzure2::AzureOperationResponse] response from Azure service.
121
121
  #
122
122
  def check_for_status_code_failure(azure_response)
123
- fail MsRest::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
124
- fail MsRest::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
125
- fail MsRest::ValidationError, 'Azure response cannot have empty request object' if azure_response.request.nil?
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 [MsRest::HttpOperationRequest] The url retrieve data from.
138
- # @param polling_state [MsRestAzure::PollingState] polling state to update.
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 [MsRest::HttpOperationRequest] The url retrieve data from.
169
- # @param polling_state [MsRestAzure::PollingState] polling state to update.
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 [MsRestAzure::FinalStateVia] Final State via value
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 [MsRestAzure::PollingState] 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 [MsRest::HttpOperationRequest] the URL.
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 [MsRest::HttpOperationResponse] the response.
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 MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, http_response.body)
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 [MsRest::HttpOperationRequest] the URL.
241
+ # @param request [MsRest2::HttpOperationRequest] the URL.
242
242
  #
243
- # @return [MsRest::HttpOperationResponse] the response.
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 [MsRest::HttpOperationRequest] the URL.
255
+ # @param request [MsRest2::HttpOperationRequest] the URL.
256
256
  #
257
- # @return [MsRest::HttpOperationResponse] the response.
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 = [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]
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 = MsRest::HttpOperationResponse.new(request, http_response, http_response.body)
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 MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, result)
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 [MsRest::HttpOperationRequest] request the HTTP request object.
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 [MsRestAzure::AzureOperationResponse] the operation response.
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 MsRestAzure
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 << MsRestAzure::TypedErrorInfo.deserialize_object(info)
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 MsRestAzure::Common
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 [MsRestAzure::ActiveDirectoryServiceSettings] Azure active directory service settings.
20
+ # @return [MsRestAzure2::ActiveDirectoryServiceSettings] Azure active directory service settings.
21
21
  attr_accessor :active_directory_settings
22
22
 
23
- # @return [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
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 MsRest::TokenCredentials to be used for subsequent Azure Resource Manager clients.
45
+ # This will also creates MsRest2::TokenCredentials to be used for subsequent Azure Resource Manager clients.
46
46
  #
47
47
  def reset!(options = {})
48
- MsRestAzure::Common::Configurable.keys.each do |key|
49
- default_value = MsRestAzure::Common::Default.options[key]
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 = MsRest::TokenCredentials.new(
62
- MsRestAzure::ApplicationTokenProvider.new(
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
- MsRestAzure::Common::Configurable.keys.map do |key|
83
- opts[key] = MsRestAzure::Common::Default.options[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 MsRestAzure::Common
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 [MsRestAzure::ActiveDirectoryServiceSettings] Azure Active Directory Service Settings.
42
+ # @return [MsRestAzure2::ActiveDirectoryServiceSettings] Azure Active Directory Service Settings.
43
43
  #
44
44
  def active_directory_settings
45
- MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings
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[MsRestAzure::Common::Configurable.keys.map { |key| [key, send(key)]}]
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class that provides access to authentication token.
8
8
  #
9
- class ApplicationTokenProvider < MsRest::TokenProvider
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 => MsRest.ssl_options) do |builder|
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 MsRestAzure
7
+ module MsRestAzure2
8
8
  #
9
9
  # Class that provides access to access tokens generated by the azure cli.
10
10
  #
11
- class AzureCliTokenProvider < MsRest::TokenProvider
11
+ class AzureCliTokenProvider < MsRest2::TokenProvider
12
12
  private
13
13
 
14
14
  # @return [String] the type of token.
@@ -19,13 +19,13 @@ module MsRestAzure
19
19
 
20
20
  # @return [String] auth token.
21
21
  attr_accessor :token
22
-
22
+
23
23
  # @return [Time] the date when the current token expires.
24
24
  attr_accessor :token_expires_on
25
-
25
+
26
26
  # @return [Integer] the amount of time we refresh token before it expires.
27
27
  attr_reader :expiration_threshold
28
-
28
+
29
29
  # @return [String] the type of token.
30
30
  attr_reader :token_type
31
31
 
@@ -42,7 +42,7 @@ module MsRestAzure
42
42
 
43
43
  @expiration_threshold = 5 * 60
44
44
  end
45
-
45
+
46
46
  #
47
47
  # Gets an authentication header string using an access token from the Azure cli
48
48
  # @param settings [ActiveDirectoryServiceSettings] active directory settings.
@@ -52,9 +52,9 @@ module MsRestAzure
52
52
  acquire_token if token_expired?
53
53
  "#{token_type} #{token}"
54
54
  end
55
-
55
+
56
56
  private
57
-
57
+
58
58
  #
59
59
  # Checks whether token is about to expire.
60
60
  #
@@ -78,14 +78,14 @@ module MsRestAzure
78
78
 
79
79
  return nil
80
80
  end
81
-
81
+
82
82
  #
83
83
  # Acquires a new access token from teh azure CLI
84
84
  #
85
85
  # @return [String] The access token to the desired resource
86
86
  def acquire_token()
87
- response_body = JSON.load(`'#{cli_path}' account get-access-token -o json --resource #{@settings.token_audience}`)
88
-
87
+ response_body = JSON.load(`#{cli_path} account get-access-token -o json --resource #{@settings.token_audience}`)
88
+
89
89
  @token_expires_on = Time.parse(response_body['expiresOn'])
90
90
  @token_type = response_body['tokenType']
91
91
  @token = response_body['accessToken']
@@ -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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class that provides access to authentication token.
8
8
  #
9
- class CognitiveServicesCredentials < MsRest::ServiceClientCredentials
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class that provides access to authentication token via Managed Service Identity.
8
8
  #
9
- class MSITokenProvider < MsRest::TokenProvider
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 => MsRest.ssl_options) do |builder|
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/ms_rest_azure/#{MsRestAzure::VERSION}"
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 => MsRest.ssl_options) do |builder|
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class that provides access to authentication token.
8
8
  #
9
- class TopicCredentials < MsRest::ServiceClientCredentials
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 MsRestAzure
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 MsRestAzure
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 [MsRestAzure::AzureOperationResponse] Azure's response.
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
- MsRest::HttpOperationRequest.new(nil, link, :get, options)
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 => MsRest.ssl_options) do |faraday|
128
- [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]].each{ |args| faraday.use(*args) }
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 MsRestAzure
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 MsRest::Serialization
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 < MsRest::Serialization::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 MsRestAzure namespace if model name not found in the ARM's models namespace
37
- Object.const_get("MsRestAzure::#{model_name}")
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 MsRestAzure
5
+ module MsRestAzure2
6
6
  #
7
7
  # Class which represents the error type and information.
8
8
  #
@@ -2,6 +2,6 @@
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 MsRestAzure
6
- VERSION = '0.12.1'
5
+ module MsRestAzure2
6
+ VERSION = '1.1.0'
7
7
  end
@@ -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,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_rest_azure2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-06 00:00:00.000000000 Z
10
+ date: 2025-11-11 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -87,33 +86,33 @@ dependencies:
87
86
  - !ruby/object:Gem::Version
88
87
  version: 2.0.0
89
88
  - !ruby/object:Gem::Dependency
90
- name: faraday-cookie_jar
89
+ name: faraday-cookie_jar2
91
90
  requirement: !ruby/object:Gem::Requirement
92
91
  requirements:
93
92
  - - "~>"
94
93
  - !ruby/object:Gem::Version
95
- version: 0.0.6
94
+ version: 0.1.0
96
95
  type: :runtime
97
96
  prerelease: false
98
97
  version_requirements: !ruby/object:Gem::Requirement
99
98
  requirements:
100
99
  - - "~>"
101
100
  - !ruby/object:Gem::Version
102
- version: 0.0.6
101
+ version: 0.1.0
103
102
  - !ruby/object:Gem::Dependency
104
103
  name: ms_rest2
105
104
  requirement: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - "~>"
108
107
  - !ruby/object:Gem::Version
109
- version: 0.7.6
108
+ version: '1.0'
110
109
  type: :runtime
111
110
  prerelease: false
112
111
  version_requirements: !ruby/object:Gem::Requirement
113
112
  requirements:
114
113
  - - "~>"
115
114
  - !ruby/object:Gem::Version
116
- version: 0.7.6
115
+ version: '1.0'
117
116
  description: Azure Client Library for Ruby.
118
117
  email: azsdkteam@microsoft.com
119
118
  executables: []
@@ -123,27 +122,27 @@ files:
123
122
  - CHANGELOG.md
124
123
  - LICENSE.txt
125
124
  - README.md
126
- - lib/ms_rest_azure.rb
127
- - lib/ms_rest_azure/active_directory_service_settings.rb
128
- - lib/ms_rest_azure/async_operation_status.rb
129
- - lib/ms_rest_azure/azure_cli_error.rb
130
- - lib/ms_rest_azure/azure_environment.rb
131
- - lib/ms_rest_azure/azure_operation_error.rb
132
- - lib/ms_rest_azure/azure_operation_response.rb
133
- - lib/ms_rest_azure/azure_service_client.rb
134
- - lib/ms_rest_azure/cloud_error_data.rb
135
- - lib/ms_rest_azure/common/configurable.rb
136
- - lib/ms_rest_azure/common/default.rb
137
- - lib/ms_rest_azure/credentials/application_token_provider.rb
138
- - lib/ms_rest_azure/credentials/azure_cli_token_provider.rb
139
- - lib/ms_rest_azure/credentials/cognitive_services_credentials.rb
140
- - lib/ms_rest_azure/credentials/msi_token_provider.rb
141
- - lib/ms_rest_azure/credentials/topic_credentials.rb
142
- - lib/ms_rest_azure/final_state_via.rb
143
- - lib/ms_rest_azure/polling_state.rb
144
- - lib/ms_rest_azure/serialization.rb
145
- - lib/ms_rest_azure/typed_error_info.rb
146
- - lib/ms_rest_azure/version.rb
125
+ - lib/ms_rest_azure2.rb
126
+ - lib/ms_rest_azure2/active_directory_service_settings.rb
127
+ - lib/ms_rest_azure2/async_operation_status.rb
128
+ - lib/ms_rest_azure2/azure_cli_error.rb
129
+ - lib/ms_rest_azure2/azure_environment.rb
130
+ - lib/ms_rest_azure2/azure_operation_error.rb
131
+ - lib/ms_rest_azure2/azure_operation_response.rb
132
+ - lib/ms_rest_azure2/azure_service_client.rb
133
+ - lib/ms_rest_azure2/cloud_error_data.rb
134
+ - lib/ms_rest_azure2/common/configurable.rb
135
+ - lib/ms_rest_azure2/common/default.rb
136
+ - lib/ms_rest_azure2/credentials/application_token_provider.rb
137
+ - lib/ms_rest_azure2/credentials/azure_cli_token_provider.rb
138
+ - lib/ms_rest_azure2/credentials/cognitive_services_credentials.rb
139
+ - lib/ms_rest_azure2/credentials/msi_token_provider.rb
140
+ - lib/ms_rest_azure2/credentials/topic_credentials.rb
141
+ - lib/ms_rest_azure2/final_state_via.rb
142
+ - lib/ms_rest_azure2/polling_state.rb
143
+ - lib/ms_rest_azure2/serialization.rb
144
+ - lib/ms_rest_azure2/typed_error_info.rb
145
+ - lib/ms_rest_azure2/version.rb
147
146
  homepage: https://github.com/chef/azure-sdk-for-ruby/tree/master/runtime/ms_rest_azure
148
147
  licenses:
149
148
  - MIT
@@ -152,8 +151,7 @@ metadata:
152
151
  changelog_uri: https://github.com/chef/azure-sdk-for-ruby/blob/master/runtime/ms_rest_azure/CHANGELOG.md
153
152
  documentation_uri: https://azure.microsoft.com/en-us/develop/ruby/
154
153
  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-v0.12.1
156
- post_install_message:
154
+ source_code_uri: https://github.com/chef/azure-sdk-for-ruby/tree/ms_rest_azure-v1.1.0
157
155
  rdoc_options: []
158
156
  require_paths:
159
157
  - lib
@@ -168,8 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
166
  - !ruby/object:Gem::Version
169
167
  version: '0'
170
168
  requirements: []
171
- rubygems_version: 3.3.7
172
- signing_key:
169
+ rubygems_version: 3.6.2
173
170
  specification_version: 4
174
171
  summary: Azure Client Library for Ruby.
175
172
  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