azure-storage 0.13.0.preview → 0.14.0.preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/azure/storage.rb +14 -13
  3. data/lib/azure/storage/autoload.rb +31 -31
  4. data/lib/azure/storage/blob/append.rb +43 -41
  5. data/lib/azure/storage/blob/blob.rb +150 -147
  6. data/lib/azure/storage/blob/blob_service.rb +186 -184
  7. data/lib/azure/storage/blob/block.rb +56 -56
  8. data/lib/azure/storage/blob/container.rb +93 -92
  9. data/lib/azure/storage/blob/page.rb +187 -104
  10. data/lib/azure/storage/blob/serialization.rb +32 -18
  11. data/lib/azure/storage/client.rb +18 -17
  12. data/lib/azure/storage/client_options.rb +192 -193
  13. data/lib/azure/storage/client_options_error.rb +5 -5
  14. data/lib/azure/storage/configurable.rb +39 -39
  15. data/lib/azure/storage/core.rb +6 -4
  16. data/lib/azure/storage/core/auth/shared_access_signature.rb +5 -3
  17. data/lib/azure/storage/core/auth/shared_access_signature_generator.rb +34 -33
  18. data/lib/azure/storage/core/auth/shared_access_signature_signer.rb +5 -5
  19. data/lib/azure/storage/core/auth/shared_key.rb +17 -15
  20. data/lib/azure/storage/core/autoload.rb +15 -13
  21. data/lib/azure/storage/core/error.rb +3 -1
  22. data/lib/azure/storage/core/filter/exponential_retry_filter.rb +13 -11
  23. data/lib/azure/storage/core/filter/linear_retry_filter.rb +10 -8
  24. data/lib/azure/storage/core/filter/retry_filter.rb +30 -29
  25. data/lib/azure/storage/core/http_client.rb +18 -16
  26. data/lib/azure/storage/core/sr.rb +50 -48
  27. data/lib/azure/storage/core/utility.rb +19 -17
  28. data/lib/azure/storage/default.rb +371 -361
  29. data/lib/azure/storage/file/directory.rb +36 -31
  30. data/lib/azure/storage/file/file.rb +103 -100
  31. data/lib/azure/storage/file/file_service.rb +42 -40
  32. data/lib/azure/storage/file/serialization.rb +9 -6
  33. data/lib/azure/storage/file/share.rb +48 -46
  34. data/lib/azure/storage/queue/message.rb +3 -1
  35. data/lib/azure/storage/queue/queue.rb +3 -2
  36. data/lib/azure/storage/queue/queue_service.rb +152 -151
  37. data/lib/azure/storage/queue/serialization.rb +7 -5
  38. data/lib/azure/storage/service/access_policy.rb +3 -1
  39. data/lib/azure/storage/service/cors.rb +4 -2
  40. data/lib/azure/storage/service/cors_rule.rb +3 -1
  41. data/lib/azure/storage/service/enumeration_results.rb +3 -1
  42. data/lib/azure/storage/service/logging.rb +5 -3
  43. data/lib/azure/storage/service/metrics.rb +5 -3
  44. data/lib/azure/storage/service/retention_policy.rb +3 -1
  45. data/lib/azure/storage/service/serialization.rb +31 -30
  46. data/lib/azure/storage/service/signed_identifier.rb +5 -4
  47. data/lib/azure/storage/service/storage_service.rb +33 -32
  48. data/lib/azure/storage/service/storage_service_properties.rb +6 -4
  49. data/lib/azure/storage/table/auth/shared_key.rb +9 -8
  50. data/lib/azure/storage/table/batch.rb +55 -55
  51. data/lib/azure/storage/table/batch_response.rb +17 -17
  52. data/lib/azure/storage/table/edmtype.rb +9 -7
  53. data/lib/azure/storage/table/entity.rb +4 -3
  54. data/lib/azure/storage/table/guid.rb +3 -1
  55. data/lib/azure/storage/table/query.rb +17 -19
  56. data/lib/azure/storage/table/serialization.rb +14 -12
  57. data/lib/azure/storage/table/table_service.rb +79 -80
  58. data/lib/azure/storage/version.rb +7 -5
  59. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a070f6404238f71f22cb9b6d6cf520710da9d3e
4
- data.tar.gz: 47aa7276488561d83324937bbd5622c368491ce3
3
+ metadata.gz: 9d928e46742461de06b7ea74aba3adfd35076eb6
4
+ data.tar.gz: 7c60c44b62b9a09f9bf9ff2f113a16182619e335
5
5
  SHA512:
6
- metadata.gz: 9747b0fee5eed2dfa431cdfcfbf6bbec93b8de3fe2d21397c4638595a547e05b557c28324ee967e80e13a015b9b4fa43c78a2aa8e9cb913e133fa54ff44b3b2a
7
- data.tar.gz: b2aa8f4ce38f1d1e56aa4408bc73ad7516d5b6577b3bcf914ed16343eb434e0864f577d066b166bfb22cea71e6eaed9c1164d5c4816b8447fd576ad785ec1ea4
6
+ metadata.gz: 5cf469aea716d07951b603167cce71a3bf51dfd5142d5431998c68e047bd1b651a7bb6c5b22c5de6ac57b1e0a7c41cafbf2fa823a1043685a02222e30c3b8bf7
7
+ data.tar.gz: 7d529320af4adc9026c9714f8a4f7276524b77c98909046d75753c986ce8054b24e91b0ff8892a01ebe669321728d684e0bbc4e285bd6cd0cd8520d83b61f3bf
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #-------------------------------------------------------------------------
2
4
  # # Copyright (c) Microsoft and contributors. All rights reserved.
3
5
  #
@@ -22,22 +24,22 @@
22
24
  # THE SOFTWARE.
23
25
  #--------------------------------------------------------------------------
24
26
 
25
- require 'rubygems'
26
- require 'nokogiri'
27
- require 'base64'
28
- require 'openssl'
29
- require 'uri'
30
- require 'faraday'
31
- require 'faraday_middleware'
27
+ require "rubygems"
28
+ require "nokogiri"
29
+ require "base64"
30
+ require "openssl"
31
+ require "uri"
32
+ require "faraday"
33
+ require "faraday_middleware"
32
34
 
