ms_rest_azure 0.10.1 → 0.10.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b98fe0324137867e177762f31508d6a0730921c
4
- data.tar.gz: 47b51bff9a9f10aac58e0eca9f28158071248420
3
+ metadata.gz: b99746d08635c8d4551c7bba7533715a7a06c56f
4
+ data.tar.gz: 276097a4fb680b68cf99ed1b0b0336089f992829
5
5
  SHA512:
6
- metadata.gz: 085b85de70909d6a8e2fea89046659fb1aa4f09989b4ab09b88bc09ba588b5b7c27cd316eec1ebeb9b2a117fc53c0baf709252c74f91c6c725c885f01a9afbb3
7
- data.tar.gz: bbb9cc38742419e2572f9056b832b4e3795ea4264637795e0dfb1b867d5e6ea7119a3bfa0f0b06482f9b226aba3ef274e96838d4e7409f7f66c46ec4c3d6a180
6
+ metadata.gz: cbee3ee3b0130c810bb0dbf49149344afad6bba85fc1d2d3e9689dc00758ebaeb175101b7c9a310c1d03dcc9703c405fbc09ae48f682e89917549ae598b48fc5
7
+ data.tar.gz: 42f74ad092bb1b81d751cc12743e3a07de46f324b07aebb2336ba13a517e91ae6630d6cd8ae075b300f77d28655bb4ff2ad68d477a7a63b60ce90e830bac733a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ##2018.01.30 ms_rest_azure version 0.10.2
2
+ * Added CognitiveServicesCredentials class for the cognitive services data plane SDK. Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details.
3
+ * Added TopicCredentials class for the event grid data plane SDK. Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details.
4
+
1
5
  ##2017.12.19 ms_rest_azure version 0.10.1
