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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #-------------------------------------------------------------------------
2
4
  # # Copyright (c) Microsoft and contributors. All rights reserved.
3
5
  #
@@ -23,10 +25,9 @@
23
25
  #--------------------------------------------------------------------------
24
26
  module Azure::Storage
25
27
  module Blob
26
- # Represents a Block as part of a BlockList
28
+ # Represents a Block as part of a BlockList
27
29
  # The type should be one of :uncommitted, :committed or :latest
28
30
  class Block
29
-
30
31
  def initialize
31
32
  @type = :latest
32
33
  yield self if block_given?
@@ -57,55 +58,55 @@ module Azure::Storage
57
58
  # ==== Options
58
59
  #
59
60
  # Accepted key/value pairs in options parameter are:
60
- # * +:transactional_md5+ - String. An MD5 hash of the blob content. This hash is used to verify the integrity of the blob during transport.
61
- # When this header is specified, the storage service checks the hash that has arrived with the one that was sent.
61
+ # * +:transactional_md5+ - String. An MD5 hash of the blob content. This hash is used to verify the integrity of the blob during transport.
62
+ # When this header is specified, the storage service checks the hash that has arrived with the one that was sent.
62
63
  # If the two hashes do not match, the operation will fail with error code 400 (Bad Request).
63
64
  # * +:content_type+ - String. Content type for the blob. Will be saved with blob.
64
65
  # * +:content_encoding+ - String. Content encoding for the blob. Will be saved with blob.
65
66
  # * +:content_language+ - String. Content language for the blob. Will be saved with blob.
66
67
  # * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
67
68
  # * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
68
- # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
69
+ # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
69
70
  # and also can be used to attach additional metadata
70
71
  # * +:metadata+ - Hash. Custom metadata values to store with the blob.
71
72
  # * +:timeout+ - Integer. A timeout in seconds.
72
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
73
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
73
74
  # in the analytics logs when storage analytics logging is enabled.
74
- # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
75
- # only if the blob has been modified since the specified date/time. If the blob has not been modified,
75
+ # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
76
+ # only if the blob has been modified since the specified date/time. If the blob has not been modified,
76
77
  # the Blob service returns status code 412 (Precondition Failed).
77
- # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
78
- # only if the blob has not been modified since the specified date/time. If the blob has been modified,
78
+ # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
79
+ # only if the blob has not been modified since the specified date/time. If the blob has been modified,
79
80
  # the Blob service returns status code 412 (Precondition Failed).
80
- # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
81
- # only if the blob's ETag value matches the value specified. If the values do not match,
81
+ # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
82
+ # only if the blob's ETag value matches the value specified. If the values do not match,
82
83
  # the Blob service returns status code 412 (Precondition Failed).
83
- # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
84
- # only if the blob's ETag value does not match the value specified. If the values are identical,
84
+ # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
85
+ # only if the blob's ETag value does not match the value specified. If the values are identical,
85
86
  # the Blob service returns status code 412 (Precondition Failed).
86
87
  #
87
88
  # See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
88
89
  #
89
90
  # Returns a Blob
90
- def create_block_blob(container, blob, content, options={})
91
- query = { }
92
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
91
+ def create_block_blob(container, blob, content, options = {})
92
+ query = {}
93
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
93
94
 
94
95
  uri = blob_uri(container, blob, query)
95
96
 
96
97
  headers = StorageService.common_headers
97
98
 
98
99
  # set x-ms-blob-type to BlockBlob
99
- StorageService.with_header headers, 'x-ms-blob-type', 'BlockBlob'
100
+ StorageService.with_header headers, "x-ms-blob-type", "BlockBlob"
100
101
 
101
102
  # set the rest of the optional headers
