Service/WindowsAzure/Storage/Blob.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- name_todo
- Package
- Zend_Service_WindowsAzure
- Subpackage
- Storage
- Version
- $Id$
\Zend_Service_WindowsAzure_Storage_Blob
- Parent(s)
- \Zend_Service_WindowsAzure_Storage
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
ACL_PUBLIC
= 'container'- Deprecated
- Use ACL_PUBLIC_CONTAINER or ACL_PUBLIC_BLOB instead.
Properties

\Zend_Service_WindowsAzure_Credentials_SharedAccessSignature $_sharedAccessSignatureCredentials = nullnullDetailsMethods

__construct(string $host = \Zend_Service_WindowsAzure_Storage::URL_DEV_BLOB, string $accountName = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, string $accountKey = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, boolean $usePathStyleUri = false, \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) : voidCreates a new Zend_Service_WindowsAzure_Storage_Blob instance
| Name | Type | Description |
|---|---|---|
| $host | string | Storage host name |
| $accountName | string | Account name for Windows Azure |
| $accountKey | string | Account key for Windows Azure |
| $usePathStyleUri | boolean | Use path-style URI's |
| $retryPolicy | \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract | Retry policy to use when making requests |

_generateBlockId(int $part = 0) : stringGenerate block id
| Name | Type | Description |
|---|---|---|
| $part | int | Block number |
| Type | Description |
|---|---|
| string | Windows Azure Blob Storage block number |

_getErrorMessage(\Zend_Http_Response $response, string $alternativeError = 'Unknown error.') : stringGet error message from Zend_Http_Response
| Name | Type | Description |
|---|---|---|
| $response | \Zend_Http_Response | Repsonse |
| $alternativeError | string | Alternative error message |
| Type | Description |
|---|---|
| string |

blobExists(string $containerName = '', string $blobName = '', string $snapshotId = null) : booleanCheck if a blob exists
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| Type | Description |
|---|---|
| boolean |

containerExists(string $containerName = '') : booleanCheck if a container exists
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| Type | Description |
|---|---|
| boolean |

copyBlob(string $sourceContainerName = '', string $sourceBlobName = '', string $destinationContainerName = '', string $destinationBlobName = '', array $metadata = array(), string $sourceSnapshotId = null, string $destinationLeaseId = null, array $additionalHeaders = array()) : objectCopy blob
| Name | Type | Description |
|---|---|---|
| $sourceContainerName | string | Source container name |
| $sourceBlobName | string | Source blob name |
| $destinationContainerName | string | Destination container name |
| $destinationBlobName | string | Destination blob name |
| $metadata | array | Key/value pairs of meta data |
| $sourceSnapshotId | string | Source snapshot identifier |
| $destinationLeaseId | string | Destination lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd894037.aspx for more information. |
| Type | Description |
|---|---|
| object | Partial blob properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

createContainer(string $containerName = '', array $metadata = array()) : objectCreate container
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $metadata | array | Key/value pairs of meta data |
| Type | Description |
|---|---|
| object | Container properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

createContainerIfNotExists(string $containerName = '', array $metadata = array()) : voidCreate container if it does not exist
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $metadata | array | Key/value pairs of meta data |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