2
6
  * Added support for user assigned identity to MSITokenProvider Modified portal URLs for Azure cloud environments. Refer [Issue #1175](https://github.com/Azure/azure-sdk-for-ruby/issues/1175) for further details.
3
7
 
@@ -50,17 +50,22 @@ module MsRestAzure::Common
50
50
  instance_variable_set(:"@#{key}", options.fetch(key, default_value))
51
51
  end
52
52
 
53
- fail ArgumentError, 'tenant_id is nil' if self.tenant_id.nil?
54
- fail ArgumentError, 'client_id is nil' if self.client_id.nil?
55
- fail ArgumentError, 'client_secret is nil' if self.client_secret.nil?
56
53
  fail ArgumentError, 'subscription_id is nil' if self.subscription_id.nil?
57
- fail ArgumentError, 'active_directory_settings is nil' if self.active_directory_settings.nil?
58
54
 
59
- default_value = MsRest::TokenCredentials.new(
60
- MsRestAzure::ApplicationTokenProvider.new(
61
- self.tenant_id, self.client_id, self.client_secret, self.active_directory_settings))
62
-
63
- instance_variable_set(:"@credentials", options.fetch(:credentials, default_value))
55
+ if(options[:credentials].nil?)
56
+ # The user has not passed in the credentials. So, the SDK has to
57
+ # build the credentials itself.
58
+ fail ArgumentError, 'tenant_id is nil' if self.tenant_id.nil?
59
+ fail ArgumentError, 'client_id is nil' if self.client_id.nil?
60
+ fail ArgumentError, 'client_secret is nil' if self.client_secret.nil?
61
+ fail ArgumentError, 'active_directory_settings is nil' if self.active_directory_settings.nil?
62
+
63
+ self.credentials = MsRest::TokenCredentials.new(
64
+ MsRestAzure::ApplicationTokenProvider.new(
65
+ self.tenant_id, self.client_id, self.client_secret, self.active_directory_settings))
66
+ else
67
+ self.credentials = options[:credentials]
68
+ end
64
69
 
65
70
  self
66
71
  end
@@ -0,0 +1,42 @@
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
+ module MsRestAzure
6
+ #
7
+ # Class that provides access to authentication token.
8
+ #
9
+ class CognitiveServicesCredentials < MsRest::ServiceClientCredentials
10
+
11
+ private
12
+
13
+ # @return [String] the subscription key
14
+ attr_reader :subscription_key
15
+
16
+ public
17
+
18
+ #
19
+ # Creates and initialize new instance of the CognitiveServicesCredentials class.
20
+ # @param subscription_key [String] subscription key
21
+ def initialize(subscription_key)
22
+ fail ArgumentError, 'Subscription key cannot be nil' if subscription_key.nil?
23
+ fail ArgumentError, 'Subscription key must be of type string' if subscription_key.class.to_s != 'String'
24
+ @subscription_key = subscription_key
25
+ end
26
+
27
+ def sign_request(request)
28
+ super(request)
29
+
30
+ if (request.respond_to?(:request_headers))
31
+ request.request_headers['Ocp-Apim-Subscription-Key'] = @subscription_key
32
+ request.request_headers['X-BingApis-SDK-Client'] = 'ruby-SDK'
33
+ elsif request.respond_to?(:headers)
34
+ request.headers['Ocp-Apim-Subscription-Key'] = @subscription_key
35
+ request.headers['X-BingApis-SDK-Client'] = 'ruby-SDK'
36
+ else
37
+ fail ArgumentError, 'Incorrect request object was provided'
38
+ end
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,40 @@
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
+ module MsRestAzure
6
+ #
7
+ # Class that provides access to authentication token.
8
+ #
9
+ class TopicCredentials < MsRest::ServiceClientCredentials
10
+
11
+ private
12
+
13
+ # @return [String] the topic key
14
+ attr_reader :topic_key
15
+
16
+ public
17
+
18
+ #
19
+ # Creates and initialize new instance of the TopicCredentials class.
20
+ # @param topic_key [String] topic key
21
+ def initialize(topic_key)
22
+ fail ArgumentError, 'Topic key cannot be nil' if topic_key.nil?
23
+ fail ArgumentError, 'Topic key must be of type string' if topic_key.class.to_s != 'String'
24
+ @topic_key = topic_key
25
+ end
26
+
27
+ def sign_request(request)
28
+ super(request)
29
+
30
+ if (request.respond_to?(:request_headers))
31
+ request.request_headers['aeg-sas-key'] = @topic_key
32
+ elsif request.respond_to?(:headers)
33
+ request.headers['aeg-sas-key'] = @topic_key
34
+ else
35
+ fail ArgumentError, 'Incorrect request object was provided'
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -3,5 +3,5 @@
3
3
  # Licensed under the MIT License. See License.txt in the project root for license information.
4
4
 
5
5
  module MsRestAzure
6
- VERSION = '0.10.1'
6
+ VERSION = '0.10.2'
7
7
  end
data/lib/ms_rest_azure.rb CHANGED
@@ -11,6 +11,8 @@ require 'ms_rest_azure/azure_operation_response.rb'
11
11
  require 'ms_rest_azure/azure_service_client.rb'
12
12
  require 'ms_rest_azure/cloud_error_data.rb'
13
13
  require 'ms_rest_azure/credentials/application_token_provider.rb'
14
+ require 'ms_rest_azure/credentials/cognitive_services_credentials.rb'
15
+ require 'ms_rest_azure/credentials/topic_credentials.rb'
14
16
  require 'ms_rest_azure/credentials/msi_token_provider.rb'
15
17
  require 'ms_rest_azure/polling_state.rb'
16
18
  require 'ms_rest_azure/serialization.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_rest_azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,9 @@ files:
128
128
  - lib/ms_rest_azure/common/configurable.rb
129
129
  - lib/ms_rest_azure/common/default.rb
130
130
  - lib/ms_rest_azure/credentials/application_token_provider.rb
131
+ - lib/ms_rest_azure/credentials/cognitive_services_credentials.rb
131
132
  - lib/ms_rest_azure/credentials/msi_token_provider.rb
133
+ - lib/ms_rest_azure/credentials/topic_credentials.rb
132
134
  - lib/ms_rest_azure/polling_state.rb
133
135
  - lib/ms_rest_azure/serialization.rb
134
136
  - lib/ms_rest_azure/version.rb
@@ -140,7 +142,7 @@ metadata:
140
142
  changelog_uri: https://github.com/Azure/azure-sdk-for-ruby/blob/master/runtime/ms_rest_azure/CHANGELOG.md
141
143
  documentation_uri: https://azure.microsoft.com/en-us/develop/ruby/
142
144
  homepage_uri: https://aka.ms/azure-sdk-for-ruby
143
- source_code_uri: https://github.com/Azure/azure-sdk-for-ruby/tree/ms_rest_azure-v0.10.1
145
+ source_code_uri: https://github.com/Azure/azure-sdk-for-ruby/tree/ms_rest_azure-v0.10.2
144
146
  post_install_message:
145
147
  rdoc_options: []
146
148
  require_paths: