ms_rest_azure 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1fd75e8ce7055d583a565b1ad63b22cb96e3322
4
- data.tar.gz: 6ee48c9a1ef81a288efb1ed71043c1512d61bf8e
3
+ metadata.gz: 1f02aa4a5f0f8b2921a5e860162384b487efec77
4
+ data.tar.gz: 22e137ece42e719d79266148e10262fc84dc6a11
5
5
  SHA512:
6
- metadata.gz: b8422b73a85b09725a67aeec31f1cacb520a45bf4e83e1247e1370544f272a78c4dcc4a91d7bc3bf383c8ce58bb2970fdb42f812c6e18b15c278c7aaa64ca6c2
7
- data.tar.gz: 0a3ca8b657be867f3a8584fc073157c66648764a7bfbea20ae86530426769d4672d96560aa6a095177a2258d3cf5530b7463b6aaec15d13b25c2d2341a407a77
6
+ metadata.gz: b33afbd1c77c7c466befa4f5c7960e9fd1c0c4f5a3415f2e35739ed96ae18b4b2fce47ea22e16f456a5e9654cfca838ca4b9c6d098d6761da5a9e982b8968eb8
7
+ data.tar.gz: 7b6f2991cf5430cb0eca947aeacd648c7e0c2dcb18147a66c94e981d59b5e7f5761f29f0008624b0a71e755eab018d526b1afaf36aeb621068b7f703888d9a6e
@@ -1,3 +1,9 @@
1
+ ##2016.09.15 ms_rest_azure version 0.5.0
2
+ * Updating ms_rest dependecy to version 0.5.0
3
+ * Adding known Azure Environments in ruby runtime for easy discovery
4
+ * Default Azure active directory url is updated from `https://login.windows.net/` to `https://login.microsoftonline.com/` (Breaking Change)
5
+ * Using bundled default ca-cert from ms_rest
6
+
1
7
  ##2016.08.10 ms_rest_azure version 0.4.0
2
8
  * Adding & inheriting serialization class from ms_rest generic serializer
3
9
 
data/README.md CHANGED
@@ -38,7 +38,7 @@ To start working on the gem the only additional dev dependecy is required - rspe
38
38
  Reference it in the gemfile and also add this line to your client's gemspec file:
39
39
 
40
40
  ```ruby
41
- spec.add_runtime_dependency 'ms_rest_azure', '~> 0.4.0'
41
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.5.0'
42
42
  ```
43
43
 
44
44
  Don't forget to correct the version.
@@ -3,21 +3,20 @@
3
3
  # Licensed under the MIT License. See License.txt in the project root for license information.
4
4
 
5
5
  require 'ms_rest'
6
-
7
- require 'ms_rest_azure/version'
8
-
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'
9
13
  require 'ms_rest_azure/credentials/application_token_provider.rb'
10
-
14
+ require 'ms_rest_azure/polling_state.rb'
11
15
  require 'ms_rest_azure/resource.rb'
12
16
  require 'ms_rest_azure/serialization.rb'
13
17
  require 'ms_rest_azure/sub_resource.rb'
14
- require 'ms_rest_azure/cloud_error_data.rb'
15
- require 'ms_rest_azure/azure_operation_error.rb'
16
- require 'ms_rest_azure/azure_operation_response.rb'
17
- require 'ms_rest_azure/async_operation_status.rb'
18
- require 'ms_rest_azure/polling_state.rb'
19
- require 'ms_rest_azure/active_directory_service_settings.rb'
20
- require 'ms_rest_azure/azure_service_client.rb'
18
+ require 'ms_rest_azure/version'
21
19
 
22
20
  module MsRestAzure end
23
21
  module MsRestAzure::Serialization end
22
+ module MsRestAzure::AzureEnvironments end
@@ -19,10 +19,7 @@ module MsRestAzure
19
19
  #
20
20
  # @return [ActiveDirectoryServiceSettings] settings required for authentication.
21
21
  def self.get_azure_settings
22
- settings = ActiveDirectoryServiceSettings.new
23
- settings.authentication_endpoint = 'https://login.windows.net/'
24
- settings.token_audience = 'https://management.core.windows.net/'
25
- settings
22
+ get_settings(MsRestAzure::AzureEnvironments::Azure)
26
23
  end
27
24
 
28
25
  #
@@ -30,9 +27,36 @@ module MsRestAzure
30
27
  #
31
28
  # @return [ActiveDirectoryServiceSettings] settings required for authentication.
32
29
  def self.get_azure_china_settings
30
+ get_settings(MsRestAzure::AzureEnvironments::AzureChina)
31
+ end
32
+
33
+ #
34
+ # Returns a set of properties required to login into Azure German Cloud.
35
+ #
36
+ # @return [ActiveDirectoryServiceSettings] settings required for authentication.
37
+ def self.get_azure_german_settings
38
+ get_settings(MsRestAzure::AzureEnvironments::AzureGermanCloud)
39
+ end
40
+
41
+ #
42
+ # Returns a set of properties required to login into Azure US Government.
43
+ #
44
+ # @return [ActiveDirectoryServiceSettings] settings required for authentication.
45
+ def self.get_azure_us_government_settings
46
+ get_settings(MsRestAzure::AzureEnvironments::AzureUSGovernment)
47
+ end
48
+
49
+ private
50
+
51
+ #
52
+ # Returns a set of properties required to login into Azure Cloud.
53
+ #
54
+ # @param azure_environment [AzureEnvironment] An instance of AzureEnvironment.
55
+ # @return [ActiveDirectoryServiceSettings] settings required for authentication.
56
+ def self.get_settings(azure_environment = MsRestAzure::AzureEnvironments::Azure)
33
57
  settings = ActiveDirectoryServiceSettings.new
34
- settings.authentication_endpoint = 'https://login.chinacloudapi.cn/'
35
- settings.token_audience = 'https://management.core.chinacloudapi.cn/'
58
+ settings.authentication_endpoint = azure_environment.active_directory_endpoint_url
59
+ settings.token_audience = azure_environment.active_directory_resource_id
36
60
  settings
37
61
  end
38
62
  end
@@ -0,0 +1,163 @@
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
+ module AzureEnvironments
7
+ #
8
+ # An instance of this class describes an environment in Azure
9
+ #
10
+ class AzureEnvironment
11
+
12
+ # @return [String] the Environment name
13
+ attr_reader :name
14
+
15
+ # @return [String] the management portal URL
16
+ attr_reader :portal_url
17
+
18
+ # @return [String] the publish settings file URL
19
+ attr_reader :publishing_profile_url
20
+
21
+ # @return [String] the management service endpoint
22
+ attr_reader :management_endpoint_url
23
+
24
+ # @return [String] the resource management endpoint
25
+ attr_reader :resource_manager_endpoint_url
26
+
27
+ # @return [String] the sql server management endpoint for mobile commands
28
+ attr_reader :sql_management_endpoint_url
29
+
30
+ # @return [String] the dns suffix for sql servers
31
+ attr_reader :sql_server_hostname_suffix
32
+
33
+ # @return [String] the template gallery endpoint
34
+ attr_reader :gallery_endpoint_url
35
+
36
+ # @return [String] the Active Directory login endpoint
37
+ attr_reader :active_directory_endpoint_url
38
+
39
+ # @return [String] the resource ID to obtain AD tokens for
40
+ attr_reader :active_directory_resource_id
41
+
42
+ # @return [String] the Active Directory resource ID
43
+ attr_reader :active_directory_graph_resource_id
44
+
45
+ # @return [String] the Active Directory resource ID
46
+ attr_reader :active_directory_graph_api_version
47
+
48
+ # @return [String] the endpoint suffix for storage accounts
49
+ attr_reader :storage_endpoint_suffix
50
+
51
+ # @return [String] the KeyVault service dns suffix
52
+ attr_reader :key_vault_dns_suffix
53
+
54
+ # @return [String] the data lake store filesystem service dns suffix
55
+ attr_reader :datalake_store_filesystem_endpoint_suffix
56
+
57
+ # @return [String] the data lake analytics job and catalog service dns suffix
58
+ attr_reader :datalake_analytics_catalog_and_job_endpoint_suffix
59
+
60
+ # @return [Boolean] determines whether the authentication endpoint should be validated with Azure AD. Default value is true.
61
+ attr_reader :validate_authority
62
+
63
+ def initialize(options)
64
+ required_properties = [:name, :portal_url, :management_endpoint_url, :resource_manager_endpoint_url, :active_directory_endpoint_url, :active_directory_resource_id]
65
+
66
+ required_supplied_properties = required_properties & options.keys
67
+
68
+ if required_supplied_properties.nil? || required_supplied_properties.empty? || (required_supplied_properties & required_properties) != required_properties
69
+ raise ArgumentError.new("#{required_properties.to_s} are the required properties but provided properties are #{options.to_s}")
70
+ end
71
+
72
+ required_supplied_properties.each do |prop|
73
+ if options[prop].nil? || !options[prop].is_a?(String) || options[prop].empty?
74
+ raise ArgumentError.new("Value of the '#{prop}' property must be of type String and non empty.")
75
+ end
76
+ end
77
+
78
+ # Setting default to true
79
+ @validate_authority = true
80
+
81
+ options.each do |k, v|
82
+ instance_variable_set("@#{k}", v) unless v.nil?
83
+ end
84
+ end
85
+ end
86
+
87
+ Azure = AzureEnvironments::AzureEnvironment.new({
88
+ :name => 'Azure',
89
+ :portal_url => 'http://go.microsoft.com/fwlink/?LinkId=254433',
90
+ :publishing_profile_url => 'http://go.microsoft.com/fwlink/?LinkId=254432',
91
+ :management_endpoint_url => 'https://management.core.windows.net',
92
+ :resource_manager_endpoint_url => 'https://management.azure.com/',
93
+ :sql_management_endpoint_url => 'https://management.core.windows.net:8443/',
94
+ :sql_server_hostname_suffix => '.database.windows.net',
95
+ :gallery_endpoint_url => 'https://gallery.azure.com/',
96
+ :active_directory_endpoint_url => 'https://login.microsoftonline.com/',
97
+ :active_directory_resource_id => 'https://management.core.windows.net/',
98
+ :active_directory_graph_resource_id => 'https://graph.windows.net/',
99
+ :active_directory_graph_api_version => '2013-04-05',
100
+ :storage_endpoing_suffix => '.core.windows.net',
101
+ :key_vault_dns_suffix => '.vault.azure.net',
102
+ :datalake_store_filesystem_endpoint_suffix => 'azuredatalakestore.net',
103
+ :datalake_analytics_catalog_and_job_endpoint_suffix => 'azuredatalakeanalytics.net'
104
+ })
105
+ AzureChina = AzureEnvironments::AzureEnvironment.new({
106
+ :name => 'AzureChina',
107
+ :portal_url => 'http://go.microsoft.com/fwlink/?LinkId=301902',
108
+ :publishing_profile_url => 'http://go.microsoft.com/fwlink/?LinkID=301774',
109
+ :management_endpoint_url => 'https://management.core.chinacloudapi.cn',
110
+ :resource_manager_endpoint_url => 'https://management.chinacloudapi.cn',
111
+ :sql_management_endpoint_url => 'https://management.core.chinacloudapi.cn:8443/',
112
+ :sql_server_hostname_suffix => '.database.chinacloudapi.cn',
113
+ :gallery_endpoint_url => 'https://gallery.chinacloudapi.cn/',
114
+ :active_directory_endpoint_url => 'https://login.chinacloudapi.cn/',
115
+ :active_directory_resource_id => 'https://management.core.chinacloudapi.cn/',
116
+ :active_directory_graph_resource_id => 'https://graph.chinacloudapi.cn/',
117
+ :active_directory_graph_api_version => '2013-04-05',
118
+ :storage_endpoing_suffix => '.core.chinacloudapi.cn',
119
+ :key_vault_dns_suffix => '.vault.azure.cn',
120
+ # TODO: add dns suffixes for the china cloud for datalake store and datalake analytics once they are defined.
121
+ :datalake_store_filesystem_endpoint_suffix => 'N/A',
122
+ :datalake_analytics_catalog_and_job_endpoint_suffix => 'N/A'
123
+ })
124
+ AzureUSGovernment = AzureEnvironments::AzureEnvironment.new({
125
+ :name => 'AzureUSGovernment',
126
+ :portal_url => 'https://manage.windowsazure.us',
127
+ :publishing_profile_url => 'https://manage.windowsazure.us/publishsettings/index',
128
+ :management_endpoint_url => 'https://management.core.usgovcloudapi.net',
129
+ :resource_manager_endpoint_url => 'https://management.usgovcloudapi.net',
130
+ :sql_management_endpoint_url => 'https://management.core.usgovcloudapi.net:8443/',
131
+ :sql_server_hostname_suffix => '.database.usgovcloudapi.net',
132
+ :gallery_endpoint_url => 'https://gallery.usgovcloudapi.net/',
133
+ :active_directory_endpoint_url => 'https://login.microsoftonline.com/',
134
+ :active_directory_resource_id => 'https://management.core.usgovcloudapi.net/',
135
+ :active_directory_graph_resource_id => 'https://graph.windows.net/',
136
+ :active_directory_graph_api_version => '2013-04-05',
137
+ :storage_endpoing_suffix => '.core.usgovcloudapi.net',
138
+ :key_vault_dns_suffix => '.vault.usgovcloudapi.net',
139
+ # TODO: add dns suffixes for the US government for datalake store and datalake analytics once they are defined.
140
+ :datalake_store_filesystem_endpoint_suffix => 'N/A',
141
+ :datalake_analytics_catalog_and_job_endpoint_suffix => 'N/A'
142
+ })
143
+ AzureGermanCloud = AzureEnvironments::AzureEnvironment.new({
144
+ :name => 'AzureGermanCloud',
145
+ :portal_url => 'http://portal.microsoftazure.de/',
146
+ :publishing_profile_url => 'https://manage.microsoftazure.de/publishsettings/index',
147
+ :management_endpoint_url => 'https://management.core.cloudapi.de',
148
+ :resource_manager_endpoint_url => 'https://management.microsoftazure.de',
149
+ :sql_management_endpoint_url => 'https://management.core.cloudapi.de:8443/',
150
+ :sql_server_hostname_suffix => '.database.cloudapi.de',
151
+ :gallery_endpoint_url => 'https://gallery.cloudapi.de/',
152
+ :active_directory_endpoint_url => 'https://login.microsoftonline.de/',
153
+ :active_directory_resource_id => 'https://management.core.cloudapi.de/',
154
+ :active_directory_graph_resource_id => 'https://graph.cloudapi.de/',
155
+ :active_directory_graph_api_version => '2013-04-05',
156
+ :storage_endpoing_suffix => '.core.cloudapi.de',
157
+ :key_vault_dns_suffix => '.vault.microsoftazure.de',
158
+ # TODO: add dns suffixes for the US government for datalake store and datalake analytics once they are defined.
159
+ :datalake_store_filesystem_endpoint_suffix => 'N/A',
160
+ :datalake_analytics_catalog_and_job_endpoint_suffix => 'N/A'
161
+ })
162
+ end
163
+ end
@@ -91,7 +91,7 @@ module MsRestAzure
91
91
 