102
- StorageService.with_header headers, 'Content-MD5', options[:transactional_md5]
103
- StorageService.with_header headers, 'x-ms-blob-content-type', options[:content_type]
104
- StorageService.with_header headers, 'x-ms-blob-content-encoding', options[:content_encoding]
105
- StorageService.with_header headers, 'x-ms-blob-content-language', options[:content_language]
106
- StorageService.with_header headers, 'x-ms-blob-content-md5', options[:content_md5]
107
- StorageService.with_header headers, 'x-ms-blob-cache-control', options[:cache_control]
108
- StorageService.with_header headers, 'x-ms-blob-content-disposition', options[:content_disposition]
103
+ StorageService.with_header headers, "Content-MD5", options[:transactional_md5]
104
+ StorageService.with_header headers, "x-ms-blob-content-type", options[:content_type]
105
+ StorageService.with_header headers, "x-ms-blob-content-encoding", options[:content_encoding]
106
+ StorageService.with_header headers, "x-ms-blob-content-language", options[:content_language]
107
+ StorageService.with_header headers, "x-ms-blob-content-md5", options[:content_md5]
108
+ StorageService.with_header headers, "x-ms-blob-cache-control", options[:cache_control]
109
+ StorageService.with_header headers, "x-ms-blob-content-disposition", options[:content_disposition]
109
110
 
110
111
  StorageService.add_metadata_to_headers options[:metadata], headers
111
112
  add_blob_conditional_headers options, headers
@@ -119,7 +120,7 @@ module Azure::Storage
119
120
 
120
121
  result
121
122
  end
122
-
123
+
123
124
  # Public: Creates a new block to be committed as part of a block blob.
124
125
  #
125
126
  # ==== Attributes
@@ -135,24 +136,24 @@ module Azure::Storage
135
136
  # Accepted key/value pairs in options parameter are:
136
137
  # * +:content_md5+ - String. Content MD5 for the request contents.
137
138
  # * +:timeout+ - Integer. A timeout in seconds.
138
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
139
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
139
140
  # in the analytics logs when storage analytics logging is enabled.
140
141
  #
141
142
  # See http://msdn.microsoft.com/en-us/library/azure/dd135726.aspx
142
143
  #
143
144
  # Returns response of the operation
144
- def put_blob_block(container, blob, block_id, content, options={})
145
- query = { 'comp' => 'block'}
146
- StorageService.with_query query, 'blockid', Base64.strict_encode64(block_id)
147
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
145
+ def put_blob_block(container, blob, block_id, content, options = {})
146
+ query = { "comp" => "block" }
147
+ StorageService.with_query query, "blockid", Base64.strict_encode64(block_id)
148
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
148
149
 
149
150
  uri = blob_uri(container, blob, query)
150
151
 
151
152
  headers = StorageService.common_headers
152
- StorageService.with_header headers, 'Content-MD5', options[:content_md5]
153
+ StorageService.with_header headers, "Content-MD5", options[:content_md5]
153
154
 
154
155
  response = call(:put, uri, content, headers, options)
155
- response.headers['Content-MD5']
156
+ response.headers["Content-MD5"]
156
157
  end
157
158
 
158
159
  # Public: Commits existing blob blocks to a blob.
@@ -187,34 +188,34 @@ module Azure::Storage
187
188
  # * +:content_language+ - String. Content language for the blob. Will be saved with blob.
188
189
  # * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
189
190
  # * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
190
- # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
191
+ # * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
191
192
  # and also can be used to attach additional metadata
192
193
  # * +:metadata+ - Hash. Custom metadata values to store with the blob.
193
194
  # * +:timeout+ - Integer. A timeout in seconds.
194
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
195
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
195
196
  # in the analytics logs when storage analytics logging is enabled.
196
197
  #
197
198
  # This operation also supports the use of conditional headers to commit the block list if a specified condition is met.
198
199
  # For more information, see https://msdn.microsoft.com/en-us/library/azure/dd179371.aspx
199
200
  #
200
- # See http://msdn.microsoft.com/en-us/library/azure/dd179467.aspx
201
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179467.aspx
201
202
  #
202
203
  # Returns nil on success
203
- def commit_blob_blocks(container, blob, block_list, options={})
204
- query = { 'comp' => 'blocklist'}
205
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
204
+ def commit_blob_blocks(container, blob, block_list, options = {})
205
+ query = { "comp" => "blocklist" }
206
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
206
207
 
207
208
  uri = blob_uri(container, blob, query)
208
209
 
209
210
  headers = StorageService.common_headers
210
211
  unless options.empty?
