Module: Azure::Storage::Blob::Container
- Includes:
- Common::Service
- Included in:
- BlobService
- Defined in:
- blob/lib/azure/storage/blob/container.rb
Defined Under Namespace
Classes: Container
Instance Method Summary collapse
-
#acquire_container_lease(container, options = {}) ⇒ Object
Public: Establishes an exclusive write lock on a container.
-
#break_container_lease(container, options = {}) ⇒ Object
Public: Breaks the lease, if the container has an active lease.
-
#change_container_lease(container, lease, proposed_lease, options = {}) ⇒ Object
Public: Change the lease ID.
-
#create_container(name, options = {}) ⇒ Object
Public: Create a new container.
-
#delete_container(name, options = {}) ⇒ Object
Public: Deletes a container.
-
#get_container_acl(name, options = {}) ⇒ Object
Public: Gets the access control list (ACL) and any container-level access policies for the container.
-
#get_container_metadata(name, options = {}) ⇒ Object
Public: Returns only user-defined metadata for the specified container.
-
#get_container_properties(name, options = {}) ⇒ Object
Public: Returns all properties and metadata on the container.
-
#list_blobs(name, options = {}) ⇒ Object
Public: Get a list of Blobs from the server.
-
#release_container_lease(container, lease, options = {}) ⇒ Object
Public: Releases the lease.
-
#renew_container_lease(container, lease, options = {}) ⇒ Object
Public: Renews the lease.
-
#set_container_acl(name, public_access_level, options = {}) ⇒ Object
Public: Sets the ACL and any container-level access policies for the container.
-
#set_container_metadata(name, metadata, options = {}) ⇒ Object
Public: Sets custom metadata for the container.
Instance Method Details
#acquire_container_lease(container, options = {}) ⇒ Object
Public: Establishes an exclusive write lock on a container. The lock duration can be 15 to 60 seconds, or can be infinite. To write to a locked container, a client must provide a lease ID.
Attributes
-
container
- String. The container name. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:duration
- Integer. Default -1. Specifies the duration of the lease, in seconds, or negative one (-1)for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. (optional)
-
:proposed_lease_id
- String. Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request)if the proposed lease ID is not in the correct format. (optional)
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:if_modified_since
- String. A DateTime value. Specify this conditional header to acquire the leaseonly if the container has been modified since the specified date/time. If the container has not been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_unmodified_since
- String. A DateTime value. Specify this conditional header to acquire the leaseonly if the container has not been modified since the specified date/time. If the container has been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_match
- String. An ETag value. Specify an ETag value for this conditional header to acquire the leaseonly if the container's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed).
-
:if_none_match
- String. An ETag value. Specify an ETag value for this conditional header to acquire the leaseonly if the container's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed).
-
:origin
- String. Optional. Specifies the origin from which the request is issued. The presence of this header resultsin cross-origin resource sharing headers on the response.
See msdn.microsoft.com/en-us/library/azure/ee691972.aspx
Returns a String of the new unique lease id. While the lease is active, you must include the lease ID with any request to write, or to renew, change, or release the lease.
378 379 380 |
# File 'blob/lib/azure/storage/blob/container.rb', line 378 def acquire_container_lease(container, = {}) acquire_lease container, nil, end |
#break_container_lease(container, options = {}) ⇒ Object
Public: Breaks the lease, if the container has an active lease. Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the container. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.
A lease that has been broken can also be released, in which case another client may immediately acquire the lease on the container.
Attributes
-
container
- String. The container name. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:break_period
- Integer. The proposed duration of seconds that the lease should continue before it isbroken, between 0 and 60 seconds. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this option is not used, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately.
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:if_modified_since
- String. A DateTime value. Specify this conditional header to break the leaseonly if the container has been modified since the specified date/time. If the container has not been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_unmodified_since
- String. A DateTime value. Specify this conditional header to break the leaseonly if the container has not been modified since the specified date/time. If the container has been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_match
- String. An ETag value. Specify an ETag value for this conditional header to break the leaseonly if the container's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed).
-
:if_none_match
- String. An ETag value. Specify an ETag value for this conditional header to break the leaseonly if the container's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed).
-
:origin
- String. Optional. Specifies the origin from which the request is issued. The presence of this header resultsin cross-origin resource sharing headers on the response.
See msdn.microsoft.com/en-us/library/azure/ee691972.aspx
Returns an Integer of the remaining lease time. This value is the approximate time remaining in the lease period, in seconds. This header is returned only for a successful request to break the lease. If the break is immediate, 0 is returned.
541 542 543 |
# File 'blob/lib/azure/storage/blob/container.rb', line 541 def break_container_lease(container, = {}) break_lease container, nil, end |
#change_container_lease(container, lease, proposed_lease, options = {}) ⇒ Object
Public: Change the lease ID.
Attributes
-
container
- String. The container name. -
lease
- String. The existing lease id. -
proposed_lease
- String. Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request)if the proposed lease ID is not in the correct format. (optional).
-
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:if_modified_since
- String. A DateTime value. Specify this conditional header to change the leaseonly if the container has been modified since the specified date/time. If the container has not been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_unmodified_since
- String. A DateTime value. Specify this conditional header to change the leaseonly if the container has not been modified since the specified date/time. If the container has been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_match
- String. An ETag value. Specify an ETag value for this conditional header to change the leaseonly if the container's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed).
-
:if_none_match
- String. An ETag value. Specify an ETag value for this conditional header to change the leaseonly if the container's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed).
-
:origin
- String. Optional. Specifies the origin from which the request is issued. The presence of this header resultsin cross-origin resource sharing headers on the response.
See msdn.microsoft.com/en-us/library/azure/ee691972.aspx
Returns the changed lease id
453 454 455 |
# File 'blob/lib/azure/storage/blob/container.rb', line 453 def change_container_lease(container, lease, proposed_lease, = {}) change_lease container, nil, lease, proposed_lease, end |
#create_container(name, options = {}) ⇒ Object
Public: Create a new container
Attributes
-
name
- String. The name of the container. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:metadata
- Hash. User defined metadata for the container (optional). -
:public_access_level
- String. One of “container” or “blob” (optional). -
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
See msdn.microsoft.com/en-us/library/azure/dd179468.aspx
Returns a Container
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'blob/lib/azure/storage/blob/container.rb', line 63 def create_container(name, = {}) # Query query = {} query["timeout"] = [:timeout].to_s if [:timeout] # Scheme + path uri = container_uri(name, query) # Headers headers = {} StorageService.([:metadata], headers) if [:metadata] headers["x-ms-blob-public-access"] = [:public_access_level].to_s if [:public_access_level] # Call response = call(:put, uri, nil, headers, ) # result container = Serialization.container_from_headers(response.headers) container.name = name container. = [:metadata] container end |
#delete_container(name, options = {}) ⇒ Object
Public: Deletes a container.
Attributes
-
name
- String. The name of the container. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:lease_id
- String. Required for version 2012-02-12 and newer if the container has an active lease. To callDelete Container on a container that has an active lease, specify the lease ID in this header. If this header is not specified when there is an active lease, Delete Container will return 409 (Conflict). If you specify the wrong lease ID, or a lease ID on a container that does not have an active lease, Delete Container will return 412 (Precondition failed).
See msdn.microsoft.com/en-us/library/azure/dd179408.aspx
Returns nil on success
326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'blob/lib/azure/storage/blob/container.rb', line 326 def delete_container(name, = {}) # Query query = {} query["timeout"] = [:timeout].to_s if [:timeout] headers = [:lease_id] ? { "x-ms-lease-id" => [:lease_id] } : {} # Call call(:delete, container_uri(name, query), nil, headers, ) # result nil end |
#get_container_acl(name, options = {}) ⇒ Object
Public: Gets the access control list (ACL) and any container-level access policies for the container.
Attributes
-
name
- String. The name of the container -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:location_mode
- LocationMode. Specifies the location mode used to decidewhich location the request should be sent to.
-
:lease_id
- String. If specified, Get Container ACL only succeeds if the container’s lease isactive and matches this ID. If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned.
See msdn.microsoft.com/en-us/library/azure/dd179469.aspx
Returns a tuple of (container, signed_identifiers)
container - A Azure::Storage::Entity::Blob::Container instance
signed_identifiers - A list of Azure::Storage::Entity::SignedIdentifier instances
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'blob/lib/azure/storage/blob/container.rb', line 228 def get_container_acl(name, = {}) # Query query = { "comp" => "acl" } query["timeout"] = [:timeout].to_s if [:timeout] headers = [:lease_id] ? { "x-ms-lease-id" => [:lease_id] } : {} # Call [:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY response = call(:get, container_uri(name, query, ), nil, headers, ) # Result container = Serialization.container_from_headers(response.headers) container.name = name signed_identifiers = nil signed_identifiers = Serialization.signed_identifiers_from_xml(response.body) if response.body != nil && response.body.length > 0 return container, signed_identifiers end |
#get_container_metadata(name, options = {}) ⇒ Object
Public: Returns only user-defined metadata for the specified container.
Attributes
-
name
- String. The name of the container -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:location_mode
- LocationMode. Specifies the location mode used to decidewhich location the request should be sent to.
-
:lease_id
- String. If specified, Get Container Metadata only succeeds if the container’s lease isactive and matches this ID. If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned.
See msdn.microsoft.com/en-us/library/azure/ee691976.aspx
Returns a Container
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'blob/lib/azure/storage/blob/container.rb', line 147 def (name, = {}) # Query query = { "comp" => "metadata" } query["timeout"] = [:timeout].to_s if [:timeout] headers = [:lease_id] ? { "x-ms-lease-id" => [:lease_id] } : {} # Call [:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY response = call(:get, container_uri(name, query, ), nil, headers, ) # result container = Serialization.container_from_headers(response.headers) container.name = name container end |
#get_container_properties(name, options = {}) ⇒ Object
Public: Returns all properties and metadata on the container.
Attributes
-
name
- String. The name of the container -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:location_mode
- LocationMode. Specifies the location mode used to decidewhich location the request should be sent to.
-
:lease_id
- String. If specified, Get Container Properties only succeeds if the container’s lease isactive and matches this ID. If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned.
See msdn.microsoft.com/en-us/library/azure/dd179370.aspx
Returns a Container
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'blob/lib/azure/storage/blob/container.rb', line 108 def get_container_properties(name, = {}) # Query query = {} query["timeout"] = [:timeout].to_s if [:timeout] headers = [:lease_id] ? { "x-ms-lease-id" => [:lease_id] } : {} # Call [:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY response = call(:get, container_uri(name, query, ), nil, headers, ) # result container = Serialization.container_from_headers(response.headers) container.name = name container end |
#list_blobs(name, options = {}) ⇒ Object
Public: Get a list of Blobs from the server
Attributes
-
name
- String. The name of the container to list blobs for. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:prefix
- String. Filters the results to return only blobswhose name begins with the specified prefix. (optional)
-
:delimiter
- String. When the request includes this parameter, the operationreturns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string.
-
:marker
- String. An identifier that specifies the portion of thelist to be returned. This value comes from the property Azure::Storage::Common::EnumerationResults.continuation_token when there are more blobs available than were returned. The marker value may then be used here to request the next set of list items. (optional)
-
:max_results
- Integer. Specifies the maximum number of blobs to return.If max_results is not specified, or is a value greater than 5,000, the server will return up to 5,000 items. If it is set to a value less than or equal to zero, the server will return status code 400 (Bad Request). (optional)
-
:metadata
- Boolean. Specifies whether or not to return the blob metadata.(optional, Default=false)
-
:snapshots
- Boolean. Specifies that snapshots should be included in theenumeration. Snapshots are listed from oldest to newest in the response. (optional, Default=false)
-
:uncomittedblobs
- Boolean. Specifies that blobs for which blocks have been uploaded,but which have not been committed using put_block_list, be included in the response. (optional, Default=false)
-
:copy
- Boolean. Specifies that metadata related to any current or previouscopy_blob operation should be included in the response. (optional, Default=false)
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:location_mode
- LocationMode. Specifies the location mode used to decidewhich location the request should be sent to.
NOTE: Metadata requested with the :metadata parameter must have been stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Blob service. Beginning with that version, all metadata names must adhere to the naming conventions for C# identifiers.
See: msdn.microsoft.com/en-us/library/azure/dd135734.aspx
Any metadata with invalid names which were previously stored, will be returned with the key “x-ms-invalid-name” in the metadata hash. This may contain multiple values and be an Array (vs a String if it only contains a single value).
Returns an Azure::Storage::Common::EnumerationResults
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'blob/lib/azure/storage/blob/container.rb', line 602 def list_blobs(name, = {}) # Query query = { "comp" => "list" } query["prefix"] = [:prefix].gsub(/\\/, "/") if [:prefix] query["delimiter"] = [:delimiter] if [:delimiter] query["marker"] = [:marker] if [:marker] query["maxresults"] = [:max_results].to_s if [:max_results] query["timeout"] = [:timeout].to_s if [:timeout] included_datasets = [] included_datasets.push("metadata") if [:metadata] == true included_datasets.push("snapshots") if [:snapshots] == true included_datasets.push("uncommittedblobs") if [:uncommittedblobs] == true included_datasets.push("copy") if [:copy] == true query["include"] = included_datasets.join "," if included_datasets.length > 0 # Scheme + path [:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY uri = container_uri(name, query, ) # Call response = call(:get, uri, nil, {}, ) # Result if response.success? Serialization.blob_enumeration_results_from_xml(response.body) else response.exception end end |
#release_container_lease(container, lease, options = {}) ⇒ Object
Public: Releases the lease. The lease may be released if the lease ID specified on the request matches that associated with the container. Releasing the lease allows another client to immediately acquire the lease for the container as soon as the release is complete.
Attributes
-
container
- String. The container name. -
lease
- String. The lease id. -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:if_modified_since
- String. A DateTime value. Specify this conditional header to release the leaseonly if the container has been modified since the specified date/time. If the container has not been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_unmodified_since
- String. A DateTime value. Specify this conditional header to release the leaseonly if the container has not been modified since the specified date/time. If the container has been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_match
- String. An ETag value. Specify an ETag value for this conditional header to release the leaseonly if the container's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed).
-
:if_none_match
- String. An ETag value. Specify an ETag value for this conditional header to release the leaseonly if the container's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed).
-
:origin
- String. Optional. Specifies the origin from which the request is issued. The presence of this header resultsin cross-origin resource sharing headers on the response.
See msdn.microsoft.com/en-us/library/azure/ee691972.aspx
Returns nil on success
490 491 492 |
# File 'blob/lib/azure/storage/blob/container.rb', line 490 def release_container_lease(container, lease, = {}) release_lease container, nil, lease, end |
#renew_container_lease(container, lease, options = {}) ⇒ Object
Public: Renews the lease. The lease can be renewed if the lease ID specified on the request matches that associated with the container. Note that the lease may be renewed even if it has expired as long as the container has not been modified or leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.
Attributes
-
container
- String. The container name. -
lease
- String. The lease id -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:if_modified_since
- String. A DateTime value. Specify this conditional header to renew the leaseonly if the container has been modified since the specified date/time. If the container has not been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_unmodified_since
- String. A DateTime value. Specify this conditional header to renew the leaseonly if the container has not been modified since the specified date/time. If the container has been modified, the Blob service returns status code 412 (Precondition Failed).
-
:if_match
- String. An ETag value. Specify an ETag value for this conditional header to renew the leaseonly if the container's ETag value matches the value specified. If the values do not match, the Blob service returns status code 412 (Precondition Failed).
-
:if_none_match
- String. An ETag value. Specify an ETag value for this conditional header to renew the leaseonly if the container's ETag value does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed).
-
:origin
- String. Optional. Specifies the origin from which the request is issued. The presence of this header resultsin cross-origin resource sharing headers on the response.
See msdn.microsoft.com/en-us/library/azure/ee691972.aspx
Returns the renewed lease id
416 417 418 |
# File 'blob/lib/azure/storage/blob/container.rb', line 416 def renew_container_lease(container, lease, = {}) renew_lease container, nil, lease, end |
#set_container_acl(name, public_access_level, options = {}) ⇒ Object
Public: Sets the ACL and any container-level access policies for the container.
Attributes
-
name
- String. The name of the container -
public_access_level
- String. The container public access level -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:signed_identifiers
- Array. A list of Azure::Storage::Entity::SignedIdentifier instances (optional) -
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:lease_id
- String. If specified, Set Container ACL only succeeds if the container’s lease isactive and matches this ID. If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned.
See msdn.microsoft.com/en-us/library/azure/dd179391.aspx
Returns a tuple of (container, signed_identifiers)
-
container
- A Azure::Storage::Entity::Blob::Container instance -
signed_identifiers
- A list of Azure::Storage::Entity::SignedIdentifier instances
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'blob/lib/azure/storage/blob/container.rb', line 274 def set_container_acl(name, public_access_level, = {}) # Query query = { "comp" => "acl" } query["timeout"] = [:timeout].to_s if [:timeout] # Scheme + path uri = container_uri(name, query) # Headers + body headers = {} headers["x-ms-blob-public-access"] = public_access_level if public_access_level && public_access_level.to_s.length > 0 headers["x-ms-lease-id"] = [:lease_id] if [:lease_id] signed_identifiers = nil signed_identifiers = [:signed_identifiers] if [:signed_identifiers] body = nil body = Serialization.signed_identifiers_to_xml(signed_identifiers) if signed_identifiers # Call response = call(:put, uri, body, headers, ) # Result container = Serialization.container_from_headers(response.headers) container.name = name container.public_access_level = public_access_level return container, signed_identifiers || [] end |
#set_container_metadata(name, metadata, options = {}) ⇒ Object
Public: Sets custom metadata for the container.
Attributes
-
name
- String. The name of the container -
metadata
- Hash. A Hash of the metadata values -
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:timeout
- Integer. A timeout in seconds. -
:request_id
- String. Provides a client-generated, opaque value with a 1 KB character limit that is recordedin the analytics logs when storage analytics logging is enabled.
-
:lease_id
- String. If specified, Set Container Metadata only succeeds if the container’s lease isactive and matches this ID. If there is no active lease or the ID does not match, 412 (Precondition Failed) is returned.
See msdn.microsoft.com/en-us/library/azure/dd179362.aspx
Returns nil on success
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'blob/lib/azure/storage/blob/container.rb', line 185 def (name, , = {}) # Query query = { "comp" => "metadata" } query["timeout"] = [:timeout].to_s if [:timeout] # Headers headers = {} StorageService.(, headers) if headers["x-ms-lease-id"] = [:lease_id] if [:lease_id] # Call call(:put, container_uri(name, query), nil, headers, ) # Result nil end |