33
- require 'azure/storage/autoload'
35
+ require "azure/storage/autoload"
34
36
 
35
37
  module Azure
36
38
  module Storage
37
39
  class << self
38
40
  include Azure::Storage::Configurable
39
41
 
40
- def client(options={})
42
+ def client(options = {})
41
43
  @client = Azure::Storage::Client.new(options) unless defined?(@client) && @client.same_options?(options)
42
44
  @client
43
45
  end
@@ -45,10 +47,9 @@ module Azure
45
47
  private
46
48
 
47
49
  def method_missing(method_name, *args, &block)
48
- return super unless client.respond_to?(method_name)
49
- client.send(method_name, *args, &block)
50
+ return client.send(method_name, *args, &block) if Azure::Storage::Client.method_defined?(method_name)
51
+ super
50
52
  end
51
-
52
53
  end
53
54
  end
54
- end
55
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #-------------------------------------------------------------------------
2
4
  # # Copyright (c) Microsoft and contributors. All rights reserved.
3
5
  #
@@ -22,56 +24,54 @@
22
24
  # THE SOFTWARE.
23
25
  #--------------------------------------------------------------------------
24
26
 
25
- require 'azure/storage/core/autoload'
27
+ require "azure/storage/core/autoload"
26
28
 
27
29
  module Azure
28
-
29
- autoload :Storage, 'azure/storage/core'
30
+ autoload :Storage, "azure/storage/core"
30
31
 
31
32
  module Storage
32
- autoload :Default, 'azure/storage/default'
33
- autoload :Configurable, 'azure/storage/configurable'
34
- autoload :Client, 'azure/storage/client'
35
- autoload :ClientOptions, 'azure/storage/client_options'
36
-
33
+ autoload :Default, "azure/storage/default"
34
+ autoload :Configurable, "azure/storage/configurable"
35
+ autoload :Client, "azure/storage/client"
36
+ autoload :ClientOptions, "azure/storage/client_options"
37
+
37
38
  module Auth
38
- autoload :SharedAccessSignature, 'azure/storage/core/auth/shared_access_signature'
39
+ autoload :SharedAccessSignature, "azure/storage/core/auth/shared_access_signature"
39
40
  end
40
41
 
41
42
  module Service
42
- autoload :Serialization, 'azure/storage/service/serialization'
43
- autoload :StorageService, 'azure/storage/service/storage_service'
43
+ autoload :Serialization, "azure/storage/service/serialization"
44
+ autoload :StorageService, "azure/storage/service/storage_service"
44
45
  end
45
46
 
46
47
  module Blob
47
- autoload :Blob, 'azure/storage/blob/blob'
48
- autoload :Block, 'azure/storage/blob/block'
49
- autoload :Page, 'azure/storage/blob/page'
50
- autoload :Append, 'azure/storage/blob/append'
51
- autoload :Container, 'azure/storage/blob/container'
52
- autoload :Serialization, 'azure/storage/blob/serialization'
53
- autoload :BlobService, 'azure/storage/blob/blob_service'
48
+ autoload :Blob, "azure/storage/blob/blob"
49
+ autoload :Block, "azure/storage/blob/block"
50
+ autoload :Page, "azure/storage/blob/page"
51
+ autoload :Append, "azure/storage/blob/append"
52
+ autoload :Container, "azure/storage/blob/container"
53
+ autoload :Serialization, "azure/storage/blob/serialization"
54
+ autoload :BlobService, "azure/storage/blob/blob_service"
54
55
  end
55
56
 
56
57
  module Queue
57
- autoload :QueueService, 'azure/storage/queue/queue_service'
58
- autoload :Message, 'azure/storage/queue/message'
59
- autoload :Queue, 'azure/storage/queue/queue'
58
+ autoload :QueueService, "azure/storage/queue/queue_service"
59
+ autoload :Message, "azure/storage/queue/message"
60
+ autoload :Queue, "azure/storage/queue/queue"
60
61
  end
61
62
 
62
63
  module Table
63
- autoload :TableService, 'azure/storage/table/table_service'
64
- autoload :Batch, 'azure/storage/table/batch'
65
- autoload :Query, 'azure/storage/table/query'
64
+ autoload :TableService, "azure/storage/table/table_service"
65
+ autoload :Batch, "azure/storage/table/batch"
66
+ autoload :Query, "azure/storage/table/query"
66
67
  end
67
68
 
68
69
  module File
69
- autoload :FileService, 'azure/storage/file/file_service'
70
- autoload :Share, 'azure/storage/file/share'
71
- autoload :Directory, 'azure/storage/file/directory'
72
- autoload :File, 'azure/storage/file/file'
73
- autoload :Serialization, 'azure/storage/file/serialization'
70
+ autoload :FileService, "azure/storage/file/file_service"
71
+ autoload :Share, "azure/storage/file/share"
72
+ autoload :Directory, "azure/storage/file/directory"
73
+ autoload :File, "azure/storage/file/file"
74
+ autoload :Serialization, "azure/storage/file/serialization"
74
75
  end
75
-
76
76
  end
77
- end
77
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #-------------------------------------------------------------------------
2
4
  # # Copyright (c) Microsoft and contributors. All rights reserved.
3
5
  #
@@ -35,58 +37,58 @@ module Azure::Storage
35
37
  # ==== Options
36
38
  #
37
39
  # Accepted key/value pairs in options parameter are:
38
- # * +:transactional_md5+ - String. An MD5 hash of the blob content. This hash is used to verify the integrity of the blob during transport.
39
- # When this header is specified, the storage service checks the hash that has arrived with the one that was sent.
40
+ # * +:transactional_md5+ - String. An MD5 hash of the blob content. This hash is used to verify the integrity of the blob during transport.
41
+ # When this header is specified, the storage service checks the hash that has arrived with the one that was sent.
40
42
  # If the two hashes do not match, the operation will fail with error code 400 (Bad Request).
41
43
  # * +:content_type+ - String. Content type for the blob. Will be saved with blob.
