azure-armrest 0.7.4 → 0.7.5

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
  SHA1:
3
- metadata.gz: 7d9a379dcf879754655b90dd12e7d23a83d6d2b4
4
- data.tar.gz: 8fd56da390cae4df7264a8c28508641df46168e0
3
+ metadata.gz: 5eafec5e5c9b51f1e01cd36f55872192579cf838
4
+ data.tar.gz: 80dfaca5f2bec22dcdea5567295248e3a12b254f
5
5
  SHA512:
6
- metadata.gz: 40bd7ac94d641b8b3d618be616dc09c440e98abd56741ee6983f36c04b802acddcffa00eba196df684e1daa90040372266bc0f1b2641f9d8a44ee51d96026848
7
- data.tar.gz: 34d2d1e7708543084de37152c4cdf9a0bf5ce348e722bd87160f3f722404ebc4660e10cd6ff2dd9f73eb612da8d9c40dbc53c5acbeb4059ddfb4c2615518cacc
6
+ metadata.gz: 1f4dcb334ccb37db304d216ffeae044944724f1b517e317a1ea3d4393840203af5b665640806e07f8a5564fa723d66a0c4b3eb7bb802d66de1b6a85d2f0cefa8
7
+ data.tar.gz: d0d956239b40e8ca6e59cecfa47650c1334c3b79dae481bef71d8a0485d9e14ada0cce04dba882ad045ef9acc3ddbbc9e8e10d6f52d3b04bb9f6dd721431592d
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ = 0.7.5 - 27-Jun-2017
2
+ * Added the ContainerService service class.
3
+ * Added the StorageAccount#access_key accessor. If set, this is now used as
4
+ the default since "properties.key1" is no longer supported by Azure.
5
+ * Added predefined Environment's for China and Germany.
6
+ * The nokogiri dependency was updated to 1.7.2.
7
+
1
8
  = 0.7.4 - 9-Jun-2017
2
9
  * Added the BaseModel#subscription_id method.
3
10
  * Improved the underlying regex for BaseModel#resource_group.
@@ -24,7 +24,7 @@ behind the scenes.
24
24
  spec.add_dependency 'memoist', '~> 0.15.0'
25
25
  spec.add_dependency 'azure-signature', '~> 0.2.3'
26
26
  spec.add_dependency 'activesupport', '>= 4.2.2'
27
- spec.add_dependency 'nokogiri', '~> 1.7.1'
27
+ spec.add_dependency 'nokogiri', '~> 1.7.2'
28
28
  spec.add_dependency 'addressable', '~> 2.4.0'
29
29
  spec.add_dependency 'parallel', '~> 1.9.0'
30
30
 
@@ -14,6 +14,7 @@ module Azure
14
14
  end
15
15
  end
16
16
 
17
+ # Load these first
17
18
  require 'azure/armrest/version'
18
19
  require 'azure/armrest/configuration'
19
20
  require 'azure/armrest/environment'
@@ -23,8 +24,11 @@ require 'azure/armrest/armrest_service'
23
24
  require 'azure/armrest/subscription_service'
24
25
  require 'azure/armrest/resource_group_based_service'
25
26
  require 'azure/armrest/resource_group_based_subservice'
26
- require 'azure/armrest/storage_account_service'
27
+
28
+ # Then these
27
29
  require 'azure/armrest/availability_set_service'
30
+ require 'azure/armrest/container_service'
31
+ require 'azure/armrest/storage_account_service'
28
32
  require 'azure/armrest/storage/disk_service'
29
33
  require 'azure/armrest/storage/snapshot_service'
30
34
  require 'azure/armrest/storage/image_service'
@@ -0,0 +1,12 @@
1
+ # Azure namespace
2
+ module Azure
3
+ # Armrest namespace
4
+ module Armrest
5
+ # Base class for managing containers.
6
+ class ContainerService < ResourceGroupBasedService
7
+ def initialize(configuration, options = {})
8
+ super(configuration, 'containerServices', 'Microsoft.ContainerService', options)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -86,7 +86,7 @@ module Azure
86
86
 
