azure-armrest 0.9.13 → 0.11.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/.codeclimate.yml +16 -0
- data/.rubocop.yml +3 -3
- data/.rubocop_cc.yml +4 -0
- data/.travis.yml +8 -5
- data/CHANGES +31 -0
- data/README.md +0 -1
- data/azure-armrest.gemspec +6 -6
- data/lib/azure/armrest.rb +0 -1
- data/lib/azure/armrest/armrest_service.rb +17 -5
- data/lib/azure/armrest/configuration.rb +7 -3
- data/lib/azure/armrest/insights/metrics_service.rb +30 -8
- data/lib/azure/armrest/model/storage_account.rb +2 -2
- data/lib/azure/armrest/resource_group_based_service.rb +4 -2
- data/lib/azure/armrest/resource_provider_service.rb +4 -1
- data/lib/azure/armrest/storage/managed_storage_helper.rb +1 -1
- data/lib/azure/armrest/version.rb +1 -1
- data/lib/azure/armrest/virtual_machine_service.rb +66 -11
- metadata +48 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c05fdb104f21ace674e10937a178a0ba1976c11f501d708107e5543976b1f8ae
|
4
|
+
data.tar.gz: 1d78a637421c4166578bf53a56f24dd7b7781dc74323eb02659f0e72ee9c55b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b20b6dcc409488a5559dce6be791448ebdeb78a077e48453c3aa8de143573c508ca92845f3725fc5ca83acb2c0c4970effaf82ed675a9c191b0e281bae3880f
|
7
|
+
data.tar.gz: ebc6a58804b759f3bfed65436e742dd1f7d815df6df252184a6da066fe119725b124287a31133cd49fa5740affe8ff0bbb73f1ecabcf087cb8521d7f118839e2
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
prepare:
|
2
|
+
fetch:
|
3
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
|
4
|
+
path: ".rubocop_base.yml"
|
5
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
|
6
|
+
path: ".rubocop_cc_base.yml"
|
7
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
|
8
|
+
path: styles/base.yml
|
9
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
|
10
|
+
path: styles/cc_base.yml
|
11
|
+
plugins:
|
12
|
+
rubocop:
|
13
|
+
enabled: true
|
14
|
+
config: ".rubocop_cc.yml"
|
15
|
+
channel: rubocop-0-82
|
16
|
+
version: '2'
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
manageiq-style: ".rubocop_base.yml"
|
1
3
|
inherit_from:
|
2
|
-
-
|
3
|
-
# put all local rubocop config into .rubocop_local.yml as it will be loaded by .rubocop_cc.yml as well
|
4
|
-
- .rubocop_local.yml
|
4
|
+
- ".rubocop_local.yml"
|
data/.rubocop_cc.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
language: ruby
|
2
|
-
sudo: false
|
3
2
|
cache: bundler
|
4
3
|
rvm:
|
5
|
-
- "2.
|
6
|
-
- "2.
|
7
|
-
- "2.4.2"
|
4
|
+
- "2.5.7"
|
5
|
+
- "2.6.5"
|
8
6
|
- ruby-head
|
9
7
|
- jruby-head
|
10
8
|
matrix:
|
@@ -12,4 +10,9 @@ matrix:
|
|
12
10
|
- rvm: ruby-head
|
13
11
|
- rvm: jruby-head
|
14
12
|
fast_finish: true
|
15
|
-
|
13
|
+
before_script:
|
14
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
15
|
+
- chmod +x ./cc-test-reporter
|
16
|
+
- ./cc-test-reporter before-build
|
17
|
+
after_script:
|
18
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGES
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
= 0.11.0 - 20-Apr-2021
|
2
|
+
* Modify the VirtualMachineService#get method to include instance view
|
3
|
+
information
|
4
|
+
* Update default ssl_version to TLSv1_2
|
5
|
+
* Fix tenants method
|
6
|
+
* Handle application/xml exception content-types
|
7
|
+
|
8
|
+
= 0.10.0 - 14-May-2020
|
9
|
+
* Updated the rest-client dependency to 2.1.0.
|
10
|
+
* Updated the azure-signature dependency to 0.3.0.
|
11
|
+
* Updated the MetricsService#list_metrics method to use the current API, which
|
12
|
+
had apparently undergone some serious revision since we first implemented it.
|
13
|
+
It now accepts a hash of options, though you may still pass a string for the
|
14
|
+
sake of backwards compatibility.
|
15
|
+
|
16
|
+
= 0.9.15 - 23-Jan-2020
|
17
|
+
* The VirtualMachineService#delete_associated_resources now supports deleting
|
18
|
+
attached data disks.
|
19
|
+
|
20
|
+
= 0.9.14 - 23-Oct-2019
|
21
|
+
* Added the VirtualMachineService#list_by_location method.
|
22
|
+
* The VirtualMachineService#vm_operations method now returns a response object
|
23
|
+
instead of nil.
|
24
|
+
* The results of the ResourceProviderService#supported? method are now cached.
|
25
|
+
* Fixed a bug in the VirtualMachineService#vm_operate method where it wasn't
|
26
|
+
setting the response code.
|
27
|
+
* Fixed a bug in the Armrest::Configuration#log= method where it would bomb if
|
28
|
+
you used an object that was neither a string nor a logger instance.
|
29
|
+
* Made the requirements for the memoist gem less pessimistic.
|
30
|
+
* Some spec updates and general refactoring.
|
31
|
+
|
1
32
|
= 0.9.13 - 12-Sep-2018
|
2
33
|
* Updated the USGov AD authority endpoint, which was changed by Microsoft recently.
|
3
34
|
* Added the timeout option for the Configuration class. This allows you to set
|
data/README.md
CHANGED
@@ -8,7 +8,6 @@ A Ruby interface for Azure using the new REST API.
|
|
8
8
|
[](https://travis-ci.org/ManageIQ/azure-armrest)
|
9
9
|
[](https://codeclimate.com/github/ManageIQ/azure-armrest)
|
10
10
|
[](https://codeclimate.com/github/ManageIQ/azure-armrest/coverage)
|
11
|
-
[](https://gemnasium.com/ManageIQ/azure-armrest)
|
12
11
|
[](https://hakiri.io/github/ManageIQ/azure-armrest/master)
|
13
12
|
|
14
13
|
## Synopsis
|
data/azure-armrest.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.email = ['dberger@redhat.com', 'bsorota@redhat.com', 'gblomqui@redhat.com', 'billwei@redhat.com']
|
9
9
|
spec.summary = 'An interface for ARM/JSON Azure REST API'
|
10
10
|
spec.homepage = 'http://github.com/ManageIQ/azure-armrest'
|
11
|
-
spec.license = 'Apache
|
11
|
+
spec.license = 'Apache-2.0'
|
12
12
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
13
13
|
|
14
14
|
spec.description = <<-EOF
|
@@ -17,18 +17,18 @@ different than the current azure gem, which uses the older (XML) interface
|
|
17
17
|
behind the scenes.
|
18
18
|
EOF
|
19
19
|
|
20
|
-
spec.add_dependency 'json', '~> 2'
|
21
|
-
spec.add_dependency 'rest-client', '~> 2.0.0'
|
22
|
-
spec.add_dependency 'memoist', '~> 0.15.0'
|
23
|
-
spec.add_dependency 'azure-signature', '~> 0.2.3'
|
24
20
|
spec.add_dependency 'activesupport', '>= 4.2.2'
|
25
21
|
spec.add_dependency 'addressable', '~> 2.5.0'
|
22
|
+
spec.add_dependency 'azure-signature', '~> 0.3.0'
|
23
|
+
spec.add_dependency 'json', '~> 2'
|
24
|
+
spec.add_dependency 'memoist', '~> 0.15'
|
26
25
|
spec.add_dependency 'parallel', '~> 1.12.0'
|
26
|
+
spec.add_dependency 'rest-client', '~> 2.1.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler'
|
29
|
+
spec.add_development_dependency 'manageiq-style'
|
29
30
|
spec.add_development_dependency 'rake'
|
30
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
32
|
spec.add_development_dependency 'simplecov'
|
32
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.0'
|
33
33
|
spec.add_development_dependency 'timecop', '~> 0.7'
|
34
34
|
end
|
data/lib/azure/armrest.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'active_support/core_ext/hash/conversions'
|
3
|
+
require 'active_support/core_ext/hash/keys'
|
3
4
|
require_relative 'model/base_model'
|
4
5
|
|
5
6
|
module Azure
|
@@ -154,7 +155,7 @@ module Azure
|
|
154
155
|
# Returns a list of tenants that can be accessed.
|
155
156
|
#
|
156
157
|
def tenants
|
157
|
-
url = url_with_api_version(configuration.api_version, configuration.resource_url, 'tenants')
|
158
|
+
url = url_with_api_version(configuration.api_version, configuration.environment.resource_url, 'tenants')
|
158
159
|
resp = rest_get(url)
|
159
160
|
JSON.parse(resp.body)['value'].map{ |hash| Azure::Armrest::Tenant.new(hash) }
|
160
161
|
end
|
@@ -253,11 +254,22 @@ module Azure
|
|
253
254
|
|
254
255
|
def raise_api_exception(err)
|
255
256
|
begin
|
256
|
-
|
257
|
-
|
258
|
-
|
257
|
+
content_type_header = err.response.headers[:content_type]
|
258
|
+
|
259
|
+
response = case content_type_header.match(%r{(application/\w+)})[1]
|
260
|
+
when "application/json"
|
261
|
+
JSON.parse(err.http_body)
|
262
|
+
when "application/xml"
|
263
|
+
# The XML document that is returned has Error, Code, and Message
|
264
|
+
# so we need to downcase the keys to stay consistent with the
|
265
|
+
# parsed-json hash.
|
266
|
+
Hash.from_xml(err.http_body).deep_transform_keys(&:downcase)
|
267
|
+
end
|
268
|
+
|
269
|
+
code = response['error']['code']
|
270
|
+
message = response['error']['message']
|
259
271
|
rescue
|
260
|
-
code
|
272
|
+
code = err.try(:http_code) || err.try(:code)
|
261
273
|
message = err.try(:http_body) || err.try(:message)
|
262
274
|
end
|
263
275
|
|
@@ -107,7 +107,7 @@ module Azure
|
|
107
107
|
:content_type => 'application/json',
|
108
108
|
:grant_type => 'client_credentials',
|
109
109
|
:proxy => ENV['http_proxy'],
|
110
|
-
:ssl_version => '
|
110
|
+
:ssl_version => 'TLSv1_2',
|
111
111
|
:timeout => 60,
|
112
112
|
:max_threads => 10,
|
113
113
|
:max_retries => 3,
|
@@ -211,8 +211,12 @@ module Azure
|
|
211
211
|
# a logger instance
|
212
212
|
#
|
213
213
|
def self.log=(output)
|
214
|
-
|
215
|
-
|
214
|
+
case output
|
215
|
+
when String
|
216
|
+
RestClient.log = Logger.new(output)
|
217
|
+
else
|
218
|
+
RestClient.log = output
|
219
|
+
end
|
216
220
|
end
|
217
221
|
|
218
222
|
# Returns a list of subscriptions for the current configuration object.
|
@@ -36,9 +36,21 @@ module Azure
|
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
-
# Returns a list metrics for +resource_id+, which can be
|
40
|
-
#
|
41
|
-
#
|
39
|
+
# Returns a list metrics for +resource_id+, which can be either a
|
40
|
+
# resource object or a plain resource string. You may also provide
|
41
|
+
# hash of filtering +options+ to limit the results. The possible
|
42
|
+
# options are:
|
43
|
+
#
|
44
|
+
# * :timespan => The timespan of the query in "start/end" format.
|
45
|
+
# * :interval => The interval (timegrain) of the query.
|
46
|
+
# * :metricnames => A comma separated list of metrics to retrieve.
|
47
|
+
# * :aggregation => A comma separated list of aggregration types to retrieve.
|
48
|
+
# * :segment => The name of the dimension to segment the metric values by.
|
49
|
+
# * :top => The maximum number of records to retrieve. Defaults to 10.
|
50
|
+
# * :orderby => The aggregation to use for sorting.
|
51
|
+
# * :filter => An expression used to filter the results.
|
52
|
+
# * :resultType => Reduces the set of data collected. Syntax is dependent on operation.
|
53
|
+
# * :metricnamespace => Metric namespace to query metric definitions for.
|
42
54
|
#
|
43
55
|
# If no filter expression is defined, the first metric defined
|
44
56
|
# for that resource will be returned using the primary aggregation
|
@@ -49,13 +61,18 @@ module Azure
|
|
49
61
|
#
|
50
62
|
# vm = vms.get('your_vm', 'your_resource_group')
|
51
63
|
#
|
52
|
-
#
|
53
|
-
#
|
64
|
+
# options = {
|
65
|
+
# :metricnames => "'Percentage CPU'"
|
66
|
+
# :timespan => "2020-02-13T02:20:00Z/2020-02-14T04:20:00Z"
|
67
|
+
# :aggregation => "Average",
|
68
|
+
# :interval => "PT1M"
|
69
|
+
# }
|
54
70
|
#
|
55
|
-
# definitions = mts.list_metrics(vm.id)
|
71
|
+
# definitions = mts.list_metrics(vm.id, options)
|
56
72
|
#
|
57
|
-
def list_metrics(resource,
|
73
|
+
def list_metrics(resource, options = {})
|
58
74
|
resource_id = resource.respond_to?(:id) ? resource.id : resource
|
75
|
+
options[:filter] = options if options.is_a?(String) # For backwards compatibility
|
59
76
|
|
60
77
|
url = File.join(
|
61
78
|
configuration.environment.resource_url,
|
@@ -64,7 +81,12 @@ module Azure
|
|
64
81
|
)
|
65
82
|
|
66
83
|
url << "?api-version=#{api_version}"
|
67
|
-
|
84
|
+
|
85
|
+
# The :filter option requires a leading '$'
|
86
|
+
options.each do |key, value|
|
87
|
+
key.to_s == 'filter' ? url << "&$" : url << "&"
|
88
|
+
url << "#{key}=#{value}"
|
89
|
+
end
|
68
90
|
|
69
91
|
response = rest_get(url)
|
70
92
|
|
@@ -288,7 +288,7 @@ module Azure
|
|
288
288
|
url = File.join(properties.primary_endpoints.file, share, file)
|
289
289
|
url += "?timeout=#{timeout}" if timeout
|
290
290
|
|
291
|
-
hash = options.transform_keys
|
291
|
+
hash = options.transform_keys { |okey| 'x-ms-' + okey.to_s.tr('_', '-') }
|
292
292
|
|
293
293
|
hash['verb'] = 'PUT'
|
294
294
|
|
@@ -380,7 +380,7 @@ module Azure
|
|
380
380
|
url = File.join(properties.primary_endpoints.file, share, file) + "?comp=range"
|
381
381
|
url += "&timeout=#{timeout}" if timeout
|
382
382
|
|
383
|
-
hash = options.transform_keys
|
383
|
+
hash = options.transform_keys { |okey| 'x-ms-' + okey.to_s.tr('_', '-') }
|
384
384
|
|
385
385
|
hash['verb'] = 'PUT'
|
386
386
|
hash['x-ms-write'] ||= 'update'
|
@@ -232,7 +232,7 @@ module Azure
|
|
232
232
|
api_version = configuration.provider_default_api_version(provider_name, full_service_name)
|
233
233
|
end
|
234
234
|
api_version ||= configuration.provider_default_api_version(provider_name, service_name)
|
235
|
-
api_version
|
235
|
+
api_version || configuration.api_version
|
236
236
|
end
|
237
237
|
|
238
238
|
def delete_by_url(url, resource_name = '')
|
@@ -260,7 +260,7 @@ module Azure
|
|
260
260
|
# arguments provided, and appends it with the api_version.
|
261
261
|
#
|
262
262
|
def build_url(resource_group = nil, *args)
|
263
|
-
|
263
|
+
File.join(configuration.environment.resource_url, build_id_string(resource_group, *args))
|
264
264
|
end
|
265
265
|
|
266
266
|
def build_id_string(resource_group = nil, *args)
|
@@ -279,6 +279,8 @@ module Azure
|
|
279
279
|
query << "&$top=#{value}"
|
280
280
|
elsif key.casecmp('filter').zero?
|
281
281
|
query << "&$filter=#{value}" # Allow raw filter
|
282
|
+
elsif key.casecmp('expand').zero?
|
283
|
+
query << "&$expand=#{value}"
|
282
284
|
else
|
283
285
|
if query.include?("$filter")
|
284
286
|
query << " and #{key} eq '#{value}'"
|
@@ -131,14 +131,17 @@ module Azure
|
|
131
131
|
# given +namespace+. By default it will search the Microsoft.Compute
|
132
132
|
# namespace.
|
133
133
|
#
|
134
|
+
# The results of this method are cached.
|
135
|
+
#
|
134
136
|
def supported?(resource_type, namespace = 'Microsoft.Compute')
|
135
137
|
get(namespace).resource_types.map(&:resource_type).map(&:downcase).include?(resource_type.downcase)
|
136
138
|
end
|
137
139
|
|
140
|
+
memoize :supported?
|
141
|
+
|
138
142
|
private
|
139
143
|
|
140
144
|
def build_url(namespace = nil, *args)
|
141
|
-
id = configuration.subscription_id
|
142
145
|
url = File.join(base_url, 'providers')
|
143
146
|
url = File.join(url, namespace) if namespace
|
144
147
|
url = File.join(url, *args) unless args.empty?
|
@@ -86,7 +86,7 @@ module Azure::Armrest::Storage::ManagedStorageHelper
|
|
86
86
|
rescue Azure::Armrest::ForbiddenException => err
|
87
87
|
log('warn', "ManagedStorageHelper.read: #{err}")
|
88
88
|
raise err
|
89
|
-
rescue RestClient::Exception, Azure::Armrest::
|
89
|
+
rescue RestClient::Exception, Azure::Armrest::Exception => err
|
90
90
|
raise err unless retries < max_retries
|
91
91
|
log('warn', "ManagedStorageHelper.read: #{err} - retry number #{retries}")
|
92
92
|
retries += 1
|
@@ -16,6 +16,14 @@ module Azure
|
|
16
16
|
super(configuration, 'virtualMachines', 'Microsoft.Compute', options)
|
17
17
|
end
|
18
18
|
|
19
|
+
# Return a list of virtual machines for the given +location+.
|
20
|
+
#
|
21
|
+
def list_by_location(location, options = {})
|
22
|
+
url = url_with_api_version(api_version, base_url, 'providers', provider, 'locations', location, service_name)
|
23
|
+
response = rest_get(url)
|
24
|
+
get_all_results(response, options[:skip_accessors_definition])
|
25
|
+
end
|
26
|
+
|
19
27
|
# Return a list of available VM series (aka sizes, flavors, etc), such
|
20
28
|
# as "Basic_A1", though other information is included as well.
|
21
29
|
#
|
@@ -63,23 +71,48 @@ module Azure
|
|
63
71
|
# Retrieves the settings of the VM named +vmname+ in resource group
|
64
72
|
# +group+, which will default to the same as the name of the VM.
|
65
73
|
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
74
|
+
# You can also specify any query options. At this time only the
|
75
|
+
# :expand => 'instanceView' option is supported, but others could
|
76
|
+
# be added over time.
|
77
|
+
#
|
78
|
+
# For backwards compatibility, the third argument may also be a boolean
|
79
|
+
# which will retrieve the model view by default. Set to false if you only
|
80
|
+
# want the instance view.
|
81
|
+
#
|
82
|
+
# Examples:
|
69
83
|
#
|
70
|
-
|
71
|
-
|
84
|
+
# vms = VirtualMachineService.new(credentials)
|
85
|
+
#
|
86
|
+
# # Standard call, get just the model view
|
87
|
+
# vms.get('some_name', 'some_group')
|
88
|
+
# vms.get('some_name', 'some_group', true) # same
|
89
|
+
#
|
90
|
+
# # Get the instance view only
|
91
|
+
# vms.get('some_name', 'some_group', false)
|
92
|
+
#
|
93
|
+
# # Get the instance view merged with the model view
|
94
|
+
# vms.get('some_name', 'some_group', :expand => 'instanceView')
|
95
|
+
#
|
96
|
+
def get(vmname, group = configuration.resource_group, options = {})
|
97
|
+
if options.kind_of?(Hash)
|
98
|
+
url = build_url(group, vmname, options)
|
99
|
+
response = rest_get(url)
|
100
|
+
VirtualMachineInstance.new(response)
|
101
|
+
else
|
102
|
+
options ? super(vmname, group) : get_instance_view(vmname, group)
|
103
|
+
end
|
72
104
|
end
|
73
105
|
|
74
106
|
# Convenient wrapper around the get method that retrieves the model view
|
75
|
-
# for +vmname+ in resource_group +group
|
107
|
+
# for +vmname+ in resource_group +group+ without the instance view
|
108
|
+
# information.
|
76
109
|
#
|
77
110
|
def get_model_view(vmname, group = configuration.resource_group)
|
78
|
-
get(vmname, group
|
111
|
+
get(vmname, group)
|
79
112
|
end
|
80
113
|
|
81
|
-
# Convenient wrapper around the get method that retrieves the
|
82
|
-
# for +vmname+ in resource_group +group+.
|
114
|
+
# Convenient wrapper around the get method that retrieves only the
|
115
|
+
# instance view for +vmname+ in resource_group +group+.
|
83
116
|
#
|
84
117
|
def get_instance_view(vmname, group = configuration.resource_group)
|
85
118
|
raise ArgumentError, "must specify resource group" unless group
|
@@ -144,6 +177,7 @@ module Azure
|
|
144
177
|
:network_interfaces => true,
|
145
178
|
:ip_addresses => true,
|
146
179
|
:os_disk => true,
|
180
|
+
:data_disks => false,
|
147
181
|
:network_security_groups => false,
|
148
182
|
:storage_account => false,
|
149
183
|
:verbose => false
|
@@ -164,6 +198,10 @@ module Azure
|
|
164
198
|
if options[:os_disk] || options[:storage_account]
|
165
199
|
delete_associated_disk(vm, options)
|
166
200
|
end
|
201
|
+
|
202
|
+
if options[:data_disks]
|
203
|
+
delete_associated_data_disks(vm, options)
|
204
|
+
end
|
167
205
|
end
|
168
206
|
|
169
207
|
def model_class
|
@@ -227,6 +265,20 @@ module Azure
|
|
227
265
|
end
|
228
266
|
end
|
229
267
|
|
268
|
+
# This deletes any attached data disks that are associated with the
|
269
|
+
# virtual machine. Note that this should only happen after the VM
|
270
|
+
# has been deleted.
|
271
|
+
#
|
272
|
+
def delete_associated_data_disks(vm, options)
|
273
|
+
sds = Azure::Armrest::Storage::DiskService.new(configuration)
|
274
|
+
data_disks = vm.properties.storage_profile.try(:data_disks)
|
275
|
+
|
276
|
+
data_disks&.each do |data_disk|
|
277
|
+
disk = sds.get_by_id(data_disk.managed_disk.id)
|
278
|
+
delete_and_wait(sds, disk.name, disk.resource_group, options)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
230
282
|
def delete_managed_storage(vm, options)
|
231
283
|
sds = Azure::Armrest::Storage::DiskService.new(configuration)
|
232
284
|
disk = sds.get_by_id(vm.properties.storage_profile.os_disk.managed_disk.id)
|
@@ -306,8 +358,11 @@ module Azure
|
|
306
358
|
raise ArgumentError, "must specify name of the vm" unless vmname
|
307
359
|
|
308
360
|
url = build_url(group, vmname, action)
|
309
|
-
rest_post(url)
|
310
|
-
|
361
|
+
response = rest_post(url, options.to_json)
|
362
|
+
|
363
|
+
Azure::Armrest::ResponseHeaders.new(response.headers).tap do |headers|
|
364
|
+
headers.response_code = response.code
|
365
|
+
end
|
311
366
|
end
|
312
367
|
end
|
313
368
|
end
|
metadata
CHANGED
@@ -1,116 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-armrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
- Bronagh Sorota
|
9
9
|
- Greg Blomquist
|
10
10
|
- Bill Wei
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: activesupport
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 4.2.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.2.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: addressable
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 2.
|
36
|
+
version: 2.5.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.5.0
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
45
|
+
name: azure-signature
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 0.
|
50
|
+
version: 0.3.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 0.
|
57
|
+
version: 0.3.0
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
59
|
+
name: json
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: '2'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: '2'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
73
|
+
name: memoist
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: '0.15'
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - "
|
83
|
+
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '0.15'
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
87
|
+
name: parallel
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 1.12.0
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 1.12.0
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
|
-
name:
|
101
|
+
name: rest-client
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.
|
106
|
+
version: 2.1.0
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: 1.
|
113
|
+
version: 2.1.0
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: bundler
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +125,20 @@ dependencies:
|
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: manageiq-style
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
128
142
|
- !ruby/object:Gem::Dependency
|
129
143
|
name: rake
|
130
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,20 +181,6 @@ dependencies:
|
|
167
181
|
- - ">="
|
168
182
|
- !ruby/object:Gem::Version
|
169
183
|
version: '0'
|
170
|
-
- !ruby/object:Gem::Dependency
|
171
|
-
name: codeclimate-test-reporter
|
172
|
-
requirement: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 1.0.0
|
177
|
-
type: :development
|
178
|
-
prerelease: false
|
179
|
-
version_requirements: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - "~>"
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: 1.0.0
|
184
184
|
- !ruby/object:Gem::Dependency
|
185
185
|
name: timecop
|
186
186
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,9 +208,11 @@ executables: []
|
|
208
208
|
extensions: []
|
209
209
|
extra_rdoc_files: []
|
210
210
|
files:
|
211
|
+
- ".codeclimate.yml"
|
211
212
|
- ".gitignore"
|
212
213
|
- ".rspec"
|
213
214
|
- ".rubocop.yml"
|
215
|
+
- ".rubocop_cc.yml"
|
214
216
|
- ".rubocop_local.yml"
|
215
217
|
- ".travis.yml"
|
216
218
|
- CHANGES
|
@@ -273,9 +275,9 @@ files:
|
|
273
275
|
- lib/azure/armrest/virtual_machine_service.rb
|
274
276
|
homepage: http://github.com/ManageIQ/azure-armrest
|
275
277
|
licenses:
|
276
|
-
- Apache
|
278
|
+
- Apache-2.0
|
277
279
|
metadata: {}
|
278
|
-
post_install_message:
|
280
|
+
post_install_message:
|
279
281
|
rdoc_options: []
|
280
282
|
require_paths:
|
281
283
|
- lib
|
@@ -290,9 +292,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
292
|
- !ruby/object:Gem::Version
|
291
293
|
version: '0'
|
292
294
|
requirements: []
|
293
|
-
|
294
|
-
|
295
|
-
signing_key:
|
295
|
+
rubygems_version: 3.2.5
|
296
|
+
signing_key:
|
296
297
|
specification_version: 4
|
297
298
|
summary: An interface for ARM/JSON Azure REST API
|
298
299
|
test_files: []
|