42
44
  # * +:content_encoding+ - String. Content encoding for the blob. Will be saved with blob.
43
45
  # * +:content_language+ - String. Content language for the blob. Will be saved with blob.
44
46
  # * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
45
47
  # * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
46
- # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
48
+ # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
47
49
  # and also can be used to attach additional metadata
48
50
  # * +:metadata+ - Hash. Custom metadata values to store with the blob.
49
51
  # * +:timeout+ - Integer. A timeout in seconds.
50
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
52
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
51
53
  # in the analytics logs when storage analytics logging is enabled.
52
- # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
53
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
54
+ # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
55
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
54
56
  # the Blob service returns status code 412 (Precondition Failed).
55
- # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
56
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
57
+ # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
58
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
57
59
  # the Blob service returns status code 412 (Precondition Failed).
58
- # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
59
- # only if the blob's ETag value matches the value specified. If the values do not match,
60
+ # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
61
+ # only if the blob's ETag value matches the value specified. If the values do not match,
60
62
  # the Blob service returns status code 412 (Precondition Failed).
61
- # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
62
- # only if the blob's ETag value does not match the value specified. If the values are identical,
63
+ # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
64
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
63
65
  # the Blob service returns status code 412 (Precondition Failed).
64
66
  #
65
67
  # See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
66
68
  #
67
69
  # Returns a Blob
68
- def create_append_blob(container, blob, options={})
69
- query = { }
70
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
70
+ def create_append_blob(container, blob, options = {})
71
+ query = {}
72
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
71
73
 
72
74
  uri = blob_uri(container, blob, query)
73
75
 
74
76
  headers = StorageService.common_headers
75
77
 
76
78
  # set x-ms-blob-type to AppendBlob
77
- StorageService.with_header headers, 'x-ms-blob-type', 'AppendBlob'
79
+ StorageService.with_header headers, "x-ms-blob-type", "AppendBlob"
78
80
 
79
81
  # ensure content-length is 0
80
- StorageService.with_header headers, 'Content-Length', 0.to_s
82
+ StorageService.with_header headers, "Content-Length", 0.to_s
81
83
 
82
84
  # set the rest of the optional headers
83
- StorageService.with_header headers, 'Content-MD5', options[:transactional_md5]
84
- StorageService.with_header headers, 'x-ms-blob-content-type', options[:content_type]
85
- StorageService.with_header headers, 'x-ms-blob-content-encoding', options[:content_encoding]
86
- StorageService.with_header headers, 'x-ms-blob-content-language', options[:content_language]
87
- StorageService.with_header headers, 'x-ms-blob-content-md5', options[:content_md5]
88
- StorageService.with_header headers, 'x-ms-blob-cache-control', options[:cache_control]
89
- StorageService.with_header headers, 'x-ms-blob-content-disposition', options[:content_disposition]
85
+ StorageService.with_header headers, "Content-MD5", options[:transactional_md5]
86
+ StorageService.with_header headers, "x-ms-blob-content-type", options[:content_type]
87
+ StorageService.with_header headers, "x-ms-blob-content-encoding", options[:content_encoding]
88
+ StorageService.with_header headers, "x-ms-blob-content-language", options[:content_language]
89
+ StorageService.with_header headers, "x-ms-blob-content-md5", options[:content_md5]
90
+ StorageService.with_header headers, "x-ms-blob-cache-control", options[:cache_control]
91
+ StorageService.with_header headers, "x-ms-blob-content-disposition", options[:content_disposition]
90
92
 
91
93
  StorageService.add_metadata_to_headers options[:metadata], headers
92
94
  add_blob_conditional_headers options, headers
@@ -100,7 +102,7 @@ module Azure::Storage
100
102
 
101
103
  result
102
104
  end
103
-
105
+
104
106
  # Public: Commits a new block of data to the end of an existing append blob.
105
107
  # This operation is permitted only on blobs created with the create_append_blob API.
106
108
  #
@@ -119,34 +121,34 @@ module Azure::Storage
119
121
  # * +:max_size+ - Integer. The max length in bytes permitted for the append blob
120
122
  # * +:append_position+ - Integer. A number indicating the byte offset to compare. It will succeed only if the append position is equal to this number
121
123
  # * +:timeout+ - Integer. A timeout in seconds.
122
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
124
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
123
125
  # in the analytics logs when storage analytics logging is enabled.
124
- # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
125
- # the blob has been modified since the specified date/time. If the blob has not been modified,
126
+ # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
127
+ # the blob has been modified since the specified date/time. If the blob has not been modified,
126
128
  # the Blob service returns status code 412 (Precondition Failed).
127
- # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
128
- # the blob has not been modified since the specified date/time. If the blob has been modified,
129
+ # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
130
+ # the blob has not been modified since the specified date/time. If the blob has been modified,
129
131
  # the Blob service returns status code 412 (Precondition Failed).
130
- # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
131
- # the blob's ETag value matches the value specified. If the values do not match,
132
+ # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
133
+ # the blob's ETag value matches the value specified. If the values do not match,
132
134
  # the Blob service returns status code 412 (Precondition Failed).
133
- # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
134
- # the blob's ETag value does not match the value specified. If the values are identical,
135
+ # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
136
+ # the blob's ETag value does not match the value specified. If the values are identical,
135
137
  # the Blob service returns status code 412 (Precondition Failed).
136
138
  #
137
139
  # See http://msdn.microsoft.com/en-us/library/azure/mt427365.aspx
138
140
  #
139
141
  # Returns a Blob
140
- def append_blob_block(container, blob, content, options={})
141
- query = { 'comp' => 'appendblock' }
142
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
142
+ def append_blob_block(container, blob, content, options = {})
143
+ query = { "comp" => "appendblock" }
144
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
143
145
 
144
146
  uri = blob_uri(container, blob, query)
145
147
 
146
148
  headers = StorageService.common_headers