createPageBlob(string $containerName = '', string $blobName = '', int $size = 0, array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : objectCreate page blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $size | int | Size of the page blob in bytes |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| object | Partial blob properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

createResourceName(string $containerName = '', string $blobName = '') : stringCreate resource name
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| Type | Description |
|---|---|
| string |

deleteBlob(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : voidDelete blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

deleteContainer(string $containerName = '', array $additionalHeaders = array()) : voidDelete container
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

generateSharedAccessUrl(string $containerName = '', string $blobName = '', string $resource = 'b', string $permissions = 'r', string $start = '', string $expiry = '', string $identifier = '') : stringGenerate shared access URL
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $resource | string | Signed resource - container (c) - blob (b) |
| $permissions | string | Signed permissions - read (r), write (w), delete (d) and list (l) |
| $start | string | The time at which the Shared Access Signature becomes valid. |
| $expiry | string | The time at which the Shared Access Signature becomes invalid. |
| $identifier | string | Signed identifier |
| Type | Description |
|---|---|
| string |

getBlob(string $containerName = '', string $blobName = '', string $localFileName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : voidGet blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $localFileName | string | Local file name to store downloaded blob |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getBlobData(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : mixedGet blob data
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| mixed | Blob contents |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getBlobInstance(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : \Zend_Service_WindowsAzure_Storage_BlobInstanceGet blob instance
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_BlobInstance |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getBlobMetadata(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null) : arrayGet blob metadata
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| Type | Description |
|---|---|
| array | Key/value pairs of meta data |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getBlobProperties(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null) : \Zend_Service_WindowsAzure_Storage_BlobInstanceGet blob properties
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_BlobInstance |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getBlockList(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, integer $type = 0) : arrayGet block list
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $snapshotId | string | Snapshot identifier |
| $leaseId | string | Lease identifier |
| $type | integer | Type of block list to retrieve. 0 = all, 1 = committed, 2 = uncommitted |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getContainer(string $containerName = '') : \Zend_Service_WindowsAzure_Storage_BlobContainerGet container
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_BlobContainer |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getContainerAcl(string $containerName = '', bool $signedIdentifiers = false) : stringGet container ACL
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $signedIdentifiers | bool | Display only private/blob/container or display signed identifiers? |
| Type | Description |
|---|---|
| string | Acl, to be compared with Zend_Service_WindowsAzure_Storage_Blob::ACL_* |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getContainerMetadata(string $containerName = '') : arrayGet container metadata
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| Type | Description |
|---|---|
| array | Key/value pairs of meta data |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getPageRegions(string $containerName = '', string $blobName = '', int $startByteOffset = 0, int $endByteOffset = 0, string $leaseId = null) : arrayPut page in page blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $startByteOffset | int | Start byte offset |
| $endByteOffset | int | End byte offset |
| $leaseId | string | Lease identifier |
| Type | Description |
|---|---|
| array | Array of page ranges |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

getWrapperClient(string $name) : \Zend_Service_WindowsAzure_Storage_BlobGet wrapper client for stream type
| Name | Type | Description |
|---|---|---|
| $name | string | Protocol name |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_Blob |

isValidContainerName(string $containerName = '') : booleanIs valid container name?
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| Type | Description |
|---|---|
| boolean |

leaseBlob(string $containerName = '', string $blobName = '', string $leaseAction = self::LEASE_ACQUIRE, string $leaseId = null) : \Zend_Service_WindowsAzure_Storage_LeaseInstanceLease blob - See (http://msdn.microsoft.com/en-us/library/ee691972.aspx)
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $leaseAction | string | Lease action (Zend_Service_WindowsAzure_Storage_Blob::LEASE_*) |
| $leaseId | string | Lease identifier, required to renew the lease or to release the lease. |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_LeaseInstance | Lease instance |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

listBlobs(string $containerName = '', string $prefix = '', string $delimiter = '', int $maxResults = null, string $marker = null, string $include = null, int $currentResultCount = 0) : arrayList blobs
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $prefix | string | Optional. Filters the results to return only blobs whose name begins with the specified prefix. |
| $delimiter | string | Optional. Delimiter, i.e. '/', for specifying folder hierarchy |
| $maxResults | int | Optional. Specifies the maximum number of blobs to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000) |
| $marker | string | Optional string value that identifies the portion of the list to be returned with the next list operation. |
| $include | string | Optional. Specifies that the response should include one or more of the following subsets: '', 'metadata', 'snapshots', 'uncommittedblobs'). Multiple values can be added separated with a comma (,) |
| $currentResultCount | int | Current result count (internal use) |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

listContainers(string $prefix = null, int $maxResults = null, string $marker = null, string $include = null, int $currentResultCount = 0) : arrayList containers
| Name | Type | Description |
|---|---|---|
| $prefix | string | Optional. Filters the results to return only containers whose name begins with the specified prefix. |
| $maxResults | int | Optional. Specifies the maximum number of containers to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000) |
| $marker | string | Optional string value that identifies the portion of the list to be returned with the next list operation. |
| $include | string | Optional. Include this parameter to specify that the container's metadata be returned as part of the response body. (allowed values: '', 'metadata') |
| $currentResultCount | int | Current result count (internal use) |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putBlob(string $containerName = '', string $blobName = '', string $localFileName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : objectPut blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $localFileName | string | Local file name to be uploaded |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| object | Partial blob properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putBlobData(string $containerName = '', string $blobName = '', mixed $data = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : objectPut blob data
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $data | mixed | Data to store |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| object | Partial blob properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putBlock(string $containerName = '', string $blobName = '', string $identifier = '', array $contents = '', string $leaseId = null) : voidPut large blob block
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $identifier | string | Block ID |
| $contents | array | Contents of the block |
| $leaseId | string | Lease identifier |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putBlockList(string $containerName = '', string $blobName = '', array $blockList = array(), array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : voidPut block list
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $blockList | array | Array of block identifiers |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putLargeBlob(string $containerName = '', string $blobName = '', string $localFileName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : objectPut large blob (> 64 MB)
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $localFileName | string | Local file name to be uploaded |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| object | Partial blob properties |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

putPage(string $containerName = '', string $blobName = '', int $startByteOffset = 0, int $endByteOffset = 0, mixed $contents = '', string $writeMethod = self::PAGE_WRITE_UPDATE, string $leaseId = null, array $additionalHeaders = array()) : voidPut page in page blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $startByteOffset | int | Start byte offset |
| $endByteOffset | int | End byte offset |
| $contents | mixed | Page contents |
| $writeMethod | string | Write method (Zend_Service_WindowsAzure_Storage_Blob::PAGE_WRITE_*) |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

registerAsClient(string $name) : \Zend_Service_WindowsAzure_Storage_BlobRegister this object as stream wrapper client
| Name | Type | Description |
|---|---|---|
| $name | string | Protocol name |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_Blob |

registerStreamWrapper(string $name = 'azure') : voidRegister this object as stream wrapper
| Name | Type | Description |
|---|---|---|
| $name | string | Protocol name |

setBlobMetadata(string $containerName = '', string $blobName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : voidSet blob metadata
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $metadata | array | Key/value pairs of meta data |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

setBlobProperties(string $containerName = '', string $blobName = '', string $leaseId = null, array $additionalHeaders = array()) : voidSet blob properties
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $leaseId | string | Lease identifier |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

setContainerAcl(string $containerName = '', bool $acl = self::ACL_PRIVATE, array $signedIdentifiers = array()) : voidSet container ACL
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $acl | bool | Zend_Service_WindowsAzure_Storage_Blob::ACL_* |
| $signedIdentifiers | array | Signed identifiers |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

setContainerMetadata(string $containerName = '', array $metadata = array(), array $additionalHeaders = array()) : voidSet container metadata
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $metadata | array | Key/value pairs of meta data |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

snapshotBlob(string $containerName = '', string $blobName = '', array $metadata = array(), array $additionalHeaders = array()) : stringSnapshot blob
| Name | Type | Description |
|---|---|---|
| $containerName | string | Container name |
| $blobName | string | Blob name |
| $metadata | array | Key/value pairs of meta data |
| $additionalHeaders | array | Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information. |
| Type | Description |
|---|---|
| string | Date/Time value representing the snapshot identifier. |
| Exception | Description |
|---|---|
| \Zend_Service_WindowsAzure_Exception |

unregisterAsClient(string $name) : \Zend_Service_WindowsAzure_Storage_BlobUnregister this object as stream wrapper client
| Name | Type | Description |
|---|---|---|
| $name | string | Protocol name |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_Blob |

unregisterStreamWrapper(string $name = 'azure') : \Zend_Service_WindowsAzure_Storage_BlobUnregister this object as stream wrapper
| Name | Type | Description |
|---|---|---|
| $name | string | Protocol name |
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_Blob |