azure-armrest 0.7.3 → 0.7.4

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: 74bb8a3af14d347ed47d16bfedd8d610ee487289
4
- data.tar.gz: 99bc7c02d7a5bf8d5972f3551a2629f212bd9ae7
3
+ metadata.gz: 7d9a379dcf879754655b90dd12e7d23a83d6d2b4
4
+ data.tar.gz: 8fd56da390cae4df7264a8c28508641df46168e0
5
5
  SHA512:
6
- metadata.gz: b3fb8f96855a6d11893fe8be0b44db591b2aea35197d8c1e303c01769c124fbd55719844b575eebad50aff32d489a727b332aa4a230e6fdb36664edbde4d78d3
7
- data.tar.gz: 45da2361f44891bd3919954d89e4a58981aac02f08c1f4a8541fe31cfc23e3f96151a3e59e5fa9c076fe68f74f85a16c93669515fabaa89fae863a79ba3e5c80
6
+ metadata.gz: 40bd7ac94d641b8b3d618be616dc09c440e98abd56741ee6983f36c04b802acddcffa00eba196df684e1daa90040372266bc0f1b2641f9d8a44ee51d96026848
7
+ data.tar.gz: 34d2d1e7708543084de37152c4cdf9a0bf5ce348e722bd87160f3f722404ebc4660e10cd6ff2dd9f73eb612da8d9c40dbc53c5acbeb4059ddfb4c2615518cacc
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ = 0.7.4 - 9-Jun-2017
2
+ * Added the BaseModel#subscription_id method.
3
+ * Improved the underlying regex for BaseModel#resource_group.
4
+ * Added the StorageAccount#update_blob_properties method.
5
+ * The object returned by StorageAccountService#list_private_images now
6
+ includes the resource_group.
7
+ * The default storage_api_version was updated to 2016-05-31.
8
+
1
9
  = 0.7.3 - 11-May-2017
2
10
  * Added guards against ECONNREFUSED and TimeoutException for the
3
11
  StorageAccountService#get_private_images and StorageAccount#all_blobs
@@ -68,10 +68,15 @@ module Azure
68
68
  end
69
69
 
70
70
  def resource_group
71
- @resource_group ||= id[/resourceGroups\/(.+?)\//i, 1] rescue nil
71
+ @resource_group ||= id[/resourcegroups\/(.*?[^\/]+)?/i, 1] rescue nil
72
+ end
73
+
74
+ def subscription_id
75
+ @subscription_id ||= id[/subscriptions\/(.*?[^\/]+)?/i, 1] rescue nil
72
76
  end
73
77
 
74
78
  attr_writer :resource_group
79
+ attr_writer :subscription_id
75
80
 
76
81
  def to_h
77
82
  @hash
@@ -21,7 +21,7 @@ module Azure
21
21
  class TableData < BaseModel; end
22
22
 
23
23
  # The version string used in headers sent as part any internal http
24
- # request. The default is 2015-12-11.
24
+ # request. The default is 2016-05-31.
25
25
  attr_accessor :storage_api_version
26
26
 
27
27
  # An http proxy to use per request. Defaults to ENV['http_proxy'] if set.
@@ -35,7 +35,7 @@ module Azure
35
35
 
36
36
  def initialize(json)
37
37
  super
38
- @storage_api_version = '2015-12-11'
38
+ @storage_api_version = '2016-05-31'
39
39
  @proxy = ENV['http_proxy']
40
40
  @ssl_version = 'TLSv1'
41
41
  @ssl_verify = nil
@@ -217,6 +217,47 @@ module Azure
217
217
  BlobProperty.new(response.headers.merge(:container => container, :name => blob))
218
218
  end
219
219
 
220
+ # Update the given +blob+ in +container+ with the provided options. The
221
+ # possible options are:
222
+ #
223
+ # cache_control
224
+ # content_disposition
225
+ # content_encoding
226
+ # content_language
227
+ # content_length
228
+ # content_md5
229
+ # content_type
230
+ # lease_id
231
+ # version
232
+ #
233
+ # The content_length option is only value for page blobs, and is used
234
+ # to resize the blob.
235
+ #
236
+ def update_blob_properties(container, blob, key = nil, options = {})
237
+ key ||= properties.key1
238
+
239
+ url = File.join(properties.primary_endpoints.blob, container, blob) + "?comp=properties"
240
+
241
+ hash = options.transform_keys do |okey|
242
+ "x-ms-blob-" + okey.to_s.tr('_', '-')
243
+ end
244
+
245
+ hash['verb'] = 'PUT'
246
+
247
+ headers = build_headers(url, key, :blob, hash)
248
+
249
+ response = ArmrestService.send(
250
+ :rest_put,
251
+ :url => url,
252
+ :headers => headers,
253
+ :proxy => proxy,
254
+ :ssl_version => ssl_version,
255
+ :ssl_verify => ssl_verify
256
+ )
257
+
258
+ BlobProperty.new(response.headers.merge(:container => container, :name => blob))
259
+ end
260
+
220
261
  # Return a list of blobs for the given +container+ using the given +key+
221
262
  # or the key1 property of the StorageAccount object.
222
263
  #
@@ -603,14 +644,14 @@ module Azure
603
644
  # We must override this setting or the request will fail in some cases.
604
645
 
605
646
  headers = {
606
- 'Content-Type' => '',
607
- 'x-ms-date' => Time.now.httpdate,
608
- 'x-ms-version' => @storage_api_version,
609
- :auth_string => true
647
+ 'content-type' => '',
648
+ 'x-ms-date' => Time.now.httpdate,
649
+ 'x-ms-version' => @storage_api_version,
650
+ 'auth_string' => true
610
651
  }
611
652
 
612
653
  headers.merge!(additional_headers)
613
- headers['Authorization'] = sig.signature(sig_type, headers)
654
+ headers['authorization'] = sig.signature(sig_type, headers)
614
655
 
615
656
  headers
616
657
  end
@@ -328,7 +328,7 @@ module Azure
328
328
  )
329
329
  )
330
330
 
331
- StorageAccount::PrivateImage.new(hash)
331
+ StorageAccount::PrivateImage.new(hash).tap { |image| image.resource_group = storage_account.resource_group }
332
332
  end
333
333
 
334
334
  # Get the key for the given +storage_acct+ using the appropriate method
@@ -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.3'.freeze
4
+ VERSION = '0.7.4'.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.3
4
+ version: 0.7.4
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-05-11 00:00:00.000000000 Z
14
+ date: 2017-06-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json