147
- StorageService.with_header headers, 'Content-MD5', options[:content_md5]
148
- StorageService.with_header headers, 'x-ms-lease-id', options[:lease_id]
149
-
149
+ StorageService.with_header headers, "Content-MD5", options[:content_md5]
150
+ StorageService.with_header headers, "x-ms-lease-id", options[:lease_id]
151
+
150
152
  add_blob_conditional_headers options, headers
151
153
 
152
154
  response = call(:put, uri, content, headers, options)
@@ -156,4 +158,4 @@ module Azure::Storage
156
158
  result
157
159
  end
158
160
  end
159
- end
161
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #-------------------------------------------------------------------------
2
4
  # # Copyright (c) Microsoft and contributors. All rights reserved.
3
5
  #
@@ -24,7 +26,7 @@
24
26
  module Azure::Storage
25
27
  module Blob
26
28
  include Azure::Storage::Service
27
-
29
+
28
30
  class Blob
29
31
  def initialize
30
32
  @properties = {}
@@ -36,8 +38,9 @@ module Azure::Storage
36
38
  attr_accessor :snapshot
37
39
  attr_accessor :properties
38
40
  attr_accessor :metadata
41
+ attr_accessor :encrypted
39
42
  end
40
-
43
+
41
44
  # Public: Reads or downloads a blob from the system, including its metadata and properties.
42
45
  #
43
46
  # ==== Attributes
@@ -56,44 +59,45 @@ module Azure::Storage
56
59
  # * +:get_content_md5+ - Boolean. Return the MD5 hash for the range. This option only valid if
57
60
  # start_range and end_range are specified. (optional)
58
61
  # * +:timeout+ - Integer. A timeout in seconds.
59
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
62
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
60
63
  # in the analytics logs when storage analytics logging is enabled.
61
- # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to get the blob
62
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
64
+ # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to get the blob
65
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
63
66
  # the Blob service returns status code 412 (Precondition Failed).
64
- # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to get the blob
65
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
67
+ # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to get the blob
68
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
66
69
  # the Blob service returns status code 412 (Precondition Failed).
67
- # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob
68
- # only if the blob's ETag value matches the value specified. If the values do not match,
70
+ # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob
71
+ # only if the blob's ETag value matches the value specified. If the values do not match,
69
72
  # the Blob service returns status code 412 (Precondition Failed).
70
- # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob
71
- # only if the blob's ETag value does not match the value specified. If the values are identical,
73
+ # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob
74
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
72
75
  # the Blob service returns status code 412 (Precondition Failed).
73
76
  #
74
77
  # See http://msdn.microsoft.com/en-us/library/azure/dd179440.aspx
75
78
  #
76
79
  # Returns a blob and the blob body
77
- def get_blob(container, blob, options={})
78
- query = { }
79
- StorageService.with_query query, 'snapshot', options[:snapshot]
80
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
80
+ def get_blob(container, blob, options = {})
81
+ query = {}
82
+ StorageService.with_query query, "snapshot", options[:snapshot]
83
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
81
84
  uri = blob_uri(container, blob, query)
82
85
 
83
86
  headers = StorageService.common_headers
84
- options[:start_range] = 0 if options[:end_range] and not options[:start_range]
87
+ options[:start_range] = 0 if options[:end_range] && (not options[:start_range])
85
88
  if options[:start_range]
86
- StorageService.with_header headers, 'x-ms-range', "bytes=#{options[:start_range]}-#{options[:end_range]}"
87
- StorageService.with_header headers, 'x-ms-range-get-content-md5', true if options[:get_content_md5]
89
+ StorageService.with_header headers, "x-ms-range", "bytes=#{options[:start_range]}-#{options[:end_range]}"
90
+ StorageService.with_header headers, "x-ms-range-get-content-md5", "true" if options[:get_content_md5]
88
91
  end
89
92
  add_blob_conditional_headers options, headers
90
93
 
91
94
  response = call(:get, uri, nil, headers, options)
92
95
  result = Serialization.blob_from_headers(response.headers)
93
96
  result.name = blob unless result.name
97
+
94
98
  return result, response.body
95
99
  end
96
-
100
+
97
101
  # Public: Returns all properties and metadata on the blob.
98
102
  #
99
103
  # ==== Attributes
@@ -108,34 +112,34 @@ module Azure::Storage
108
112
  # * +:snapshot+ - String. An opaque DateTime value that specifies the blob snapshot to
109
113
  # retrieve information from.
110
114
  # * +:timeout+ - Integer. A timeout in seconds.
111
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
115
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
112
116
  # in the analytics logs when storage analytics logging is enabled.
113
117
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to get the blob properties
114
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
118
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
115
119
  # the Blob service returns status code 412 (Precondition Failed).
116
120
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to get the blob properties
117
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
121
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
118
122
  # the Blob service returns status code 412 (Precondition Failed).
119
123
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob properties
120
- # only if the blob's ETag value matches the value specified. If the values do not match,
124
+ # only if the blob's ETag value matches the value specified. If the values do not match,
121
125
  # the Blob service returns status code 412 (Precondition Failed).
122
126
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob properties
123
- # only if the blob's ETag value does not match the value specified. If the values are identical,
127
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
124
128
  # the Blob service returns status code 412 (Precondition Failed).
125
129
  #
126
130
  # See http://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
127
131
  #
128
132
  # Returns the blob properties with a Blob instance
129
- def get_blob_properties(container, blob, options={})
130
- query = { }
131
- StorageService.with_query query, 'snapshot', options[:snapshot]
132
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
133
+ def get_blob_properties(container, blob, options = {})
134
+ query = {}
135
+ StorageService.with_query query, "snapshot", options[:snapshot]
136
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
133
137
 
134
138
  headers = StorageService.common_headers
135
139
  unless options.empty?
136
140
  add_blob_conditional_headers options, headers
137
141
  end
138
-
142
+
139
143
  uri = blob_uri(container, blob, query)
140
144
 
141
145
  response = call(:head, uri, nil, headers, options)
@@ -147,7 +151,7 @@ module Azure::Storage
147
151
 
148
152
  result
149
153
  end
150
-
154
+
151
155
  # Public: Sets system properties defined for a blob.
152
156
  #
153
157
  # ==== Attributes