92
92
  url = URI.parse(token_acquire_url)
93
93
 
94
- connection = Faraday.new(:url => url) do |builder|
94
+ connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|
95
95
  builder.adapter Faraday.default_adapter
96
96
  end
97
97
 
@@ -110,7 +110,7 @@ module MsRestAzure
110
110
  attr_accessor :connection
111
111
 
112
112
  def create_connection(base_url)
113
- @connection ||= Faraday.new(:url => base_url) do |faraday|
113
+ @connection ||= Faraday.new(:url => base_url, :ssl => MsRest.ssl_options) do |faraday|
114
114
  [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]].each{ |args| faraday.use(*args) }
115
115
  faraday.adapter Faraday.default_adapter
116
116
  faraday.headers = request.headers
@@ -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.4.0'
6
+ VERSION = '0.5.0'
7
7
  end
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,30 +114,27 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.4.0
117
+ version: 0.5.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.4.0
124
+ version: 0.5.0
125
125
  description: Azure Client Library for Ruby.
126
126
  email: azsdkteam@microsoft.com
127
127
  executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
- - ".gitignore"
132
- - ".travis.yml"
133
- - ChangeLog.md
134
- - Gemfile
131
+ - CHANGELOG.md
135
132
  - LICENSE.txt
136
133
  - README.md