211
- StorageService.with_header headers, 'Content-MD5', options[:transactional_md5]
212
- StorageService.with_header headers, 'x-ms-blob-content-type', options[:content_type]
213
- StorageService.with_header headers, 'x-ms-blob-content-encoding', options[:content_encoding]
214
- StorageService.with_header headers, 'x-ms-blob-content-language', options[:content_language]
215
- StorageService.with_header headers, 'x-ms-blob-content-md5', options[:content_md5]
216
- StorageService.with_header headers, 'x-ms-blob-cache-control', options[:cache_control]
217
- StorageService.with_header headers, 'x-ms-blob-content-disposition', options[:content_disposition]
212
+ StorageService.with_header headers, "Content-MD5", options[:transactional_md5]
213
+ StorageService.with_header headers, "x-ms-blob-content-type", options[:content_type]
214
+ StorageService.with_header headers, "x-ms-blob-content-encoding", options[:content_encoding]
215
+ StorageService.with_header headers, "x-ms-blob-content-language", options[:content_language]
216
+ StorageService.with_header headers, "x-ms-blob-content-md5", options[:content_md5]
217
+ StorageService.with_header headers, "x-ms-blob-cache-control", options[:cache_control]
218
+ StorageService.with_header headers, "x-ms-blob-content-disposition", options[:content_disposition]
218
219
 
219
220
  StorageService.add_metadata_to_headers(options[:metadata], headers)
220
221
  add_blob_conditional_headers(options, headers)
@@ -230,8 +231,8 @@ module Azure::Storage
230
231
  # There are two block lists maintained for a blob:
231
232
  # 1) Committed Block List: The list of blocks that have been successfully
232
233
  # committed to a given blob with commitBlobBlocks.
233
- # 2) Uncommitted Block List: The list of blocks that have been uploaded for a
234
- # blob using Put Block (REST API), but that have not yet been committed.
234
+ # 2) Uncommitted Block List: The list of blocks that have been uploaded for a
235
+ # blob using Put Block (REST API), but that have not yet been committed.
235
236
  # These blocks are stored in Microsoft Azure in association with a blob, but do
236
237
  # not yet form part of the blob.
237
238
  #
@@ -248,20 +249,19 @@ module Azure::Storage
248
249
  # * +:snapshot+ - String. An opaque DateTime value that specifies the blob snapshot to
249
250
  # retrieve information from. (optional)
250
251
  # * +:timeout+ - Integer. A timeout in seconds.
251
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
252
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
252
253
  # in the analytics logs when storage analytics logging is enabled.
253
254
  #
254
255
  # See http://msdn.microsoft.com/en-us/library/azure/dd179400.aspx
255
256
  #
256
257
  # Returns a list of Azure::Storage::Entity::Blob::Block instances
257
- def list_blob_blocks(container, blob, options={})
258
-
258
+ def list_blob_blocks(container, blob, options = {})
259
259
  options[:blocklist_type] = options[:blocklist_type] || :all
260
260
 
261
- query = { 'comp' => 'blocklist'}
262
- StorageService.with_query query, 'snapshot', options[:snapshot]
263
- StorageService.with_query query, 'blocklisttype', options[:blocklist_type].to_s if options[:blocklist_type]
264
- StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]
261
+ query = { "comp" => "blocklist" }
262
+ StorageService.with_query query, "snapshot", options[:snapshot]
263
+ StorageService.with_query query, "blocklisttype", options[:blocklist_type].to_s if options[:blocklist_type]
264
+ StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
265
265
 
266
266
  uri = blob_uri(container, blob, query)
267
267
 
@@ -270,4 +270,4 @@ module Azure::Storage
270
270
  Serialization.block_list_from_xml(response.body)
271
271
  end
272
272
  end
273
- end
273
+ 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
  #
@@ -21,12 +23,12 @@
21
23
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
24
  # THE SOFTWARE.
23
25
  #--------------------------------------------------------------------------
24
- require 'azure/storage/blob/serialization'
26
+ require "azure/storage/blob/serialization"
25
27
 
26
28
  module Azure::Storage::Blob
27
29
  module Container
28
30
  include Azure::Storage::Service
29
-
31
+
30
32
  class Container
31
33
  def initialize
32
34
  @properties = {}
@@ -39,7 +41,7 @@ module Azure::Storage::Blob
39
41
  attr_accessor :metadata
40
42
  attr_accessor :public_access_level
41
43
  end