@@ -164,7 +168,7 @@ module Azure::Storage
164
168
  # * +:content_language+ - String. Content language for the blob. Will be saved with blob.
165
169
  # * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
166
170
  # * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
167
- # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
171
+ # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
168
172
  # and also can be used to attach additional metadata
169
173
  # * +:content_length+ - Integer. Resizes a page blob to the specified size. If the specified
170
174
  # value is less than the current size of the blob, then all pages above
@@ -199,19 +203,19 @@ module Azure::Storage
199
203
  # To set the sequence number to a value of your choosing, this property must be specified
200
204
  # together with :sequence_number_action
201
205
  # * +:timeout+ - Integer. A timeout in seconds.
202
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
206
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
203
207
  # in the analytics logs when storage analytics logging is enabled.
204
208
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to set the blob properties
205
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
209
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
206
210
  # the Blob service returns status code 412 (Precondition Failed).
207
211
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to set the blob properties
208
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
212
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
209
213
  # the Blob service returns status code 412 (Precondition Failed).
210
214
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to set the blob properties
211
- # only if the blob's ETag value matches the value specified. If the values do not match,
215
+ # only if the blob's ETag value matches the value specified. If the values do not match,
212
216
  # the Blob service returns status code 412 (Precondition Failed).
213
217
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to set the blob properties
214
- # only if the blob's ETag value does not match the value specified. If the values are identical,
218
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
215
219
  # the Blob service returns status code 412 (Precondition Failed).
216
220
  #
217
221
  # Remarks:
@@ -242,37 +246,37 @@ module Azure::Storage
242
246
  # See http://msdn.microsoft.com/en-us/library/azure/ee691966.aspx
243
247
  #
244
248
  # Returns nil on success.
245
- def set_blob_properties(container, blob, options={})
246
- query = {'comp' => 'properties'}
247
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
249
+ def set_blob_properties(container, blob, options = {})
250
+ query = { "comp" => "properties" }
251
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
248
252
  uri = blob_uri(container, blob, query)
249
253
 
250
254
  headers = StorageService.common_headers
251
255
 
252
256
  unless options.empty?
253
- StorageService.with_header headers, 'x-ms-blob-content-type', options[:content_type]
254
- StorageService.with_header headers, 'x-ms-blob-content-encoding', options[:content_encoding]
255
- StorageService.with_header headers, 'x-ms-blob-content-language', options[:content_language]
256
- StorageService.with_header headers, 'x-ms-blob-content-md5', options[:content_md5]
257
- StorageService.with_header headers, 'x-ms-blob-cache-control', options[:cache_control]
258
- StorageService.with_header headers, 'x-ms-blob-content-length', options[:content_length].to_s if options[:content_length]
259
- StorageService.with_header headers, 'x-ms-blob-content-disposition', options[:content_disposition]
260
-
257
+ StorageService.with_header headers, "x-ms-blob-content-type", options[:content_type]
258
+ StorageService.with_header headers, "x-ms-blob-content-encoding", options[:content_encoding]
259
+ StorageService.with_header headers, "x-ms-blob-content-language", options[:content_language]
260
+ StorageService.with_header headers, "x-ms-blob-content-md5", options[:content_md5]
261
+ StorageService.with_header headers, "x-ms-blob-cache-control", options[:cache_control]
262
+ StorageService.with_header headers, "x-ms-blob-content-length", options[:content_length].to_s if options[:content_length]
263
+ StorageService.with_header headers, "x-ms-blob-content-disposition", options[:content_disposition]
264
+
261
265
  if options[:sequence_number_action]
262
- StorageService.with_header headers, 'x-ms-blob-sequence-number-action', options[:sequence_number_action].to_s
263
-
266
+ StorageService.with_header headers, "x-ms-blob-sequence-number-action", options[:sequence_number_action].to_s
267
+
264
268
  if options[:sequence_number_action] != :increment
265
- StorageService.with_header headers, 'x-ms-blob-sequence-number', options[:sequence_number].to_s if options[:sequence_number]
269
+ StorageService.with_header headers, "x-ms-blob-sequence-number", options[:sequence_number].to_s if options[:sequence_number]
266
270
  end
267
271
  end
268
-
272
+
269
273
  add_blob_conditional_headers options, headers
270
274
  end
271
275
 
272
276
  call(:put, uri, nil, headers, options)
273
277
  nil
274
278
  end
275
-
279
+
276
280
  # Public: Returns metadata on the blob.
277
281
  #
278
282
  # ==== Attributes
@@ -287,28 +291,28 @@ module Azure::Storage
287
291
  # * +:snapshot+ - String. An opaque DateTime value that specifies the blob snapshot to
288
292
  # retrieve information from.
289
293
  # * +:timeout+ - Integer. A timeout in seconds.
290
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
294
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
291
295
  # in the analytics logs when storage analytics logging is enabled.
292
296
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to get the blob metadata
293
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
297
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
294
298
  # the Blob service returns status code 412 (Precondition Failed).
295
299
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to get the blob metadata
296
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
300
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
297
301
  # the Blob service returns status code 412 (Precondition Failed).
298
302
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob metadata
299
- # only if the blob's ETag value matches the value specified. If the values do not match,
303
+ # only if the blob's ETag value matches the value specified. If the values do not match,
300
304
  # the Blob service returns status code 412 (Precondition Failed).
301
305
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to get the blob metadata
302
- # only if the blob's ETag value does not match the value specified. If the values are identical,
306
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
303
307
  # the Blob service returns status code 412 (Precondition Failed).
304
308
  #
305
309
  # See http://msdn.microsoft.com/en-us/library/azure/dd179350.aspx
306
310
  #
307
311
  # Returns a Blob
308
- def get_blob_metadata(container, blob, options={})
309
- query = {'comp' => 'metadata'}
310
- StorageService.with_query query, 'snapshot', options[:snapshot]
311
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
312
+ def get_blob_metadata(container, blob, options = {})
313
+ query = { "comp" => "metadata" }
314
+ StorageService.with_query query, "snapshot", options[:snapshot]
315
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
312
316
 