87
87
  # Pre-generated environments
88
88
 
89
- Public = self.new(
89
+ Public = new(
90
90
  :name => 'Public',
91
91
  :active_directory_authority => 'https://login.microsoftonline.com/',
92
92
  :active_directory_resource_id => 'https://management.core.windows.net/',
@@ -103,7 +103,7 @@ module Azure
103
103
  :traffic_manager_dns_suffix => 'trafficmanager.net',
104
104
  )
105
105
 
106
- USGovernment = self.new(
106
+ USGovernment = new(
107
107
  :name => 'US Government',
108
108
  :active_directory_authority => 'https://login-us.microsoftonline.com/',
109
109
  :active_directory_resource_id => 'https://management.core.usgovcloudapi.net/',
@@ -119,6 +119,40 @@ module Azure
119
119
  :storage_suffix => 'core.usgovcloudapi.net',
120
120
  :traffic_manager_dns_suffix => 'usgovtrafficmanager.net',
121
121
  )
122
+
123
+ Germany = new(
124
+ :name => 'Germany',
125
+ :active_directory_authority => 'https://login.microsoftonline.de/',
126
+ :active_directory_resource_id => 'https://management.core.cloudapi.de/',
127
+ :gallery_url => 'https://gallery.cloudapi.de/',
128
+ :graph_url => 'https://graph.cloudapi.de/',
129
+ :graph_api_version => '1.6',
130
+ :key_vault_dns_suffix => 'vault.microsoftazure.de',
131
+ :key_vault_service_resource_id => 'https://vault.microsoftazure.de',
132
+ :publish_settings_file_url => 'https://manage.microsoftazure.de/publishsettings/index',
133
+ :resource_manager_url => 'https://management.microsoftazure.de/',
134
+ :service_management_url => 'https://management.core.cloudapi.de/',
135
+ :sql_database_dns_suffix => 'database.cloudapi.de',
136
+ :storage_suffix => 'core.cloudapi.de',
137
+ :traffic_manager_dns_suffix => 'azuretrafficmanager.de'
138
+ )
139
+
140
+ China = new(
141
+ :name => 'China',
142
+ :active_directory_authority => 'https://login.chinacloudapi.cn',
143
+ :active_directory_resource_id => 'https://management.core.chinacloudapi.cn/',
144
+ :gallery_url => 'https://gallery.chinacloudapi.cn/',
145
+ :graph_url => 'https://graph.chinacloudapi.cn/',
146
+ :graph_api_version => '1.6',
147
+ :key_vault_dns_suffix => 'vault.azure.cn',
148
+ :key_vault_service_resource_id => 'https://vault.azure.cn',
149
+ :publish_settings_file_url => 'http://go.microsoft.com/fwlink/?LinkID=301776',
150
+ :resource_manager_url => 'https://management.chinacloudapi.cn/',
151
+ :service_management_url => 'https://management.core.chinacloudapi.cn/',
152
+ :sql_database_dns_suffix => 'database.chinacloudapi.cn',
153
+ :storage_suffix => 'core.chinacloudapi.cn',
154
+ :traffic_manager_dns_suffix => 'trafficmanager.cn'
155
+ )
122
156
  end
123
157
  end
124
158
  end
@@ -188,6 +188,7 @@ module Azure
188
188
  # Initial class definitions. Reopen these classes as needed.
189
189
 
190
190
  class AvailabilitySet < BaseModel; end
191
+ class Container < BaseModel; end
191
192
  class Event < BaseModel; end
192
193
  class ImageVersion < BaseModel; end
193
194
  class Offer < BaseModel; end
@@ -33,6 +33,9 @@ module Azure
33
33
  # The SSL verification method used for each request. The default is VERIFY_PEER.
34
34
  attr_accessor :ssl_verify
35
35
 
36
+ # The default access key used when creating a signature for internal http requests.
37
+ attr_accessor :access_key
38
+
36
39
  def initialize(json)
37
40
  super
38
41
  @storage_api_version = '2016-05-31'
@@ -44,8 +47,8 @@ module Azure
44
47
  # Returns a list of tables for the given storage account +key+. Note
45
48
  # that full metadata is returned.
46
49
  #
47
- def tables(key = nil)
48
- key ||= properties.key1
50
+ def tables(key = access_key)
51
+ raise ArgumentError, "No access key specified" unless key
49
52
  response = table_response(key, nil, "Tables")
50
53
  JSON.parse(response.body)['value'].map{ |t| Table.new(t) }
51
54
  end
@@ -54,8 +57,8 @@ module Azure
54
57
  # account +key+. If you are looking for the entities within the
55
58
  # table, use the table_data method instead.
56
59
  #
57
- def table_info(table, key = nil)
58
- key ||= properties.key1
60
+ def table_info(table, key = access_key)
61
+ raise ArgumentError, "No access key specified" unless key
59
62
  response = table_response(key, nil, "Tables('#{table}')")
60
63
  Table.new(response.body)
61
64
  end
@@ -95,8 +98,8 @@ module Azure
95
98
  # more_results = storage_account.table_data(table, key, options)
96
99
  # end
97
100
  #
98
- def table_data(name, key = nil, options = {})
99
- key ||= properties.key1
101
+ def table_data(name, key = access_key, options = {})
102
+ raise ArgumentError, "No access key specified" unless key
100
103
 
101
104
  query = build_query(options)
102
105
  response = table_response(key, query, name)
@@ -118,7 +121,7 @@ module Azure
118
121
 
119
122
  # Return a list of container names for the given storage account +key+.
120
123
  # If no key is provided, it is assumed that the StorageAccount object
121
- # includes the key1 property.
124
+ # includes the access_key property.
122
125
  #
123
126
  # # The following options are supported:
124
127
  #
@@ -148,8 +151,8 @@ module Azure
148
151
  # another call will automatically be made with the marker value included
149
152
  # in the URL so that you don't have to perform such a step manually.
150
153
  #
151
- def containers(key = nil, options = {})
152
- key ||= properties.key1
154
+ def containers(key = access_key, options = {})
155
+ raise ArgumentError, "No access key specified" unless key
153
156
 
154
157
  query = "comp=list"
155
158
  options.each { |okey, ovalue| query += "&#{okey}=#{[ovalue].flatten.join(',')}" }
@@ -166,11 +169,9 @@ module Azure
166
169
  end
167
170
 
168
171
  # Returns the properties for the given container +name+ using account +key+.
169
- # If no key is provided, it is assumed that the StorageAccount object
170
- # includes the key1 property.
171
172
  #
172
- def container_properties(name, key = nil)
173
- key ||= properties.key1
173
+ def container_properties(name, key = access_key)
174
+ raise ArgumentError, "No access key specified" unless key
174
175
 
175
176
  response = blob_response(key, "restype=container", name)
176
177
 
@@ -178,15 +179,13 @@ module Azure
178
179
  end
179
180
 
180
181
  # Returns the properties for the given container +name+ using account +key+.
181
- # If no key is provided, it is assumed that the StorageAccount object
182
- # includes the key1 property.
183
182
  #
184
183
  # If the returned object does not contain x_ms_blob_public_access then
185
184
  # the container is private to the account owner. You can also use the
186
185
  # :private? method to determine if the account is public or private.
187
186
  #
188
- def container_acl(name, key = nil)
189
- key ||= properties.key1
187
+ def container_acl(name, key = access_key)
188
+ raise ArgumentError, "No access key specified" unless key
190
189
 
191
190
  response = blob_response(key, "restype=container&comp=acl", name)
192
191
  response.headers[:private?] = response.headers.include?(:x_ms_blob_public_access) ? false : true
@@ -197,8 +196,8 @@ module Azure
197
196
  # Return the blob properties for the given +blob+ found in +container+. You may
198
197
  # optionally provide a date to get information for a snapshot.
199
198
  #
200
- def blob_properties(container, blob, key = nil, options = {})
201
- key ||= properties.key1
199
+ def blob_properties(container, blob, key = access_key, options = {})
200
+ raise ArgumentError, "No access key specified" unless key
202
201
 
203
202
  url = File.join(properties.primary_endpoints.blob, container, blob)
204
203
  url += "?snapshot=" + options[:date] if options[:date]
@@ -233,8 +232,8 @@ module Azure
233
232
  # The content_length option is only value for page blobs, and is used
234
233
  # to resize the blob.
235
234
  #
236
- def update_blob_properties(container, blob, key = nil, options = {})
237
- key ||= properties.key1
235
+ def update_blob_properties(container, blob, key = access_key, options = {})
236
+ raise ArgumentError, "No access key specified" unless key
238
237
 
239
238
  url = File.join(properties.primary_endpoints.blob, container, blob) + "?comp=properties"
240
239
 
@@ -259,7 +258,7 @@ module Azure
259
258
  end
260
259
 
261
260
  # Return a list of blobs for the given +container+ using the given +key+
262
- # or the key1 property of the StorageAccount object.
261
+ # or the access_key property of the StorageAccount object.
263
262
  #
264
263
  # The following options are supported:
265
264
  #
@@ -289,8 +288,8 @@ module Azure
289
288
  # another call will automatically be made with the marker value included
290
289
  # in the URL so that you don't have to perform such a step manually.
291
290
  #
292
- def blobs(container, key = nil, options = {})
293
- key ||= properties.key1
291
+ def blobs(container, key = access_key, options = {})
292
+ raise ArgumentError, "No access key specified" unless key
294
293
 
295
294
  query = "restype=container&comp=list"
296
295
  options.each { |okey, ovalue| query += "&#{okey}=#{[ovalue].flatten.join(',')}" }
@@ -309,8 +308,9 @@ module Azure
309
308
 
310
309
  # Returns an array of all blobs for all containers.
311
310
  #
312
- def all_blobs(key = nil, max_threads = 10)
313
- key ||= properties.key1
311
+ def all_blobs(key = access_key, max_threads = 10)
312
+ raise ArgumentError, "No access key specified" unless key
313
+
314
314
  array = []
315
315
  mutex = Mutex.new
316
316
 
@@ -329,8 +329,8 @@ module Azure
329
329
 
330
330
  # Returns the blob service properties for the current storage account.
331
331
  #
332
- def blob_service_properties(key = nil)
333
- key ||= properties.key1
332
+ def blob_service_properties(key = access_key)
333
+ raise ArgumentError, "No access key specified" unless key
334
334
 
335
335
  response = blob_response(key, "restype=service&comp=properties")
336
336
  toplevel = 'StorageServiceProperties'
@@ -342,8 +342,8 @@ module Azure
342
342
  # Return metadata for the given +blob+ within +container+. You may
343
343
  # specify a +date+ to retrieve metadata for a specific snapshot.
344
344
  #
345
- def blob_metadata(container, blob, key = nil, options = {})
346
- key ||= properties.key1
345
+ def blob_metadata(container, blob, key = access_key, options = {})
346
+ raise ArgumentError, "No access key specified" unless key
347
347
 
348
348
  query = "comp=metadata"
349
349
  query << "&snapshot=" + options[:date] if options[:date]
@@ -357,8 +357,8 @@ module Azure
357
357
  # available on the secondary location endpoint when read-access
358
358
  # geo-redundant replication is enabled for the storage account.
359
359
  #
360
- def blob_service_stats(key = nil)
361
- key ||= properties.key1
360
+ def blob_service_stats(key = access_key)
361
+ raise ArgumentError, "No access key specified" unless key
362
362
 
363
363
  response = blob_response(key, "restype=service&comp=stats")
364
364
  toplevel = 'StorageServiceStats'
@@ -375,8 +375,9 @@ module Azure
375
375
  # source = "Microsoft.Compute/Images/your_container/your-img-osDisk.123xyz.vhd"
376
376
  # storage_acct.copy_blob('system', source, 'vhds', nil, your_key)
377
377
  #
378
- def copy_blob(src_container, src_blob, dst_container, dst_blob = nil, key = nil)
379
- key ||= properties.key1
378
+ def copy_blob(src_container, src_blob, dst_container, dst_blob = nil, key = access_key)
379
+ raise ArgumentError, "No access key specified" unless key
380
+
380
381
  dst_blob ||= File.basename(src_blob)
381
382
 
382
383
  dst_url = File.join(properties.primary_endpoints.blob, dst_container, dst_blob)
@@ -405,8 +406,8 @@ module Azure
405
406
 
406
407
  # Delete the given +blob+ found in +container+.
407
408
  #
408
- def delete_blob(container, blob, key = nil, options = {})
409
- key ||= properties.key1
409
+ def delete_blob(container, blob, key = access_key, options = {})
410
+ raise ArgumentError, "No access key specified" unless key
410
411
 
411
412
  url = File.join(properties.primary_endpoints.blob, container, blob)
412
413
  url += "?snapshot=" + options[:date] if options[:date]
@@ -438,8 +439,8 @@ module Azure
438
439
  # data['x-ms-blob-content-encoding']
439
440
  # # - Optional. Set the blob’s content encoding.
440
441
  # ...
441
- def create_blob(container, blob, data, key = nil)
442
- key ||= properties.key1
442
+ def create_blob(container, blob, data, key = access_key)
443
+ raise ArgumentError, "No access key specified" unless key
443
444
 
444
445
  url = File.join(properties.primary_endpoints.blob, container, blob)
445
446
 
@@ -460,8 +461,8 @@ module Azure
460
461
  Blob.new(response.headers)
461
462
  end
462
463
 
463
- def create_blob_snapshot(container, blob, key = nil)
464
- key ||= properties.key1
464
+ def create_blob_snapshot(container, blob, key = access_key)
465
+ raise ArgumentError, "No access key specified" unless key
465
466
 
466
467
  url = File.join(properties.primary_endpoints.blob, container, blob)
467
468
  url += "?comp=snapshot"
@@ -515,8 +516,8 @@ module Azure
515
516
  # raise "Checksum error: #{range_str}, blob: #{@container}/#{@blob}" unless content_md5 == returned_md5
516
517
  # return ret.body
517
518
  #
518
- def get_blob_raw(container, blob, key = nil, options = {})
519
- key ||= properties.key1
519
+ def get_blob_raw(container, blob, key = access_key, options = {})
520
+ raise ArgumentError, "No access key specified" unless key
520
521
 
521
522
  url = File.join(properties.primary_endpoints.blob, container, blob)
522
523
  url += "?snapshot=" + options[:date] if options[:date]
@@ -1,6 +1,6 @@
1
1
  module Azure
2
2
  module Armrest
3
3
  # The version of the azure-armrest library.
4
- VERSION = '0.7.4'.freeze
4
+ VERSION = '0.7.5'.freeze
5
5
  end
6
6
  end
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.7.4
4
+ version: 0.7.5
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: 2017-06-09 00:00:00.000000000 Z
14
+ date: 2017-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -89,14 +89,14 @@ dependencies:
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: 1.7.1
92
+ version: 1.7.2
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: 1.7.1
99
+ version: 1.7.2
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: addressable
102
102
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +240,7 @@ files:
240
240
  - lib/azure/armrest/availability_set_service.rb
241
241
  - lib/azure/armrest/billing/usage_service.rb
242
242
  - lib/azure/armrest/configuration.rb
243
+ - lib/azure/armrest/container_service.rb
243
244
  - lib/azure/armrest/environment.rb
244
245
  - lib/azure/armrest/exception.rb
245
246
  - lib/azure/armrest/insights/alert_service.rb