42
-
44
+
43
45
  # Public: Create a new container
44
46
  #
45
47
  # ==== Attributes
@@ -53,16 +55,16 @@ module Azure::Storage::Blob
53
55
  # * +:metadata+ - Hash. User defined metadata for the container (optional).
54
56
  # * +:public_access_level+ - String. One of "container" or "blob" (optional).
55
57
  # * +:timeout+ - Integer. A timeout in seconds.
56
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
58
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
57
59
  # in the analytics logs when storage analytics logging is enabled.
58
60
  #
59
61
  # See http://msdn.microsoft.com/en-us/library/azure/dd179468.aspx
60
62
  #
61
63
  # Returns a Container
62
- def create_container(name, options={})
64
+ def create_container(name, options = {})
63
65
  # Query
64
- query = { }
65
- query['timeout'] = options[:timeout].to_s if options[:timeout]
66
+ query = {}
67
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
66
68
 
67
69
  # Scheme + path
68
70
  uri = container_uri(name, query)
@@ -70,7 +72,7 @@ module Azure::Storage::Blob
70
72
  # Headers
71
73
  headers = StorageService.common_headers
72
74
  StorageService.add_metadata_to_headers(options[:metadata], headers) if options[:metadata]
73
- headers['x-ms-blob-public-access'] = options[:public_access_level].to_s if options[:public_access_level]
75
+ headers["x-ms-blob-public-access"] = options[:public_access_level].to_s if options[:public_access_level]
74
76
 
75
77
  # Call
76
78
  response = call(:put, uri, nil, headers, options)
@@ -81,7 +83,7 @@ module Azure::Storage::Blob
81
83
  container.metadata = options[:metadata]
82
84
  container
83
85
  end
84
-
86
+
85
87
  # Public: Returns all properties and metadata on the container.
86
88
  #
87
89
  # ==== Attributes
@@ -93,16 +95,16 @@ module Azure::Storage::Blob
93
95
  #
94
96
  # Accepted key/value pairs in options parameter are:
95
97
  # * +:timeout+ - Integer. A timeout in seconds.
96
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
98
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
97
99
  # in the analytics logs when storage analytics logging is enabled.
98
100
  #
99
101
  # See http://msdn.microsoft.com/en-us/library/azure/dd179370.aspx
100
102
  #
101
103
  # Returns a Container
102
- def get_container_properties(name, options={})
104
+ def get_container_properties(name, options = {})
103
105
  # Query
104
- query = { }
105
- query['timeout'] = options[:timeout].to_s if options[:timeout]
106
+ query = {}
107
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
106
108
 
107
109
  # Call
108
110
  response = call(:get, container_uri(name, query), nil, {}, options)
@@ -112,7 +114,7 @@ module Azure::Storage::Blob
112
114
  container.name = name
113
115
  container
114
116
  end
115
-
117
+
116
118
  # Public: Returns only user-defined metadata for the specified container.
117
119
  #
118
120
  # ==== Attributes
@@ -124,16 +126,16 @@ module Azure::Storage::Blob
124
126
  #
125
127
  # Accepted key/value pairs in options parameter are:
126
128
  # * +:timeout+ - Integer. A timeout in seconds.
127
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
129
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
128
130
  # in the analytics logs when storage analytics logging is enabled.
129
131
  #
130
132
  # See http://msdn.microsoft.com/en-us/library/azure/ee691976.aspx
131
133
  #
132
134
  # Returns a Container
133
- def get_container_metadata(name, options={})
135
+ def get_container_metadata(name, options = {})
134
136
  # Query
135
- query = { 'comp' => 'metadata' }
136
- query['timeout'] = options[:timeout].to_s if options[:timeout]
137
+ query = { "comp" => "metadata" }
138
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
137
139
 
138
140
  # Call
139
141
  response = call(:get, container_uri(name, query), nil, {}, options)
@@ -143,7 +145,7 @@ module Azure::Storage::Blob
143
145
  container.name = name
144
146
  container
145
147
  end
146
-
148
+
147
149
  # Public: Sets custom metadata for the container.
148
150
  #
149
151
  # ==== Attributes
@@ -156,16 +158,16 @@ module Azure::Storage::Blob
156
158
  #