313
317
  headers = StorageService.common_headers
314
318
  unless options.empty?
@@ -324,7 +328,7 @@ module Azure::Storage
324
328
 
325
329
  result
326
330
  end
327
-
331
+
328
332
  # Public: Sets metadata headers on the blob.
329
333
  #
330
334
  # ==== Attributes
@@ -338,28 +342,28 @@ module Azure::Storage
338
342
  #
339
343
  # Accepted key/value pairs in options parameter are:
340
344
  # * +:timeout+ - Integer. A timeout in seconds.
341
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
345
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
342
346
  # in the analytics logs when storage analytics logging is enabled.
343
347
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to set the blob metadata
344
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
348
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
345
349
  # the Blob service returns status code 412 (Precondition Failed).
346
350
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to set the blob metadata
347
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
351
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
348
352
  # the Blob service returns status code 412 (Precondition Failed).
349
353
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to set the blob metadata
350
- # only if the blob's ETag value matches the value specified. If the values do not match,
354
+ # only if the blob's ETag value matches the value specified. If the values do not match,
351
355
  # the Blob service returns status code 412 (Precondition Failed).
352
356
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to set the blob metadata
353
- # only if the blob's ETag value does not match the value specified. If the values are identical,
357
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
354
358
  # the Blob service returns status code 412 (Precondition Failed).
355
359
  #
356
360
  # See http://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
357
361
  #
358
362
  # Returns nil on success.
359
- def set_blob_metadata(container, blob, metadata, options={})
360
- query = {'comp' => 'metadata'}
361
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
362
-
363
+ def set_blob_metadata(container, blob, metadata, options = {})
364
+ query = { "comp" => "metadata" }
365
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
366
+
363
367
  uri = blob_uri(container, blob, query)
364
368
 
365
369
  headers = StorageService.common_headers
@@ -371,7 +375,7 @@ module Azure::Storage
371
375
  call(:put, uri, nil, headers, options)
372
376
  nil
373
377
  end
374
-
378
+
375
379
  # Public: Establishes an exclusive write lock on a blob. The lock duration can be 15 to 60 seconds, or can be infinite.
376
380
  # To write to a locked blob, a client must provide a lease ID.
377
381
  #
@@ -389,19 +393,19 @@ module Azure::Storage
389
393
  # * +:proposed_lease_id+ - String. Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request)
390
394
  # if the proposed lease ID is not in the correct format. (optional)
391
395
  # * +:timeout+ - Integer. A timeout in seconds.
392
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
396
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
393
397
  # in the analytics logs when storage analytics logging is enabled.
394
398
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to acquire the lease
395
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
399
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
396
400
  # the Blob service returns status code 412 (Precondition Failed).
397
401
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to acquire the lease
398
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
402
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
399
403
  # the Blob service returns status code 412 (Precondition Failed).
400
404
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
401
- # only if the blob's ETag value matches the value specified. If the values do not match,
405
+ # only if the blob's ETag value matches the value specified. If the values do not match,
402
406
  # the Blob service returns status code 412 (Precondition Failed).
403
407
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
404
- # only if the blob's ETag value does not match the value specified. If the values are identical,
408
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
405
409
  # the Blob service returns status code 412 (Precondition Failed).
406
410
  #
407
411
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
@@ -409,7 +413,7 @@ module Azure::Storage
409
413
  # Returns a String of the new unique lease id. While the lease is active, you must include the lease ID with any request
410
414
  # to write to the blob, or to renew, change, or release the lease.
411
415
  #
412
- def acquire_blob_lease(container, blob, options={})
416
+ def acquire_blob_lease(container, blob, options = {})
413
417
  acquire_lease container, blob, options
414
418
  end
415
419
 
@@ -429,27 +433,27 @@ module Azure::Storage
429
433
  #
430
434
  # Accepted key/value pairs in options parameter are:
431
435
  # * +:timeout+ - Integer. A timeout in seconds.
432
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
436
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
433
437
  # in the analytics logs when storage analytics logging is enabled.
434
438
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to renew the lease
435
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
439
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
436
440
  # the Blob service returns status code 412 (Precondition Failed).
437
441
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to renew the lease
438
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
442
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
439
443
  # the Blob service returns status code 412 (Precondition Failed).
440
444
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
441
- # only if the blob's ETag value matches the value specified. If the values do not match,
445
+ # only if the blob's ETag value matches the value specified. If the values do not match,
442
446
  # the Blob service returns status code 412 (Precondition Failed).
443
447
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
444
- # only if the blob's ETag value does not match the value specified. If the values are identical,
448
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
445
449
  # the Blob service returns status code 412 (Precondition Failed).
446
450
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
447
451
  #
448
452
  # Returns the renewed lease id
449
- def renew_blob_lease(container, blob, lease, options={})
453
+ def renew_blob_lease(container, blob, lease, options = {})
450
454
  renew_lease container, blob, lease, options
451
455
  end
452
-
456
+
453
457
  # Public: Change the lease ID.
454
458
  #
455
459
  # ==== Attributes
@@ -465,24 +469,24 @@ module Azure::Storage
465
469
  #
466
470
  # Accepted key/value pairs in options parameter are:
467
471
  # * +:timeout+ - Integer. A timeout in seconds.
468
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
472
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
469
473
  # in the analytics logs when storage analytics logging is enabled.
470
474
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to change the lease
471
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
475
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
472
476
  # the Blob service returns status code 412 (Precondition Failed).
473
477
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to change the lease
474
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
478
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
475
479
  # the Blob service returns status code 412 (Precondition Failed).
476
480
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to change the lease
477
- # only if the blob's ETag value matches the value specified. If the values do not match,
481
+ # only if the blob's ETag value matches the value specified. If the values do not match,
478
482
  # the Blob service returns status code 412 (Precondition Failed).
479
483
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to change the lease
480
- # only if the blob's ETag value does not match the value specified. If the values are identical,
484
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
481
485
  # the Blob service returns status code 412 (Precondition Failed).
482
486
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
483
487
  #
484
488
  # Returns the changed lease id
