ms_rest_azure 0.9.0 → 0.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/ms_rest_azure.rb +5 -2
- data/lib/ms_rest_azure/azure_environment.rb +4 -4
- data/lib/ms_rest_azure/common/configurable.rb +86 -0
- data/lib/ms_rest_azure/common/default.rb +57 -0
- data/lib/ms_rest_azure/version.rb +1 -1
- metadata +6 -6
- data/lib/ms_rest_azure/resource.rb +0 -89
- data/lib/ms_rest_azure/sub_resource.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5457fba833750435c73dcd0e66ed4e69e9a4499b
|
4
|
+
data.tar.gz: 2f580ffcff1c2dae441e06ac7bf889cfc5669c2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea6e2850e1e7760dfdf6fb9fb67c0920d4cdd445c01826638cd194bd49a3e4aed1458f88ddca41da1c90b80601233c595f5e20019303af407d51f3661c34bce
|
7
|
+
data.tar.gz: ca590be6eb21343388abcbc25fcb57cdc61388e52b6379dd3b066ffbae81258e017263b79aa79cf91aaea28f850447bc995cd85f75d63cbeee6ee7fdba8beba7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
##2017.11.10 ms_rest_azure version 0.10.0
|
2
|
+
* Modified portal URLs for Azure cloud environments. Refer [PR #1106](https://github.com/Azure/azure-sdk-for-ruby/pull/1106) for further details.
|
3
|
+
* [Breaking Change] Removed Resource and SubResource classes. Refer [PR #1106](https://github.com/Azure/azure-sdk-for-ruby/pull/1106) for further details.
|
4
|
+
* Added Configurable and Default classes to be used by the profile gems. Refer [PR #1111](https://github.com/Azure/azure-sdk-for-ruby/pull/1111) for further details.
|
5
|
+
|
1
6
|
##2017.09.11 ms_rest_azure version 0.9.0
|
2
7
|
* [Breaking Change] Managed Service Identity authentication to acquire token does not require `tenant_id`.[Issue #930](https://github.com/Azure/azure-sdk-for-ruby/issues/930) [PR #931](https://github.com/Azure/azure-sdk-for-ruby/pull/931)
|
3
8
|
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ To start working on the gem the only additional dev dependecy is required - rspe
|
|
37
37
|
Reference it in the gemfile and also add this line to your client's gemspec file:
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.
|
40
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.10.0'
|
41
41
|
```
|
42
42
|
Don't forget to correct the version.
|
43
43
|
|
data/lib/ms_rest_azure.rb
CHANGED
@@ -13,11 +13,14 @@ require 'ms_rest_azure/cloud_error_data.rb'
|
|
13
13
|
require 'ms_rest_azure/credentials/application_token_provider.rb'
|
14
14
|
require 'ms_rest_azure/credentials/msi_token_provider.rb'
|
15
15
|
require 'ms_rest_azure/polling_state.rb'
|
16
|
-
require 'ms_rest_azure/sub_resource.rb'
|
17
|
-
require 'ms_rest_azure/resource.rb'
|
18
16
|
require 'ms_rest_azure/serialization.rb'
|
19
17
|
require 'ms_rest_azure/version'
|
18
|
+
require 'ms_rest_azure/common/configurable'
|
19
|
+
require 'ms_rest_azure/common/default'
|
20
20
|
|
21
21
|
module MsRestAzure end
|
22
22
|
module MsRestAzure::Serialization end
|
23
23
|
module MsRestAzure::AzureEnvironments end
|
24
|
+
module MsRestAzure::Common end
|
25
|
+
module MsRestAzure::Common::Configurable end
|
26
|
+
module MsRestAzure::Common::Default end
|
@@ -86,7 +86,7 @@ module MsRestAzure
|
|
86
86
|
|
87
87
|
AzureCloud = AzureEnvironments::AzureEnvironment.new({
|
88
88
|
:name => 'AzureCloud',
|
89
|
-
:portal_url => '
|
89
|
+
:portal_url => 'https://portal.azure.com',
|
90
90
|
:publishing_profile_url => 'http://go.microsoft.com/fwlink/?LinkId=254432',
|
91
91
|
:management_endpoint_url => 'https://management.core.windows.net',
|
92
92
|
:resource_manager_endpoint_url => 'https://management.azure.com/',
|
@@ -104,7 +104,7 @@ module MsRestAzure
|
|
104
104
|
})
|
105
105
|
AzureChinaCloud = AzureEnvironments::AzureEnvironment.new({
|
106
106
|
:name => 'AzureChinaCloud',
|
107
|
-
:portal_url => '
|
107
|
+
:portal_url => 'https://portal.azure.cn',
|
108
108
|
:publishing_profile_url => 'http://go.microsoft.com/fwlink/?LinkID=301774',
|
109
109
|
:management_endpoint_url => 'https://management.core.chinacloudapi.cn',
|
110
110
|
:resource_manager_endpoint_url => 'https://management.chinacloudapi.cn',
|
@@ -123,14 +123,14 @@ module MsRestAzure
|
|
123
123
|
})
|
124
124
|
AzureUSGovernment = AzureEnvironments::AzureEnvironment.new({
|
125
125
|
:name => 'AzureUSGovernment',
|
126
|
-
:portal_url => 'https://
|
126
|
+
:portal_url => 'https://portal.azure.us',
|
127
127
|
:publishing_profile_url => 'https://manage.windowsazure.us/publishsettings/index',
|
128
128
|
:management_endpoint_url => 'https://management.core.usgovcloudapi.net',
|
129
129
|
:resource_manager_endpoint_url => 'https://management.usgovcloudapi.net',
|
130
130
|
:sql_management_endpoint_url => 'https://management.core.usgovcloudapi.net:8443/',
|
131
131
|
:sql_server_hostname_suffix => '.database.usgovcloudapi.net',
|
132
132
|
:gallery_endpoint_url => 'https://gallery.usgovcloudapi.net/',
|
133
|
-
:active_directory_endpoint_url => 'https://login.microsoftonline.com/',
|
133
|
+
:active_directory_endpoint_url => 'https://login-us.microsoftonline.com/',
|
134
134
|
:active_directory_resource_id => 'https://management.core.usgovcloudapi.net/',
|
135
135
|
:active_directory_graph_resource_id => 'https://graph.windows.net/',
|
136
136
|
:active_directory_graph_api_version => '2013-04-05',
|
@@ -0,0 +1,86 @@
|
|
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::Common
|
6
|
+
# The Azure::Common::Configurable module provides basic configuration for Azure activities.
|
7
|
+
module Configurable
|
8
|
+
# @return [String] Azure tenant id (also known as domain).
|
9
|
+
attr_accessor :tenant_id
|
10
|
+
|
11
|
+
# @return [String] Azure client id.
|
12
|
+
attr_accessor :client_id
|
13
|
+
|
14
|
+
# @return [String] Azure secret key.
|
15
|
+
attr_accessor :client_secret
|
16
|
+
|
17
|
+
# @return [String] Azure subscription id.
|
18
|
+
attr_accessor :subscription_id
|
19
|
+
|
20
|
+
# @return [MsRestAzure::ActiveDirectoryServiceSettings] Azure active directory service settings.
|
21
|
+
attr_accessor :active_directory_settings
|
22
|
+
|
23
|
+
# @return [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
24
|
+
attr_accessor :credentials
|
25
|
+
|
26
|
+
class << self
|
27
|
+
#
|
28
|
+
# List of configurable keys for {Azure::Common::Client}.
|
29
|
+
# @return [Array] of option keys.
|
30
|
+
#
|
31
|
+
def keys
|
32
|
+
@keys ||= [:tenant_id, :client_id, :client_secret, :subscription_id, :active_directory_settings]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Set configuration options using a block.
|
38
|
+
#
|
39
|
+
def configure
|
40
|
+
yield self
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
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.
|
46
|
+
#
|
47
|
+
def reset!(options = {})
|
48
|
+
MsRestAzure::Common::Configurable.keys.each do |key|
|
49
|
+
default_value = MsRestAzure::Common::Default.options[key]
|
50
|
+
instance_variable_set(:"@#{key}", options.fetch(key, default_value))
|
51
|
+
end
|
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
|
+
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
|
+
|
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))
|
64
|
+
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
def config
|
69
|
+
self
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
#
|
75
|
+
# configures configurable options to default values
|
76
|
+
#
|
77
|
+
def setup_default_options
|
78
|
+
opts = {}
|
79
|
+
MsRestAzure::Common::Configurable.keys.map do |key|
|
80
|
+
opts[key] = MsRestAzure::Common::Default.options[key]
|
81
|
+
end
|
82
|
+
|
83
|
+
opts
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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::Common
|
6
|
+
module Default
|
7
|
+
class << self
|
8
|
+
#
|
9
|
+
# Default Azure Tenant Id.
|
10
|
+
# @return [String] Azure Tenant Id.
|
11
|
+
#
|
12
|
+
def tenant_id
|
13
|
+
ENV['AZURE_TENANT_ID']
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# Default Azure Client Id.
|
18
|
+
# @return [String] Azure Client Id.
|
19
|
+
#
|
20
|
+
def client_id
|
21
|
+
ENV['AZURE_CLIENT_ID']
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Default Azure Client Secret.
|
26
|
+
# @return [String] Azure Client Secret.
|
27
|
+
#
|
28
|
+
def client_secret
|
29
|
+
ENV['AZURE_CLIENT_SECRET']
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Default Azure Subscription Id.
|
34
|
+
# @return [String] Azure Subscription Id.
|
35
|
+
#
|
36
|
+
def subscription_id
|
37
|
+
ENV['AZURE_SUBSCRIPTION_ID']
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Default Azure Active Directory Service Settings.
|
42
|
+
# @return [MsRestAzure::ActiveDirectoryServiceSettings] Azure Active Directory Service Settings.
|
43
|
+
#
|
44
|
+
def active_directory_settings
|
45
|
+
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Configuration options.
|
50
|
+
# @return [Hash] Configuration options.
|
51
|
+
#
|
52
|
+
def options
|
53
|
+
Hash[MsRestAzure::Common::Configurable.keys.map { |key| [key, send(key)]}]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
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
|
+
version: 0.10.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: 2017-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.7.
|
103
|
+
version: 0.7.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.7.
|
110
|
+
version: 0.7.2
|
111
111
|
description: Azure Client Library for Ruby.
|
112
112
|
email: azsdkteam@microsoft.com
|
113
113
|
executables: []
|
@@ -125,12 +125,12 @@ files:
|
|
125
125
|
- lib/ms_rest_azure/azure_operation_response.rb
|
126
126
|
- lib/ms_rest_azure/azure_service_client.rb
|
127
127
|
- lib/ms_rest_azure/cloud_error_data.rb
|
128
|
+
- lib/ms_rest_azure/common/configurable.rb
|
129
|
+
- lib/ms_rest_azure/common/default.rb
|
128
130
|
- lib/ms_rest_azure/credentials/application_token_provider.rb
|
129
131
|
- lib/ms_rest_azure/credentials/msi_token_provider.rb
|
130
132
|
- lib/ms_rest_azure/polling_state.rb
|
131
|
-
- lib/ms_rest_azure/resource.rb
|
132
133
|
- lib/ms_rest_azure/serialization.rb
|
133
|
-
- lib/ms_rest_azure/sub_resource.rb
|
134
134
|
- lib/ms_rest_azure/version.rb
|
135
135
|
homepage: https://aka.ms/ms_rest_azure
|
136
136
|
licenses:
|
@@ -1,89 +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
|
-
|
6
|
-
module MsRestAzure
|
7
|
-
#
|
8
|
-
# Class which represents any Azure resource.
|
9
|
-
#
|
10
|
-
class Resource < SubResource
|
11
|
-
|
12
|
-
# @return [String] the name of the resource.
|
13
|
-
attr_accessor :name
|
14
|
-
|
15
|
-
# @return [String] the type of the resource.
|
16
|
-
attr_accessor :type
|
17
|
-
|
18
|
-
# @return [String] the location of the resource (required).
|
19
|
-
attr_accessor :location
|
20
|
-
|
21
|
-
# @return [Hash{String => String}] the tags attached to resources (optional).
|
22
|
-
attr_accessor :tags
|
23
|
-
|
24
|
-
# @return [String] the name of the resource group of the resource.
|
25
|
-
def resource_group
|
26
|
-
unless self.id.nil?
|
27
|
-
groups = self.id.match(/.+\/resourceGroups\/([^\/]+)\/.+/)
|
28
|
-
groups.captures[0].strip if groups
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.mapper
|
33
|
-
{
|
34
|
-
required: false,
|
35
|
-
serialized_name: 'Resource',
|
36
|
-
type: {
|
37
|
-
name: 'Composite',
|
38
|
-
class_name: 'Resource',
|
39
|
-
model_properties: {
|
40
|
-
id: {
|
41
|
-
required: false,
|
42
|
-
serialized_name: 'id',
|
43
|
-
type: {
|
44
|
-
name: 'String'
|
45
|
-
}
|
46
|
-
},
|
47
|
-
name: {
|
48
|
-
required: false,
|
49
|
-
read_only: true,
|
50
|
-
serialized_name: 'name',
|
51
|
-
type: {
|
52
|
-
name: 'String'
|
53
|
-
}
|
54
|
-
},
|
55
|
-
type: {
|
56
|
-
required: false,
|
57
|
-
read_only: true,
|
58
|
-
serialized_name: 'type',
|
59
|
-
type: {
|
60
|
-
name: 'String'
|
61
|
-
}
|
62
|
-
},
|
63
|
-
location: {
|
64
|
-
required: false,
|
65
|
-
serialized_name: 'location',
|
66
|
-
type: {
|
67
|
-
name: 'String'
|
68
|
-
}
|
69
|
-
},
|
70
|
-
tags: {
|
71
|
-
required: false,
|
72
|
-
serialized_name: 'tags',
|
73
|
-
type: {
|
74
|
-
name: 'Dictionary',
|
75
|
-
value: {
|
76
|
-
required: false,
|
77
|
-
serialized_name: 'StringElementType',
|
78
|
-
type: {
|
79
|
-
name: 'String'
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,34 +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
|
-
module MsRestAzure
|
6
|
-
#
|
7
|
-
# Class which represents any Azure subresource.
|
8
|
-
#
|
9
|
-
class SubResource
|
10
|
-
|
11
|
-
# @return [String] the id of the subresource.
|
12
|
-
attr_accessor :id
|
13
|
-
|
14
|
-
def self.mapper
|
15
|
-
{
|
16
|
-
required: false,
|
17
|
-
serialized_name: 'SubResource',
|
18
|
-
type: {
|
19
|
-
name: 'Composite',
|
20
|
-
class_name: 'SubResource',
|
21
|
-
model_properties: {
|
22
|
-
id: {
|
23
|
-
required: false,
|
24
|
-
serialized_name: 'id',
|
25
|
-
type: {
|
26
|
-
name: 'String'
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|