157
159
  # Accepted key/value pairs in options parameter are:
158
160
  # * +:timeout+ - Integer. A timeout in seconds.
159
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
161
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
160
162
  # in the analytics logs when storage analytics logging is enabled.
161
163
  #
162
164
  # See http://msdn.microsoft.com/en-us/library/azure/dd179362.aspx
163
165
  #
164
166
  # Returns nil on success
165
- def set_container_metadata(name, metadata, options={})
167
+ def set_container_metadata(name, metadata, options = {})
166
168
  # Query
167
- query = { 'comp' => 'metadata' }
168
- query['timeout'] = options[:timeout].to_s if options[:timeout]
169
+ query = { "comp" => "metadata" }
170
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
169
171
 
170
172
  # Headers
171
173
  headers = StorageService.common_headers
@@ -173,11 +175,11 @@ module Azure::Storage::Blob
173
175
 
174
176
  # Call
175
177
  call(:put, container_uri(name, query), nil, headers, options)
176
-
178
+
177
179
  # Result
178
180
  nil
179
181
  end
180
-
182
+
181
183
  # Public: Gets the access control list (ACL) and any container-level access policies
182
184
  # for the container.
183
185
  #
@@ -190,7 +192,7 @@ module Azure::Storage::Blob
190
192
  #
191
193
  # Accepted key/value pairs in options parameter are:
192
194
  # * +:timeout+ - Integer. A timeout in seconds.
193
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
195
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
194
196
  # in the analytics logs when storage analytics logging is enabled.
195
197
  #
196
198
  # See http://msdn.microsoft.com/en-us/library/azure/dd179469.aspx
@@ -199,11 +201,11 @@ module Azure::Storage::Blob
199
201
  # container - A Azure::Storage::Entity::Blob::Container instance
200
202
  # signed_identifiers - A list of Azure::Storage::Entity::SignedIdentifier instances
201
203
  #
202
- def get_container_acl(name, options={})
204
+ def get_container_acl(name, options = {})
203
205
  # Query
204
- query = { 'comp' => 'acl' }
205
- query['timeout'] = options[:timeout].to_s if options[:timeout]
206
-
206
+ query = { "comp" => "acl" }
207
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
208
+
207
209
  # Call
208
210
  response = call(:get, container_uri(name, query), nil, {}, options)
209
211
 
@@ -230,26 +232,26 @@ module Azure::Storage::Blob
230
232
  # Accepted key/value pairs in options parameter are:
231
233
  # * +:signed_identifiers+ - Array. A list of Azure::Storage::Entity::SignedIdentifier instances (optional)
232
234
  # * +:timeout+ - Integer. A timeout in seconds.
233
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
235
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
234
236
  # in the analytics logs when storage analytics logging is enabled.
235
- #
237
+ #
236
238
  # See http://msdn.microsoft.com/en-us/library/azure/dd179391.aspx
237
239
  #
238
240
  # Returns a tuple of (container, signed_identifiers)
239
241
  # * +container+ - A Azure::Storage::Entity::Blob::Container instance
240
242
  # * +signed_identifiers+ - A list of Azure::Storage::Entity::SignedIdentifier instances
241
243
  #
242
- def set_container_acl(name, public_access_level, options={})
244
+ def set_container_acl(name, public_access_level, options = {})
243
245
  # Query
244
- query = { 'comp' => 'acl' }
245
- query['timeout'] = options[:timeout].to_s if options[:timeout]
246
+ query = { "comp" => "acl" }
247
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
246
248
 
247
249
  # Scheme + path
248
250
  uri = container_uri(name, query)
249
251
 
250
252
  # Headers + body
251
253
  headers = StorageService.common_headers
252
- headers['x-ms-blob-public-access'] = public_access_level if public_access_level && public_access_level.to_s.length > 0
254
+ headers["x-ms-blob-public-access"] = public_access_level if public_access_level && public_access_level.to_s.length > 0
253
255
 
254
256
  signed_identifiers = nil
255
257
  signed_identifiers = options[:signed_identifiers] if options[:signed_identifiers]
@@ -267,7 +269,7 @@ module Azure::Storage::Blob
267
269
 
268
270
  return container, signed_identifiers || []
269
271
  end
270
-
272
+
271
273
  # Public: Deletes a container.