485
- def change_blob_lease(container, blob, lease, proposed_lease, options={})
489
+ def change_blob_lease(container, blob, lease, proposed_lease, options = {})
486
490
  change_lease container, blob, lease, proposed_lease, options
487
491
  end
488
492
 
@@ -501,24 +505,24 @@ module Azure::Storage
501
505
  #
502
506
  # Accepted key/value pairs in options parameter are:
503
507
  # * +:timeout+ - Integer. A timeout in seconds.
504
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
508
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
505
509
  # in the analytics logs when storage analytics logging is enabled.
506
510
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to release the lease
507
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
511
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
508
512
  # the Blob service returns status code 412 (Precondition Failed).
509
513
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to release the lease
510
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
514
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
511
515
  # the Blob service returns status code 412 (Precondition Failed).
512
516
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to release the lease
513
- # only if the blob's ETag value matches the value specified. If the values do not match,
517
+ # only if the blob's ETag value matches the value specified. If the values do not match,
514
518
  # the Blob service returns status code 412 (Precondition Failed).
515
519
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to release the lease
516
- # only if the blob's ETag value does not match the value specified. If the values are identical,
520
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
517
521
  # the Blob service returns status code 412 (Precondition Failed).
518
522
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
519
523
  #
520
524
  # Returns nil on success
521
- def release_blob_lease(container, blob, lease, options={})
525
+ def release_blob_lease(container, blob, lease, options = {})
522
526
  release_lease container, blob, lease, options
523
527
  end
524
528
 
@@ -549,29 +553,29 @@ module Azure::Storage
549
553
  # If this option is not used, a fixed-duration lease breaks after the remaining lease
550
554
  # period elapses, and an infinite lease breaks immediately.
551
555
  # * +:timeout+ - Integer. A timeout in seconds.
552
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
556
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
553
557
  # in the analytics logs when storage analytics logging is enabled.
554
558
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to break the lease
555
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
559
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
556
560
  # the Blob service returns status code 412 (Precondition Failed).
557
561
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to break the lease
558
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
562
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
559
563
  # the Blob service returns status code 412 (Precondition Failed).
560
564
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to break the lease
561
- # only if the blob's ETag value matches the value specified. If the values do not match,
565
+ # only if the blob's ETag value matches the value specified. If the values do not match,
562
566
  # the Blob service returns status code 412 (Precondition Failed).
563
567
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to break the lease
564
- # only if the blob's ETag value does not match the value specified. If the values are identical,
568
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
565
569
  # the Blob service returns status code 412 (Precondition Failed).
566
570
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
567
571
  #
568
572
  # Returns an Integer of the remaining lease time. This value is the approximate time remaining in the lease
569
573
  # period, in seconds. This header is returned only for a successful request to break the lease. If the break
570
574
  # is immediate, 0 is returned.
571
- def break_blob_lease(container, blob, options={})
575
+ def break_blob_lease(container, blob, options = {})
572
576
  break_lease container, blob, options
573
577
  end
574
-
578
+
575
579
  # Public: Creates a snapshot of a blob.
576
580
  #
577
581
  # ==== Attributes
@@ -585,27 +589,27 @@ module Azure::Storage
585
589
  # Accepted key/value pairs in options parameter are:
586
590
  # * +:metadata+ - Hash. Custom metadata values to store with the blob snapshot.
587
591
  # * +:timeout+ - Integer. A timeout in seconds.
588
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
592
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
589
593
  # in the analytics logs when storage analytics logging is enabled.
590
594
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create the blob snapshot
591
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
595
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
592
596
  # the Blob service returns status code 412 (Precondition Failed).
593
597
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create the blob snapshot
594
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
598
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
595
599
  # the Blob service returns status code 412 (Precondition Failed).
596
600
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
597
- # only if the blob's ETag value matches the value specified. If the values do not match,
601
+ # only if the blob's ETag value matches the value specified. If the values do not match,
598
602
  # the Blob service returns status code 412 (Precondition Failed).
599
603
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
600
- # only if the blob's ETag value does not match the value specified. If the values are identical,
604
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
601
605
  # the Blob service returns status code 412 (Precondition Failed).
602
606
  #
603
607
  # See http://msdn.microsoft.com/en-us/library/azure/ee691971.aspx
604
608
  #
605
609
  # Returns the snapshot DateTime value
606
- def create_blob_snapshot(container, blob, options={})
607
- query = { 'comp' => 'snapshot'}
608
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
610
+ def create_blob_snapshot(container, blob, options = {})
611
+ query = { "comp" => "snapshot" }
612
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
609
613
 
610
614
  uri = blob_uri(container, blob, query)
611
615
 
@@ -617,9 +621,9 @@ module Azure::Storage
617
621
 
618
622
  response = call(:put, uri, nil, headers, options)
619
623
 
620
- response.headers['x-ms-snapshot']
624
+ response.headers["x-ms-snapshot"]
621
625
  end
622
-
626
+
623
627
  # Public: Copies a source blob or file to a destination blob.
624
628
  #
625
629
  # ==== Attributes
@@ -662,7 +666,7 @@ module Azure::Storage
662
666
  # blob's ETag value does not match the value specified. If the values are
663
667
  # identical, the Blob service returns status code 412 (Precondition Failed).
664
668
  # * +:timeout+ - Integer. A timeout in seconds.
665
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
669
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
666
670
  # in the analytics logs when storage analytics logging is enabled.
667
671
  #
668
672
  # See http://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
@@ -675,13 +679,13 @@ module Azure::Storage
675
679
  # "success" - The copy completed successfully.
676
680
  # "pending" - The copy is in progress.
677
681
  #
678
- def copy_blob_from_uri(destination_container, destination_blob, source_uri, options={})
679
- query = { }
680
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
682
+ def copy_blob_from_uri(destination_container, destination_blob, source_uri, options = {})
683
+ query = {}
684
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
681
685
 
682
686
  uri = blob_uri(destination_container, destination_blob, query)
683
687
  headers = StorageService.common_headers
684
- StorageService.with_header headers, 'x-ms-copy-source', source_uri
688
+ StorageService.with_header headers, "x-ms-copy-source", source_uri
685
689
 
