azure-armrest 0.9.10 → 0.9.11
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/CHANGES +5 -0
- data/lib/azure/armrest/environment.rb +51 -17
- data/lib/azure/armrest/model/base_model.rb +1 -0
- data/lib/azure/armrest/resource_provider_service.rb +8 -0
- data/lib/azure/armrest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49845f9146789f624afa28dac9e05a2208b3afd0ca1ee69c77e082d22ac6d9e5
|
|
4
|
+
data.tar.gz: 9a0a6539ada1cacc3b4b075b9027bec7092e232bfd9b16c802e5191caaebd2d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b52e91d05f9d32f46d20d122b1c1bfe504e1e4e4781d603e890cdef534d65797f993747745f6cc00e0ec4402eac23189219eaf23c1da7f78becd0a27361a739
|
|
7
|
+
data.tar.gz: 8a7b05918d80333d49fa546f011a42c18b970d0b04c4d3167bae451b9d3c30bbe068f72374753888eeb282c199498e786c6fe7032215b86cb7fd8c38279a68bf
|
data/CHANGES
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
= 0.9.11 - 8-May-2018
|
|
2
|
+
* Added the ResourceProviderService#supported? method.
|
|
3
|
+
* Added the Environment.discover singleton method. This will allow you to
|
|
4
|
+
automatically generate a minimum environment profile based on an endpoint.
|
|
5
|
+
|
|
1
6
|
= 0.9.10 - 17-Apr-2018
|
|
2
7
|
* Fixed a bug in the TemplateDeploymentService#create method where it would
|
|
3
8
|
transform template keys that shouldn't be transformed. Individual subclasses
|
|
@@ -2,22 +2,22 @@ module Azure
|
|
|
2
2
|
module Armrest
|
|
3
3
|
class Environment
|
|
4
4
|
# A list of valid keys that can be passed to the constructor
|
|
5
|
-
VALID_KEYS = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
5
|
+
VALID_KEYS = %i[
|
|
6
|
+
name
|
|
7
|
+
active_directory_authority
|
|
8
|
+
active_directory_resource_id
|
|
9
|
+
gallery_url
|
|
10
|
+
graph_url
|
|
11
|
+
graph_api_version
|
|
12
|
+
key_vault_dns_suffix
|
|
13
|
+
key_vault_service_resource_id
|
|
14
|
+
publish_settings_file_url
|
|
15
|
+
resource_manager_url
|
|
16
|
+
service_management_url
|
|
17
|
+
sql_database_dns_suffix
|
|
18
|
+
storage_suffix
|
|
19
|
+
traffic_manager_dns_suffix
|
|
20
|
+
].freeze
|
|
21
21
|
|
|
22
22
|
# The Environment name
|
|
23
23
|
attr_reader :name
|
|
@@ -74,7 +74,7 @@ module Azure
|
|
|
74
74
|
instance_variable_set("@#{key}", value)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
[
|
|
77
|
+
%i[name active_directory_authority resource_manager_url].each do |key|
|
|
78
78
|
unless instance_variable_get("@#{key}")
|
|
79
79
|
raise ArgumentError, "Mandatory argument '#{key}' not set"
|
|
80
80
|
end
|
|
@@ -82,7 +82,41 @@ module Azure
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
alias authority_url active_directory_authority
|
|
85
|
+
alias login_endpoint active_directory_authority
|
|
85
86
|
alias resource_url resource_manager_url
|
|
87
|
+
alias gallery_endpoint gallery_url
|
|
88
|
+
alias graph_endpoint graph_url
|
|
89
|
+
|
|
90
|
+
# Automatically discover and create an Environment given a resource
|
|
91
|
+
# manager endpoint. The +options+ hash must include an endpoint :url key.
|
|
92
|
+
# It may also include a :name (recommended), and http proxy options.
|
|
93
|
+
#
|
|
94
|
+
def self.discover(options)
|
|
95
|
+
url = options.fetch(:url)
|
|
96
|
+
name = options[:name] || 'Custom'
|
|
97
|
+
|
|
98
|
+
uri = Addressable::URI.join(url, '/metadata/', 'endpoints')
|
|
99
|
+
uri.query = "api-version=1.0"
|
|
100
|
+
|
|
101
|
+
response = ArmrestService.send(
|
|
102
|
+
:rest_get,
|
|
103
|
+
:url => uri.to_s,
|
|
104
|
+
:proxy => options[:proxy],
|
|
105
|
+
:ssl_version => options[:ssl_version],
|
|
106
|
+
:ssl_verify => options[:ssl_verify]
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
endpoint = Endpoint.new(response.body)
|
|
110
|
+
|
|
111
|
+
new(
|
|
112
|
+
:name => name,
|
|
113
|
+
:gallery_url => endpoint.gallery_endpoint,
|
|
114
|
+
:graph_url => endpoint.graph_endpoint,
|
|
115
|
+
:active_directory_authority => endpoint.authentication.login_endpoint,
|
|
116
|
+
:active_directory_resource_id => endpoint.authentication.audiences.first,
|
|
117
|
+
:resource_manager_url => url
|
|
118
|
+
)
|
|
119
|
+
end
|
|
86
120
|
|
|
87
121
|
# Pre-generated environments
|
|
88
122
|
|
|
@@ -118,6 +118,14 @@ module Azure
|
|
|
118
118
|
false
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
+
# Returns whether or not the given +resource_type+ is supported by the
|
|
122
|
+
# given +namespace+. By default it will search the Microsoft.Compute
|
|
123
|
+
# namespace.
|
|
124
|
+
#
|
|
125
|
+
def supported?(resource_type, namespace = 'Microsoft.Compute')
|
|
126
|
+
get(namespace).resource_types.map(&:resource_type).map(&:downcase).include?(resource_type.downcase)
|
|
127
|
+
end
|
|
128
|
+
|
|
121
129
|
private
|
|
122
130
|
|
|
123
131
|
def build_url(namespace = nil, *args)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: azure-armrest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2018-
|
|
14
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: json
|