272
274
  #
273
275
  # ==== Attributes
@@ -279,24 +281,24 @@ module Azure::Storage::Blob
279
281
  #
280
282
  # Accepted key/value pairs in options parameter are:
281
283
  # * +:timeout+ - Integer. A timeout in seconds.
282
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
284
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
283
285
  # in the analytics logs when storage analytics logging is enabled.
284
286
  #
285
287
  # See http://msdn.microsoft.com/en-us/library/azure/dd179408.aspx
286
288
  #
287
289
  # Returns nil on success
288
- def delete_container(name, options={})
290
+ def delete_container(name, options = {})
289
291
  # Query
290
- query = { }
291
- query['timeout'] = options[:timeout].to_s if options[:timeout]
292
+ query = {}
293
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
292
294
 
293
295
  # Call
294
296
  call(:delete, container_uri(name, query), nil, {}, options)
295
-
297
+
296
298
  # result
297
299
  nil
298
300
  end
299
-
301
+
300
302
  # Public: Establishes an exclusive write lock on a container. The lock duration can be 15 to 60 seconds, or can be infinite.
301
303
  # To write to a locked container, a client must provide a lease ID.
302
304
  #
@@ -313,19 +315,19 @@ module Azure::Storage::Blob
313
315
  # * +:proposed_lease_id+ - String. Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request)
314
316
  # if the proposed lease ID is not in the correct format. (optional)
315
317
  # * +:timeout+ - Integer. A timeout in seconds.
316
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
318
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
317
319
  # in the analytics logs when storage analytics logging is enabled.
318
320
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to acquire the lease
319
- # only if the container has been modified since the specified date/time. If the container has not been modified,
321
+ # only if the container has been modified since the specified date/time. If the container has not been modified,
320
322
  # the Blob service returns status code 412 (Precondition Failed).
321
323
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to acquire the lease
322
- # only if the container has not been modified since the specified date/time. If the container has been modified,
324
+ # only if the container has not been modified since the specified date/time. If the container has been modified,
323
325
  # the Blob service returns status code 412 (Precondition Failed).
324
326
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
325
- # only if the container's ETag value matches the value specified. If the values do not match,
327
+ # only if the container's ETag value matches the value specified. If the values do not match,
326
328
  # the Blob service returns status code 412 (Precondition Failed).
327
329
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
328
- # only if the container's ETag value does not match the value specified. If the values are identical,
330
+ # only if the container's ETag value does not match the value specified. If the values are identical,
329
331
  # the Blob service returns status code 412 (Precondition Failed).
330
332
  #
331
333
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
@@ -333,7 +335,7 @@ module Azure::Storage::Blob
333
335
  # Returns a String of the new unique lease id. While the lease is active, you must include the lease ID with any request
334
336
  # to write, or to renew, change, or release the lease.
335
337
  #
336
- def acquire_container_lease(container, options={})
338
+ def acquire_container_lease(container, options = {})
337
339
  acquire_lease container, nil, options
338
340
  end
339
341
 
@@ -352,27 +354,27 @@ module Azure::Storage::Blob
352
354
  #
353
355
  # Accepted key/value pairs in options parameter are:
354
356
  # * +:timeout+ - Integer. A timeout in seconds.
355
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
357
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
356
358
  # in the analytics logs when storage analytics logging is enabled.
357
359
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to renew the lease
358
- # only if the container has been modified since the specified date/time. If the container has not been modified,
360
+ # only if the container has been modified since the specified date/time. If the container has not been modified,
359
361
  # the Blob service returns status code 412 (Precondition Failed).
360
362
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to renew the lease
361
- # only if the container has not been modified since the specified date/time. If the container has been modified,
363
+ # only if the container has not been modified since the specified date/time. If the container has been modified,
362
364
  # the Blob service returns status code 412 (Precondition Failed).
363
365
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
364
- # only if the container's ETag value matches the value specified. If the values do not match,
366
+ # only if the container's ETag value matches the value specified. If the values do not match,
365
367
  # the Blob service returns status code 412 (Precondition Failed).
366
368
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
367
- # only if the container's ETag value does not match the value specified. If the values are identical,
369
+ # only if the container's ETag value does not match the value specified. If the values are identical,
368
370
  # the Blob service returns status code 412 (Precondition Failed).
