azure-armrest 0.9.11 → 0.9.12

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
  SHA256:
3
- metadata.gz: 49845f9146789f624afa28dac9e05a2208b3afd0ca1ee69c77e082d22ac6d9e5
4
- data.tar.gz: 9a0a6539ada1cacc3b4b075b9027bec7092e232bfd9b16c802e5191caaebd2d3
3
+ metadata.gz: 416faa7c6d2151e096ed17470ffbd099572a3e82036a98b2359fca338e70a1a6
4
+ data.tar.gz: 380ef8ce3dbcb34e0c1c2b82d38c7a919d1cfd3e3657732184fe868c3cc1f0c8
5
5
  SHA512:
6
- metadata.gz: 4b52e91d05f9d32f46d20d122b1c1bfe504e1e4e4781d603e890cdef534d65797f993747745f6cc00e0ec4402eac23189219eaf23c1da7f78becd0a27361a739
7
- data.tar.gz: 8a7b05918d80333d49fa546f011a42c18b970d0b04c4d3167bae451b9d3c30bbe068f72374753888eeb282c199498e786c6fe7032215b86cb7fd8c38279a68bf
6
+ metadata.gz: 296868a490d1f9a3e46c4f06d1ab615f5b66c9921a8318d766a266313078eda3a2694589820de4efc4b8e30d20f7561e643337901774109b6f9d12e0802ef333
7
+ data.tar.gz: 5e3a47a0c268e4f5e1bce3b0023fd7eb8c9bab20003618e86592ad32dc7cb7773d476860dcd9bacaab5d9d98283ccffd446b22911c8ec1ff755fa16aa57bb615
@@ -1,3 +1,10 @@
1
1
  Style/MethodCallWithArgsParentheses:
2
2
  IgnoredMethods:
3
3
  - attr_from_hash
4
+ - raise
5
+ Style/PercentLiteralDelimiters:
6
+ PreferredDelimiters:
7
+ '%i': []
8
+ '%I': []
9
+ '%w': []
10
+ '%W': []
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ = 0.9.12 - 12-Jul-2018
2
+ * Fixed and updated the ResourceProviderService#list_api_versions method. The
3
+ previous version was broken and would probably return invalid informtion.
4
+ It has therefore been altered to require a service name in addition to the
5
+ namespace so that it can return accurate information.
6
+ * Added the extension, extension_types, and extension_type_versions instance
7
+ methods to the VirtualMachineImageService class.
8
+
1
9
  = 0.9.11 - 8-May-2018
2
10
  * Added the ResourceProviderService#supported? method.
3
11
  * Added the Environment.discover singleton method. This will allow you to
@@ -261,6 +261,7 @@ module Azure
261
261
  class Container < BaseModel; end
262
262
  class Endpoint < BaseModel; end
263
263
  class Event < BaseModel; end
264
+ class ExtensionType < BaseModel; end
264
265
  class ImageVersion < BaseModel; end
265
266
  class Location < BaseModel; end
266
267
  class Offer < BaseModel; end
@@ -83,14 +83,23 @@ module Azure
83
83
  end
84
84
  memoize :list_geo_locations
85
85
 
86
- # Returns an array of supported api-versions for the given +namespace+ provider.
86
+ # Returns an array of supported api-versions for the given +service_name+ under
87
+ # the specified +namespace+ provider.
88
+ #
87
89
  # The results of this method are cached.
88
90
  #
89
- def list_api_versions(namespace)
91
+ # Example:
92
+ #
93
+ # rps.list_api_versions('Microsoft.Resources', 'deployments')
94
+ #
95
+ def list_api_versions(namespace, service_name)
90
96
  url = build_url(namespace)
91
97
  response = rest_get(url)
92
- JSON.parse(response)['resourceTypes'].first['apiVersions']
98
+ JSON.parse(response)['resourceTypes'].find{ |type| type['resourceType'].casecmp(service_name) == 0 }['apiVersions']
99
+ rescue NoMethodError
100
+ raise ArgumentError, "unable to find data for the '#{namespace}/#{service_name}' resource type"
93
101
  end
102
+
94
103
  memoize :list_api_versions
95
104
 
96
105
  # Register the current subscription with the +namespace+ provider.
@@ -1,6 +1,6 @@
1
1
  module Azure
2
2
  module Armrest
3
3
  # The version of the azure-armrest library.
4
- VERSION = '0.9.11'.freeze
4
+ VERSION = '0.9.12'.freeze
5
5
  end
6
6
  end
@@ -126,6 +126,58 @@ module Azure
126
126
  JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::ImageVersion.new(hash) }
127
127
  end
128
128
 
129
+ # Retrieve information about a specific extension image for +type+ and +version+.
130
+ #
131
+ # Example:
132
+ #
133
+ # vmis.extension('LinuxDiagnostic', '2.3.9029', 'westus2', 'Microsoft.OSTCExtensions')
134
+ #
135
+ def extension(type, version, location = @location, publisher = @publisher)
136
+ raise ArgumentError, "No location specified" unless location
137
+ raise ArgumentError, "No publisher specified" unless publisher
138
+
139
+ url = build_url(
140
+ location, 'publishers', publisher, 'artifacttypes',
141
+ 'vmextension', 'types', type, 'versions', version
142
+ )
143
+
144
+ response = rest_get(url)
145
+ Azure::Armrest::ExtensionType.new(response)
146
+ end
147
+
148
+ # Return a list of extension types for the given +location+ and +publisher+.
149
+ #
150
+ # Example:
151
+ #
152
+ # vmis.extension_types('westus', 'Microsoft.OSTCExtensions')
153
+ #
154
+ def extension_types(location = @location, publisher = @publisher)
155
+ raise ArgumentError, "No location specified" unless location
156
+ raise ArgumentError, "No publisher specified" unless publisher
157
+
158
+ url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmextension', 'types')
159
+
160
+ response = rest_get(url)
161
+ JSON.parse(response).map { |hash| Azure::Armrest::ExtensionType.new(hash) }
162
+ end
163
+
164
+ # Return a list of versions for the given +type+ in the provided +location+
165
+ # and +publisher+.
166
+ #
167
+ # Example:
168
+ #
169
+ # vmis.extension_type_versions('LinuxDiagnostic', 'eastus', 'Microsoft.OSTCExtensions')
170
+ #
171
+ def extension_type_versions(type, location = @location, publisher = @publisher)
172
+ raise ArgumentError, "No location specified" unless location
173
+ raise ArgumentError, "No publisher specified" unless publisher
174
+
175
+ url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmextension', 'types', type, 'versions')
176
+
177
+ response = rest_get(url)
178
+ JSON.parse(response).map { |hash| Azure::Armrest::ExtensionType.new(hash) }
179
+ end
180
+
129
181
  private
130
182
 
131
183
  # Builds a URL based on subscription_id an resource_group and any other
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.11
4
+ version: 0.9.12
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-05-08 00:00:00.000000000 Z
14
+ date: 2018-07-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json