azure-armrest 0.3.10 → 0.3.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/.travis.yml +1 -0
- data/CHANGES +8 -0
- data/Gemfile +5 -0
- data/azure-armrest.gemspec +2 -1
- data/lib/azure/armrest/armrest_service.rb +19 -0
- data/lib/azure/armrest/resource_group_based_service.rb +7 -25
- data/lib/azure/armrest/resource_service.rb +18 -2
- data/lib/azure/armrest/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 374a82fa5abab25e86c1d55475f91cbcd51f0606
|
4
|
+
data.tar.gz: 8fb3f44d22dbe3f8d4697c74205d671e04c7be96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67130daca26bbfc9b629dd256f65a92412eaebe7b59a832a4f80b032ae0622052c4979640631458609fb466aac204e1f0f678184d5ed13e2e45a69085b885b9d
|
7
|
+
data.tar.gz: 2539f429201b3d24ad4703bab06b4e7112125dba85aa29a047ab6c1d0843a9a13eaf2ff229b9850ff34695d6b7412c694d3d63bf36d2f493dcff7c4b7ccada96
|
data/.travis.yml
CHANGED
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
= 0.3.11 - 8-Nov-2016
|
2
|
+
* Fixed the regex for the internal method parse_id_string, making the
|
3
|
+
get_associated_resource method more robust.
|
4
|
+
* The get_associated_resource now supports VM extensions.
|
5
|
+
* The list and list_all methods for the ResourceService class now
|
6
|
+
optionally return all possible results instead of capping at 1000.
|
7
|
+
* Some updates for codeclimate-test-reporter, simplecov.
|
8
|
+
|
1
9
|
= 0.3.10 - 28-Oct-2016
|
2
10
|
* Added the ResourceGroupBasedService#get_associated_resource method. This
|
3
11
|
method will retrieve a service or subservice resource based on an ID string.
|
data/Gemfile
CHANGED
data/azure-armrest.gemspec
CHANGED
@@ -31,6 +31,7 @@ behind the scenes.
|
|
31
31
|
spec.add_development_dependency 'bundler'
|
32
32
|
spec.add_development_dependency 'rake'
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
-
spec.add_development_dependency '
|
34
|
+
spec.add_development_dependency 'simplecov'
|
35
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.0'
|
35
36
|
spec.add_development_dependency 'timecop', '~> 0.7'
|
36
37
|
end
|
@@ -337,6 +337,25 @@ module Azure
|
|
337
337
|
return nil unless json['nextLink']
|
338
338
|
json['nextLink'][/.*?skipToken=(.*?)$/i, 1]
|
339
339
|
end
|
340
|
+
|
341
|
+
# Make additional calls and concatenate the results if a continuation URL is found.
|
342
|
+
def get_all_results(response)
|
343
|
+
results = Azure::Armrest::ArmrestCollection.create_from_response(response, model_class)
|
344
|
+
nextlink = JSON.parse(response)['nextLink']
|
345
|
+
|
346
|
+
while nextlink
|
347
|
+
response = rest_get_without_encoding(nextlink)
|
348
|
+
more = Azure::Armrest::ArmrestCollection.create_from_response(response, model_class)
|
349
|
+
results.concat(more)
|
350
|
+
nextlink = JSON.parse(response)['nextLink']
|
351
|
+
end
|
352
|
+
|
353
|
+
results
|
354
|
+
end
|
355
|
+
|
356
|
+
def model_class
|
357
|
+
@model_class ||= Object.const_get(self.class.to_s.sub(/Service$/, ''))
|
358
|
+
end
|
340
359
|
end # ArmrestService
|
341
360
|
end # Armrest
|
342
361
|
end # Azure
|
@@ -16,6 +16,7 @@ module Azure
|
|
16
16
|
'securityrules' => Azure::Armrest::Network::NetworkSecurityRule,
|
17
17
|
'routes' => Azure::Armrest::Network::Route,
|
18
18
|
'databases' => Azure::Armrest::Sql::SqlDatabase,
|
19
|
+
'extensions' => Azure::Armrest::VirtualMachineExtension
|
19
20
|
}.freeze
|
20
21
|
|
21
22
|
# Create a resource +name+ within the resource group +rgroup+, or the
|
@@ -175,14 +176,14 @@ module Azure
|
|
175
176
|
def parse_id_string(id_string)
|
176
177
|
regex = %r{
|
177
178
|
subscriptions/
|
178
|
-
(?<subscription_id>[
|
179
|
+
(?<subscription_id>[^\/]+)?/
|
179
180
|
resourceGroups/
|
180
|
-
(?<resource_group
|
181
|
+
(?<resource_group>[^\/]+)?/
|
181
182
|
providers/
|
182
|
-
(?<provider>[
|
183
|
-
(?<service_name
|
184
|
-
(?<resource_name
|
185
|
-
(/(?<subservice_name
|
183
|
+
(?<provider>[^\/]+)?/
|
184
|
+
(?<service_name>[^\/]+)?/
|
185
|
+
(?<resource_name>[^\/]+)
|
186
|
+
(/(?<subservice_name>[^\/]+)?/(?<subservice_resource_name>[^\/]+))*
|
186
187
|
\z
|
187
188
|
}x
|
188
189
|
|
@@ -190,21 +191,6 @@ module Azure
|
|
190
191
|
Hash[match.names.zip(match.captures)]
|
191
192
|
end
|
192
193
|
|
193
|
-
# Make additional calls and concatenate the results if a continuation URL is found.
|
194
|
-
def get_all_results(response)
|
195
|
-
results = Azure::Armrest::ArmrestCollection.create_from_response(response, model_class)
|
196
|
-
nextlink = JSON.parse(response)['nextLink']
|
197
|
-
|
198
|
-
while nextlink
|
199
|
-
response = rest_get_without_encoding(nextlink)
|
200
|
-
more = Azure::Armrest::ArmrestCollection.create_from_response(response, model_class)
|
201
|
-
results.concat(more)
|
202
|
-
nextlink = JSON.parse(response)['nextLink']
|
203
|
-
end
|
204
|
-
|
205
|
-
results
|
206
|
-
end
|
207
|
-
|
208
194
|
def validate_resource_group(name)
|
209
195
|
raise ArgumentError, "must specify resource group" unless name
|
210
196
|
end
|
@@ -224,10 +210,6 @@ module Azure
|
|
224
210
|
url << "?api-version=#{@api_version}"
|
225
211
|
end
|
226
212
|
|
227
|
-
def model_class
|
228
|
-
@model_class ||= Object.const_get(self.class.to_s.sub(/Service$/, ''))
|
229
|
-
end
|
230
|
-
|
231
213
|
# Aggregate resources from all resource groups.
|
232
214
|
#
|
233
215
|
# To be used in the cases where the API does not support list_all with
|
@@ -14,6 +14,9 @@ module Azure
|
|
14
14
|
# resource group. You can optionally pass :top or :filter options as well
|
15
15
|
# to restrict returned results.
|
16
16
|
#
|
17
|
+
# Normally this is capped at 1000 results, but you may specify the :all
|
18
|
+
# option to get everything.
|
19
|
+
#
|
17
20
|
# Examples:
|
18
21
|
#
|
19
22
|
# rs = Azure::Armrest::ResourceService.new
|
@@ -23,16 +26,29 @@ module Azure
|
|
23
26
|
def list(resource_group, options = {})
|
24
27
|
url = build_url(resource_group, options)
|
25
28
|
response = rest_get(url)
|
26
|
-
|
29
|
+
|
30
|
+
if options[:all]
|
31
|
+
get_all_results(response)
|
32
|
+
else
|
33
|
+
Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)
|
34
|
+
end
|
27
35
|
end
|
28
36
|
|
29
37
|
# Same as Azure::Armrest::ResourceService#list but returns all resources
|
30
38
|
# for all resource groups.
|
31
39
|
#
|
40
|
+
# Normally this is capped at 1000 results, but you may specify the :all
|
41
|
+
# option to get everything.
|
42
|
+
#
|
32
43
|
def list_all(options = {})
|
33
44
|
url = build_url(nil, options)
|
34
45
|
response = rest_get(url)
|
35
|
-
|
46
|
+
|
47
|
+
if options[:all]
|
48
|
+
get_all_results(response)
|
49
|
+
else
|
50
|
+
Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
|
38
54
|
# Move the resources from +source_group+ under +source_subscription+,
|
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.3.
|
4
|
+
version: 0.3.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: 2016-
|
14
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|
@@ -168,7 +168,7 @@ dependencies:
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '3.0'
|
170
170
|
- !ruby/object:Gem::Dependency
|
171
|
-
name:
|
171
|
+
name: simplecov
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - ">="
|
@@ -181,6 +181,20 @@ dependencies:
|
|
181
181
|
- - ">="
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
name: codeclimate-test-reporter
|
186
|
+
requirement: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 1.0.0
|
191
|
+
type: :development
|
192
|
+
prerelease: false
|
193
|
+
version_requirements: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 1.0.0
|
184
198
|
- !ruby/object:Gem::Dependency
|
185
199
|
name: timecop
|
186
200
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
289
|
version: '0'
|
276
290
|
requirements: []
|
277
291
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.6.
|
292
|
+
rubygems_version: 2.6.8
|
279
293
|
signing_key:
|
280
294
|
specification_version: 4
|
281
295
|
summary: An interface for ARM/JSON Azure REST API
|