369
371
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
370
372
  #
371
373
  # Returns the renewed lease id
372
- def renew_container_lease(container, lease, options={})
374
+ def renew_container_lease(container, lease, options = {})
373
375
  renew_lease container, nil, lease, options
374
376
  end
375
-
377
+
376
378
  # Public: Change the lease ID.
377
379
  #
378
380
  # ==== Attributes
@@ -387,24 +389,24 @@ module Azure::Storage::Blob
387
389
  #
388
390
  # Accepted key/value pairs in options parameter are:
389
391
  # * +:timeout+ - Integer. A timeout in seconds.
390
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
392
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
391
393
  # in the analytics logs when storage analytics logging is enabled.
392
394
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to change the lease
393
- # only if the container has been modified since the specified date/time. If the container has not been modified,
395
+ # only if the container has been modified since the specified date/time. If the container has not been modified,
394
396
  # the Blob service returns status code 412 (Precondition Failed).
395
397
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to change the lease
396
- # only if the container has not been modified since the specified date/time. If the container has been modified,
398
+ # only if the container has not been modified since the specified date/time. If the container has been modified,
397
399
  # the Blob service returns status code 412 (Precondition Failed).
398
400
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to change the lease
399
- # only if the container's ETag value matches the value specified. If the values do not match,
401
+ # only if the container's ETag value matches the value specified. If the values do not match,
400
402
  # the Blob service returns status code 412 (Precondition Failed).
401
403
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to change the lease
402
- # only if the container's ETag value does not match the value specified. If the values are identical,
404
+ # only if the container's ETag value does not match the value specified. If the values are identical,
403
405
  # the Blob service returns status code 412 (Precondition Failed).
404
406
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
405
407
  #
406
408
  # Returns the changed lease id
407
- def change_container_lease(container, lease, proposed_lease, options={})
409
+ def change_container_lease(container, lease, proposed_lease, options = {})
408
410
  change_lease container, nil, lease, proposed_lease, options
409
411
  end
410
412
 
@@ -422,24 +424,24 @@ module Azure::Storage::Blob
422
424
  #
423
425
  # Accepted key/value pairs in options parameter are:
424
426
  # * +:timeout+ - Integer. A timeout in seconds.
425
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
427
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
426
428
  # in the analytics logs when storage analytics logging is enabled.
427
429
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to release the lease
428
- # only if the container has been modified since the specified date/time. If the container has not been modified,
430
+ # only if the container has been modified since the specified date/time. If the container has not been modified,
429
431
  # the Blob service returns status code 412 (Precondition Failed).
430
432
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to release the lease
431
- # only if the container has not been modified since the specified date/time. If the container has been modified,
433
+ # only if the container has not been modified since the specified date/time. If the container has been modified,
432
434
  # the Blob service returns status code 412 (Precondition Failed).
433
435
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to release the lease
434
- # only if the container's ETag value matches the value specified. If the values do not match,
436
+ # only if the container's ETag value matches the value specified. If the values do not match,
435
437
  # the Blob service returns status code 412 (Precondition Failed).
436
438
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to release the lease
437
- # only if the container's ETag value does not match the value specified. If the values are identical,
439
+ # only if the container's ETag value does not match the value specified. If the values are identical,
438
440
  # the Blob service returns status code 412 (Precondition Failed).
439
441
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
440
442
  #
441
443
  # Returns nil on success
442
- def release_container_lease(container, lease, options={})
444
+ def release_container_lease(container, lease, options = {})
443
445
  release_lease container, nil, lease, options
444
446
  end
445
447
 
@@ -469,29 +471,29 @@ module Azure::Storage::Blob
469
471
  # If this option is not used, a fixed-duration lease breaks after the remaining lease
470
472
  # period elapses, and an infinite lease breaks immediately.
471
473
  # * +:timeout+ - Integer. A timeout in seconds.
472
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
474
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
473
475
  # in the analytics logs when storage analytics logging is enabled.
474
476
  # * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to break the lease
475
- # only if the container has been modified since the specified date/time. If the container has not been modified,
477
+ # only if the container has been modified since the specified date/time. If the container has not been modified,
476
478
  # the Blob service returns status code 412 (Precondition Failed).
