azure-armrest 0.9.12 → 0.9.13
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/.rubocop_local.yml +4 -4
- data/CHANGES +9 -0
- data/lib/azure/armrest/armrest_service.rb +1 -0
- data/lib/azure/armrest/configuration.rb +5 -0
- data/lib/azure/armrest/environment.rb +1 -1
- data/lib/azure/armrest/key_vault_service.rb +19 -0
- data/lib/azure/armrest/model/storage_account.rb +26 -13
- data/lib/azure/armrest/version.rb +1 -1
- data/lib/azure/armrest/virtual_machine_image_service.rb +34 -16
- 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: 6dcd07e3c1fc8044f9b374e414b9f73951882b44d6f829c5c1b576aa2bebe01c
|
4
|
+
data.tar.gz: c35fe136a9f7e52f5f913ad5218f6958dbaf468e6021ab90cbfc3446b8d4b5a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5158479f2c1247d7ac00014034c09009f886f386b2e7864846246148e449919ffe672b223f1d2a31f77113a3ab71665e0e41da6c4f57055a4ecc42bb88a12a6e
|
7
|
+
data.tar.gz: 394a269426ccf9664b0c3da1d1838a46df032d152a629dee80e9d7c890d251047daa10740180e388a1fb0be98339b0e6dcc1541382111fc3e1ae73b95e5e7049
|
data/.rubocop_local.yml
CHANGED
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
= 0.9.13 - 12-Sep-2018
|
2
|
+
* Updated the USGov AD authority endpoint, which was changed by Microsoft recently.
|
3
|
+
* Added the timeout option for the Configuration class. This allows you to set
|
4
|
+
the timeout value for all http requests. The default is 60 seconds.
|
5
|
+
* Added the get_secret and list_secrets methods to the KeyVaultService class.
|
6
|
+
* Added the get method to the VirtualMachineImageService class, plus some
|
7
|
+
internal refactoring
|
8
|
+
* Some internal updates for rubocop.
|
9
|
+
|
1
10
|
= 0.9.12 - 12-Jul-2018
|
2
11
|
* Fixed and updated the ResourceProviderService#list_api_versions method. The
|
3
12
|
previous version was broken and would probably return invalid informtion.
|
@@ -288,6 +288,7 @@ module Azure
|
|
288
288
|
:proxy => configuration.proxy,
|
289
289
|
:ssl_version => configuration.ssl_version,
|
290
290
|
:ssl_verify => configuration.ssl_verify,
|
291
|
+
:timeout => configuration.timeout,
|
291
292
|
:headers => {
|
292
293
|
:accept => configuration.accept,
|
293
294
|
:content_type => configuration.content_type,
|
@@ -59,6 +59,9 @@ module Azure
|
|
59
59
|
# SSL verify mode for all http requests.
|
60
60
|
attr_accessor :ssl_verify
|
61
61
|
|
62
|
+
# Timeout value for http requests in seconds. The default is 60.
|
63
|
+
attr_accessor :timeout
|
64
|
+
|
62
65
|
# Namespace providers, their resource types, locations and supported api-version strings.
|
63
66
|
attr_reader :providers
|
64
67
|
|
@@ -105,6 +108,7 @@ module Azure
|
|
105
108
|
:grant_type => 'client_credentials',
|
106
109
|
:proxy => ENV['http_proxy'],
|
107
110
|
:ssl_version => 'TLSv1',
|
111
|
+
:timeout => 60,
|
108
112
|
:max_threads => 10,
|
109
113
|
:max_retries => 3,
|
110
114
|
:environment => Azure::Armrest::Environment::Public
|
@@ -295,6 +299,7 @@ module Azure
|
|
295
299
|
:proxy => proxy,
|
296
300
|
:ssl_version => ssl_version,
|
297
301
|
:ssl_verify => ssl_verify,
|
302
|
+
:timeout => timeout,
|
298
303
|
:payload => {
|
299
304
|
:grant_type => grant_type,
|
300
305
|
:client_id => client_id,
|
@@ -139,7 +139,7 @@ module Azure
|
|
139
139
|
|
140
140
|
USGovernment = new(
|
141
141
|
:name => 'US Government',
|
142
|
-
:active_directory_authority => 'https://login
|
142
|
+
:active_directory_authority => 'https://login.microsoftonline.us/',
|
143
143
|
:active_directory_resource_id => 'https://management.core.usgovcloudapi.net/',
|
144
144
|
:gallery_url => 'https://gallery.usgovcloudapi.net/',
|
145
145
|
:graph_url => 'https://graph.windows.net/',
|
@@ -10,6 +10,25 @@ module Azure
|
|
10
10
|
super(configuration, 'vaults', 'Microsoft.KeyVault', options)
|
11
11
|
end
|
12
12
|
|
13
|
+
# Get information for the specified +secret_name+ in +vault_name+ within
|
14
|
+
# the given +resource_group+.
|
15
|
+
#
|
16
|
+
def get_secret(secret_name, vault_name, resource_group = configuration.resource_group)
|
17
|
+
url = build_url(resource_group, vault_name, 'secrets', secret_name)
|
18
|
+
model_class.new(rest_get(url))
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get a list secrets for the given +vault_name+ within +resource_group+.
|
22
|
+
# You may optionally specify the +maxresults+, which defaults to 25.
|
23
|
+
#
|
24
|
+
def list_secrets(vault_name, resource_group = configuration.resource_group, options = {})
|
25
|
+
url = build_url(resource_group, vault_name, 'secrets')
|
26
|
+
url << "&maxresults=#{options[:maxresults]}" if options[:maxresults]
|
27
|
+
|
28
|
+
response = rest_get(url)
|
29
|
+
get_all_results(response)
|
30
|
+
end
|
31
|
+
|
13
32
|
# Gets the deleted Azure key vault.
|
14
33
|
#
|
15
34
|
def get_deleted(vault_name, location)
|
@@ -306,7 +306,8 @@ module Azure
|
|
306
306
|
:headers => headers,
|
307
307
|
:proxy => configuration.proxy,
|
308
308
|
:ssl_version => configuration.ssl_version,
|
309
|
-
:ssl_verify => configuration.ssl_verify
|
309
|
+
:ssl_verify => configuration.ssl_verify,
|
310
|
+
:timeout => configuration.timeout
|
310
311
|
)
|
311
312
|
|
312
313
|
Azure::Armrest::ResponseHeaders.new(response.headers).tap do |rh|
|
@@ -351,7 +352,8 @@ module Azure
|
|
351
352
|
:headers => headers,
|
352
353
|
:proxy => configuration.proxy,
|
353
354
|
:ssl_version => configuration.ssl_version,
|
354
|
-
:ssl_verify => configuration.ssl_verify
|
355
|
+
:ssl_verify => configuration.ssl_verify,
|
356
|
+
:timeout => configuration.timeout
|
355
357
|
)
|
356
358
|
|
357
359
|
Azure::Armrest::ResponseHeaders.new(response.headers).tap do |rh|
|
@@ -401,7 +403,8 @@ module Azure
|
|
401
403
|
:headers => headers,
|
402
404
|
:proxy => configuration.proxy,
|
403
405
|
:ssl_version => configuration.ssl_version,
|
404
|
-
:ssl_verify => configuration.ssl_verify
|
406
|
+
:ssl_verify => configuration.ssl_verify,
|
407
|
+
:timeout => configuration.timeout
|
405
408
|
)
|
406
409
|
|
407
410
|
Azure::Armrest::ResponseHeaders.new(response.headers).tap do |rh|
|
@@ -516,7 +519,8 @@ module Azure
|
|
516
519
|
:headers => headers,
|
517
520
|
:proxy => configuration.proxy,
|
518
521
|
:ssl_version => configuration.ssl_version,
|
519
|
-
:ssl_verify => configuration.ssl_verify
|
522
|
+
:ssl_verify => configuration.ssl_verify,
|
523
|
+
:timeout => configuration.timeout
|
520
524
|
)
|
521
525
|
|
522
526
|
BlobProperty.new(response.headers.merge(:container => container, :name => blob), options[:skip_accessors_definition])
|
@@ -555,7 +559,8 @@ module Azure
|
|
555
559
|
:headers => headers,
|
556
560
|
:proxy => configuration.proxy,
|
557
561
|
:ssl_version => configuration.ssl_version,
|
558
|
-
:ssl_verify => configuration.ssl_verify
|
562
|
+
:ssl_verify => configuration.ssl_verify,
|
563
|
+
:timeout => configuration.timeout
|
559
564
|
)
|
560
565
|
|
561
566
|
BlobProperty.new(response.headers.merge(:container => container, :name => blob))
|
@@ -717,7 +722,8 @@ module Azure
|
|
717
722
|
:headers => headers,
|
718
723
|
:proxy => configuration.proxy,
|
719
724
|
:ssl_version => configuration.ssl_version,
|
720
|
-
:ssl_verify => configuration.ssl_verify
|
725
|
+
:ssl_verify => configuration.ssl_verify,
|
726
|
+
:timeout => configuration.timeout
|
721
727
|
)
|
722
728
|
|
723
729
|
blob = blob_properties(dst_container, dst_blob, key)
|
@@ -744,7 +750,8 @@ module Azure
|
|
744
750
|
:headers => headers,
|
745
751
|
:proxy => configuration.proxy,
|
746
752
|
:ssl_version => configuration.ssl_version,
|
747
|
-
:ssl_verify => configuration.ssl_verify
|
753
|
+
:ssl_verify => configuration.ssl_verify,
|
754
|
+
:timeout => configuration.timeout
|
748
755
|
)
|
749
756
|
|
750
757
|
headers = Azure::Armrest::ResponseHeaders.new(response.headers)
|
@@ -819,7 +826,8 @@ module Azure
|
|
819
826
|
:headers => headers,
|
820
827
|
:proxy => configuration.proxy,
|
821
828
|
:ssl_version => configuration.ssl_version,
|
822
|
-
:ssl_verify => configuration.ssl_verify
|
829
|
+
:ssl_verify => configuration.ssl_verify,
|
830
|
+
:timeout => configuration.timeout
|
823
831
|
)
|
824
832
|
|
825
833
|
resp_headers = Azure::Armrest::ResponseHeaders.new(response.headers)
|
@@ -870,7 +878,8 @@ module Azure
|
|
870
878
|
:headers => headers,
|
871
879
|
:proxy => configuration.proxy,
|
872
880
|
:ssl_version => configuration.ssl_version,
|
873
|
-
:ssl_verify => configuration.ssl_verify
|
881
|
+
:ssl_verify => configuration.ssl_verify,
|
882
|
+
:timeout => configuration.timeout
|
874
883
|
)
|
875
884
|
|
876
885
|
headers = Azure::Armrest::ResponseHeaders.new(response.headers)
|
@@ -946,7 +955,8 @@ module Azure
|
|
946
955
|
:headers => headers,
|
947
956
|
:proxy => configuration.proxy,
|
948
957
|
:ssl_version => configuration.ssl_version,
|
949
|
-
:ssl_verify => configuration.ssl_verify
|
958
|
+
:ssl_verify => configuration.ssl_verify,
|
959
|
+
:timeout => configuration.timeout
|
950
960
|
)
|
951
961
|
end
|
952
962
|
|
@@ -1001,7 +1011,8 @@ module Azure
|
|
1001
1011
|
:headers => headers,
|
1002
1012
|
:proxy => configuration.proxy,
|
1003
1013
|
:ssl_version => configuration.ssl_version,
|
1004
|
-
:ssl_verify => configuration.ssl_verify
|
1014
|
+
:ssl_verify => configuration.ssl_verify,
|
1015
|
+
:timeout => configuration.timeout
|
1005
1016
|
)
|
1006
1017
|
end
|
1007
1018
|
|
@@ -1020,7 +1031,8 @@ module Azure
|
|
1020
1031
|
:headers => headers,
|
1021
1032
|
:proxy => configuration.proxy,
|
1022
1033
|
:ssl_version => configuration.ssl_version,
|
1023
|
-
:ssl_verify => configuration.ssl_verify
|
1034
|
+
:ssl_verify => configuration.ssl_verify,
|
1035
|
+
:timeout => configuration.timeout
|
1024
1036
|
}
|
1025
1037
|
|
1026
1038
|
if %w[put post].include?(request_type.to_s.downcase)
|
@@ -1049,7 +1061,8 @@ module Azure
|
|
1049
1061
|
:headers => headers,
|
1050
1062
|
:proxy => configuration.proxy,
|
1051
1063
|
:ssl_version => configuration.ssl_version,
|
1052
|
-
:ssl_verify => configuration.ssl_verify
|
1064
|
+
:ssl_verify => configuration.ssl_verify,
|
1065
|
+
:timeout => configuration.timeout
|
1053
1066
|
)
|
1054
1067
|
end
|
1055
1068
|
|
@@ -22,6 +22,21 @@ module Azure
|
|
22
22
|
@publisher = options[:publisher]
|
23
23
|
end
|
24
24
|
|
25
|
+
# Return information about a specific offer/sku/version for the given
|
26
|
+
# +publisher+ within +location+.
|
27
|
+
#
|
28
|
+
def get(offer, sku, version, location = @location, publisher = @publisher)
|
29
|
+
check_for_location_and_publisher(location, publisher)
|
30
|
+
|
31
|
+
url = build_url(
|
32
|
+
location, 'publishers', publisher, 'artifacttypes',
|
33
|
+
'vmimage', 'offers', offer, 'skus', sku, 'versions', version
|
34
|
+
)
|
35
|
+
|
36
|
+
response = rest_get(url)
|
37
|
+
Azure::Armrest::VirtualMachineImage.new(response)
|
38
|
+
end
|
39
|
+
|
25
40
|
# Return a list of all VM image offers from the given +location+.
|
26
41
|
#
|
27
42
|
# Example:
|
@@ -33,11 +48,12 @@ module Azure
|
|
33
48
|
|
34
49
|
mutex = Mutex.new
|
35
50
|
images = []
|
51
|
+
max = configuration.max_threads
|
36
52
|
|
37
|
-
Parallel.each(publishers(location), :in_threads =>
|
38
|
-
Parallel.each(offers(location, publisher.name), :in_threads =>
|
39
|
-
Parallel.each(skus(offer.name, location, publisher.name), :in_threads =>
|
40
|
-
Parallel.each(versions(sku.name, offer.name, location, publisher.name), :in_threads =>
|
53
|
+
Parallel.each(publishers(location), :in_threads => max) do |publisher|
|
54
|
+
Parallel.each(offers(location, publisher.name), :in_threads => max) do |offer|
|
55
|
+
Parallel.each(skus(offer.name, location, publisher.name), :in_threads => max) do |sku|
|
56
|
+
Parallel.each(versions(sku.name, offer.name, location, publisher.name), :in_threads => max) do |version|
|
41
57
|
mutex.synchronize do
|
42
58
|
images << Azure::Armrest::VirtualMachineImage.new(
|
43
59
|
:location => version.location,
|
@@ -63,8 +79,7 @@ module Azure
|
|
63
79
|
# vmis.offers('eastus', 'Canonical')
|
64
80
|
#
|
65
81
|
def offers(location = @location, publisher = @publisher)
|
66
|
-
|
67
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
82
|
+
check_for_location_and_publisher(location, publisher)
|
68
83
|
|
69
84
|
url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers')
|
70
85
|
|
@@ -93,8 +108,7 @@ module Azure
|
|
93
108
|
# vmis.skus('UbuntuServer', 'eastus', 'Canonical')
|
94
109
|
#
|
95
110
|
def skus(offer, location = @location, publisher = @publisher)
|
96
|
-
|
97
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
111
|
+
check_for_location_and_publisher(location, publisher)
|
98
112
|
|
99
113
|
url = build_url(
|
100
114
|
location, 'publishers', publisher, 'artifacttypes',
|
@@ -115,8 +129,7 @@ module Azure
|
|
115
129
|
# => ["15.10.201511111", "15.10.201511161", "15.10.201512030"]
|
116
130
|
#
|
117
131
|
def versions(sku, offer, location = @location, publisher = @publisher)
|
118
|
-
|
119
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
132
|
+
check_for_location_and_publisher(location, publisher)
|
120
133
|
|
121
134
|
url = build_url(
|
122
135
|
location, 'publishers', publisher, 'artifacttypes',
|
@@ -133,8 +146,7 @@ module Azure
|
|
133
146
|
# vmis.extension('LinuxDiagnostic', '2.3.9029', 'westus2', 'Microsoft.OSTCExtensions')
|
134
147
|
#
|
135
148
|
def extension(type, version, location = @location, publisher = @publisher)
|
136
|
-
|
137
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
149
|
+
check_for_location_and_publisher(location, publisher)
|
138
150
|
|
139
151
|
url = build_url(
|
140
152
|
location, 'publishers', publisher, 'artifacttypes',
|
@@ -152,8 +164,7 @@ module Azure
|
|
152
164
|
# vmis.extension_types('westus', 'Microsoft.OSTCExtensions')
|
153
165
|
#
|
154
166
|
def extension_types(location = @location, publisher = @publisher)
|
155
|
-
|
156
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
167
|
+
check_for_location_and_publisher(location, publisher)
|
157
168
|
|
158
169
|
url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmextension', 'types')
|
159
170
|
|
@@ -169,8 +180,7 @@ module Azure
|
|
169
180
|
# vmis.extension_type_versions('LinuxDiagnostic', 'eastus', 'Microsoft.OSTCExtensions')
|
170
181
|
#
|
171
182
|
def extension_type_versions(type, location = @location, publisher = @publisher)
|
172
|
-
|
173
|
-
raise ArgumentError, "No publisher specified" unless publisher
|
183
|
+
check_for_location_and_publisher(location, publisher)
|
174
184
|
|
175
185
|
url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmextension', 'types', type, 'versions')
|
176
186
|
|
@@ -180,6 +190,14 @@ module Azure
|
|
180
190
|
|
181
191
|
private
|
182
192
|
|
193
|
+
# Raise an error if either the +location+ or +publisher+ are nil. Used
|
194
|
+
# by other methods to handle explicit nils.
|
195
|
+
#
|
196
|
+
def check_for_location_and_publisher(location, publisher)
|
197
|
+
raise ArgumentError, "No location specified" unless location
|
198
|
+
raise ArgumentError, "No publisher specified" unless publisher
|
199
|
+
end
|
200
|
+
|
183
201
|
# Builds a URL based on subscription_id an resource_group and any other
|
184
202
|
# arguments provided, and appends it with the api_version.
|
185
203
|
#
|
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.13
|
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-09-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|