137
- - Rakefile
138
134
  - lib/ms_rest_azure.rb
139
135
  - lib/ms_rest_azure/active_directory_service_settings.rb
140
136
  - lib/ms_rest_azure/async_operation_status.rb
137
+ - lib/ms_rest_azure/azure_environment.rb
141
138
  - lib/ms_rest_azure/azure_operation_error.rb
142
139
  - lib/ms_rest_azure/azure_operation_response.rb
143
140
  - lib/ms_rest_azure/azure_service_client.rb
@@ -148,7 +145,6 @@ files:
148
145
  - lib/ms_rest_azure/serialization.rb
149
146
  - lib/ms_rest_azure/sub_resource.rb
150
147
  - lib/ms_rest_azure/version.rb
151
- - ms_rest_azure.gemspec
152
148
  homepage: https://github.com/Azure/autorest
153
149
  licenses:
154
150
  - MIT
@@ -169,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
165
  version: '0'
170
166
  requirements: []
171
167
  rubyforge_project:
172
- rubygems_version: 2.4.6
168
+ rubygems_version: 2.4.8
173
169
  signing_key:
174
170
  specification_version: 4
175
171
  summary: Azure Client Library for Ruby.
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- .ruby-version
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.5
data/Gemfile DELETED
@@ -1,16 +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
- source 'https://rubygems.org'
6
-
7
- # Specify your gem's dependencies in ms_rest_azure.gemspec
8
- gemspec
9
-
10
- group :development do
11
- gem 'ms_rest', path: '../ms-rest'
12
- end
13
-
14
- group :test do
15
- gem 'rspec'
16
- end
data/Rakefile DELETED
@@ -1,5 +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 "bundler/gem_tasks"
@@ -1,36 +0,0 @@
1
- # Copyright (c) Microsoft Corporation. All rights reserved.
2
- # Licensed under the MIT License. See License.txt in the project root for license information.
3
-
4
- # coding: utf-8
5
- lib = File.expand_path('../lib', __FILE__)
6
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
- require 'ms_rest_azure/version'
8
-
9
- Gem::Specification.new do |spec|
10
- spec.name = 'ms_rest_azure'
11
- spec.version = MsRestAzure::VERSION
12
- spec.authors = 'Microsoft Corporation'
13
- spec.email = 'azsdkteam@microsoft.com'
14
-
15
- spec.summary = %q{Azure Client Library for Ruby.}
16
- spec.description = %q{Azure Client Library for Ruby.}
17
- spec.homepage = 'https://github.com/Azure/autorest'
18
- spec.license = 'MIT'
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = 'bin'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
24
-
25
- spec.required_ruby_version = '>= 1.9.3'
26
-
27
- spec.add_development_dependency 'bundler', '~> 1.9'
28
- spec.add_development_dependency 'rake', '~> 10.0'
29
- spec.add_development_dependency 'rspec', '~> 3.3'
30
-
31
- spec.add_runtime_dependency 'json', '~> 1.7'
32
- spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
33
- spec.add_runtime_dependency 'faraday', '~> 0.9'
34
- spec.add_runtime_dependency 'faraday-cookie_jar', '~> 0.0.6'
35
- spec.add_runtime_dependency 'ms_rest', '~> 0.4.0'
36
- end