686
690
  unless options.empty?
687
691
  add_blob_conditional_headers options, headers
@@ -689,9 +693,9 @@ module Azure::Storage
689
693
  end
690
694
 
691
695
  response = call(:put, uri, nil, headers, options)
692
- return response.headers['x-ms-copy-id'], response.headers['x-ms-copy-status']
696
+ return response.headers["x-ms-copy-id"], response.headers["x-ms-copy-status"]
693
697
  end
694
-
698
+
695
699
  # Public: Copies a source blob to a destination blob within the same storage account.
696
700
  #
697
701
  # ==== Attributes
@@ -735,7 +739,7 @@ module Azure::Storage
735
739
  # blob's ETag value does not match the value specified. If the values are
736
740
  # identical, the Blob service returns status code 412 (Precondition Failed).
737
741
  # * +:timeout+ - Integer. A timeout in seconds.
738
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
742
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
739
743
  # in the analytics logs when storage analytics logging is enabled.
740
744
  #
741
745
  # See http://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
@@ -748,13 +752,13 @@ module Azure::Storage
748
752
  # "success" - The copy completed successfully.
749
753
  # "pending" - The copy is in progress.
750
754
  #
751
- def copy_blob(destination_container, destination_blob, source_container, source_blob, options={})
752
- source_blob_uri = blob_uri(source_container, source_blob, options[:source_snapshot] ? { 'snapshot' => options[:source_snapshot] } : {}).to_s
755
+ def copy_blob(destination_container, destination_blob, source_container, source_blob, options = {})
756
+ source_blob_uri = blob_uri(source_container, source_blob, options[:source_snapshot] ? { "snapshot" => options[:source_snapshot] } : {}).to_s
753
757
 
754
758
  return copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options)
755
759
  end
756
-
757
- # Public: Aborts a pending Copy Blob operation and leaves a destination blob with zero length and full metadata.
760
+
761
+ # Public: Aborts a pending Copy Blob operation and leaves a destination blob with zero length and full metadata.
758
762
  #
759
763
  # ==== Attributes
760
764
  #
@@ -768,29 +772,29 @@ module Azure::Storage
768
772
  # Accepted key/value pairs in options parameter are:
769
773
  # * +:lease_id+ - String. The lease id if the destination blob has an active infinite lease
770
774
  # * +:timeout+ - Integer. A timeout in seconds.
771
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
775
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
772
776
  # in the analytics logs when storage analytics logging is enabled.
773
777
  #
774
778
  # See https://msdn.microsoft.com/en-us/library/azure/jj159098.aspx
775
779
  #
776
780
  # Returns nil on success
777
- def abort_copy_blob(container, blob, copy_id, options={})
778
- query = { 'comp' => 'copy'}
779
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
780
- StorageService.with_query query, 'copyid', copy_id
781
+ def abort_copy_blob(container, blob, copy_id, options = {})
782
+ query = { "comp" => "copy" }
783
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
784
+ StorageService.with_query query, "copyid", copy_id
781
785
 
782
786
  uri = blob_uri(container, blob, query);
783
787
  headers = StorageService.common_headers
784
- StorageService.with_header headers, 'x-ms-copy-action', 'abort';
785
-
788
+ StorageService.with_header headers, "x-ms-copy-action", "abort";
789
+
786
790
  unless options.empty?
787
- StorageService.with_header headers, 'x-ms-lease-id', options[:lease_id]
791
+ StorageService.with_header headers, "x-ms-lease-id", options[:lease_id]
788
792
  end
789
793
 
790
794
  call(:put, uri, nil, headers, options)
791
795
  nil
792
796
  end
793
-
797
+
794
798
  # Public: Deletes a blob or blob snapshot.
795
799
  #
796
800
  # ==== Attributes
@@ -812,40 +816,39 @@ module Azure::Storage
812
816
  # * +:only+ - Deletes only the snapshots for the blob, but leaves the blob
813
817
  # * +:include+ - Deletes the blob and all of the snapshots for the blob
814
818
  # * +:timeout+ - Integer. A timeout in seconds.
815
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
819
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
816
820
  # in the analytics logs when storage analytics logging is enabled.
817
821
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create the blob snapshot
818
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
822
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
819
823
  # the Blob service returns status code 412 (Precondition Failed).
820
824
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create the blob snapshot
821
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
825
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
822
826
  # the Blob service returns status code 412 (Precondition Failed).
823
827
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
824
- # only if the blob's ETag value matches the value specified. If the values do not match,
828
+ # only if the blob's ETag value matches the value specified. If the values do not match,
825
829
  # the Blob service returns status code 412 (Precondition Failed).
826
830
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
827
- # only if the blob's ETag value does not match the value specified. If the values are identical,
831
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
828
832
  # the Blob service returns status code 412 (Precondition Failed).
829
833
  #
830
834
  # See http://msdn.microsoft.com/en-us/library/azure/dd179440.aspx
831
835
  #
832
836
  # Returns nil on success
833
- def delete_blob(container, blob, options={})
834
- query = { }
835
- StorageService.with_query query, 'snapshot', options[:snapshot]
836
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
837
+ def delete_blob(container, blob, options = {})
838
+ query = {}
839
+ StorageService.with_query query, "snapshot", options[:snapshot]
840
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
837
841
 
838
842
  uri = blob_uri(container, blob, query)
839
843
 
840
844
  options[:delete_snapshots] = :include unless options[:delete_snapshots]
841
845
 
842
846
  headers = StorageService.common_headers
843
- StorageService.with_header headers, 'x-ms-delete-snapshots', options[:delete_snapshots].to_s if options[:delete_snapshots] && options[:snapshot] == nil
847
+ StorageService.with_header headers, "x-ms-delete-snapshots", options[:delete_snapshots].to_s if options[:delete_snapshots] && options[:snapshot] == nil
844
848
  add_blob_conditional_headers options, headers
845
849
 
846
850
  call(:delete, uri, nil, headers, options)
847
851
  nil
848
852
  end
849
-
850
853
  end
851
- end
854
+ end