477
479
  # * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to break the lease
478
- # only if the container has not been modified since the specified date/time. If the container has been modified,
480
+ # only if the container has not been modified since the specified date/time. If the container has been modified,
479
481
  # the Blob service returns status code 412 (Precondition Failed).
480
482
  # * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to break the lease
481
- # only if the container's ETag value matches the value specified. If the values do not match,
483
+ # only if the container's ETag value matches the value specified. If the values do not match,
482
484
  # the Blob service returns status code 412 (Precondition Failed).
483
485
  # * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to break the lease
484
- # only if the container's ETag value does not match the value specified. If the values are identical,
486
+ # only if the container's ETag value does not match the value specified. If the values are identical,
485
487
  # the Blob service returns status code 412 (Precondition Failed).
486
488
  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
487
489
  #
488
490
  # Returns an Integer of the remaining lease time. This value is the approximate time remaining in the lease
489
491
  # period, in seconds. This header is returned only for a successful request to break the lease. If the break
490
492
  # is immediate, 0 is returned.
491
- def break_container_lease(container, options={})
493
+ def break_container_lease(container, options = {})
492
494
  break_lease container, nil, options
493
495
  end
494
-
496
+
495
497
  # Public: Get a list of Blobs from the server
496
498
  #
497
499
  # ==== Attributes
@@ -532,7 +534,7 @@ module Azure::Storage::Blob
532
534
  # copy_blob operation should be included in the response.
533
535
  # (optional, Default=false)
534
536
  # * +:timeout+ - Integer. A timeout in seconds.
535
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
537
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
536
538
  # in the analytics logs when storage analytics logging is enabled.
537
539
  #
538
540
  # NOTE: Metadata requested with the :metadata parameter must have been stored in
@@ -547,29 +549,29 @@ module Azure::Storage::Blob
547
549
  # Array (vs a String if it only contains a single value).
548
550
  #
549
551
  # Returns an Azure::Service::EnumerationResults
550
- def list_blobs(name, options={})
552
+ def list_blobs(name, options = {})
551
553
  # Query
552
- query = { 'comp' => 'list' }
553
- query['prefix'] = options[:prefix].gsub(/\\/, '/') if options[:prefix]
554
- query['delimiter'] = options[:delimiter] if options[:delimiter]
555
- query['marker'] = options[:marker] if options[:marker]
556
- query['maxresults'] = options[:max_results].to_s if options[:max_results]
557
- query['timeout'] = options[:timeout].to_s if options[:timeout]
554
+ query = { "comp" => "list" }
555
+ query["prefix"] = options[:prefix].gsub(/\\/, "/") if options[:prefix]
556
+ query["delimiter"] = options[:delimiter] if options[:delimiter]
557
+ query["marker"] = options[:marker] if options[:marker]
558
+ query["maxresults"] = options[:max_results].to_s if options[:max_results]
559
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
558
560
 
559
561
  included_datasets = []
560
- included_datasets.push('metadata') if options[:metadata] == true
561
- included_datasets.push('snapshots') if options[:snapshots] == true
562
- included_datasets.push('uncommittedblobs') if options[:uncommittedblobs] == true
563
- included_datasets.push('copy') if options[:copy] == true
562
+ included_datasets.push("metadata") if options[:metadata] == true
563
+ included_datasets.push("snapshots") if options[:snapshots] == true
564
+ included_datasets.push("uncommittedblobs") if options[:uncommittedblobs] == true
565
+ included_datasets.push("copy") if options[:copy] == true
564
566
 
565
- query['include'] = included_datasets.join ',' if included_datasets.length > 0
567
+ query["include"] = included_datasets.join "," if included_datasets.length > 0
566
568
 
567
569
  # Scheme + path
568
570
  uri = container_uri(name, query)
569
-
571
+
570
572
  # Call
571
573
  response = call(:get, uri, nil, {}, options)
572
-
574
+
573
575
  # Result
574
576
  if response.success?
575
577
  Serialization.blob_enumeration_results_from_xml(response.body)
@@ -577,6 +579,5 @@ module Azure::Storage::Blob
577
579
  response.exception
578
580
  end
579
581
  end
580
-
581
582
  end
582
- end
583
+ end