Service/WindowsAzure/Storage/Blob.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
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

Package: Zend_Service_WindowsAzure\Storage
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

>VConstant  ACL_PRIVATE = null
ACL - Private access
>VConstant  ACL_PUBLIC = 'container'
ACL - Public access (read all blobs)
Deprecated
Use ACL_PUBLIC_CONTAINER or ACL_PUBLIC_BLOB instead.  
>VConstant  ACL_PUBLIC_BLOB = 'blob'
ACL - Blob Public access (read all blobs)
>VConstant  ACL_PUBLIC_CONTAINER = 'container'
ACL - Container Public access (enumerate and read all blobs)
>VConstant  LEASE_ACQUIRE = 'acquire'
Blob lease constants
>VConstant  LEASE_RENEW = 'renew'
>VConstant  LEASE_RELEASE = 'release'
>VConstant  LEASE_BREAK = 'break'
>VConstant  MAX_BLOB_SIZE = 67108864
Maximal blob size (in bytes)
>VConstant  MAX_BLOB_TRANSFER_SIZE = 4194304
Maximal blob transfer size (in bytes)
>VConstant  BLOBTYPE_BLOCK = 'BlockBlob'
Blob types
>VConstant  BLOBTYPE_PAGE = 'PageBlob'
>VConstant  PAGE_WRITE_UPDATE = 'update'
Put page write options
>VConstant  PAGE_WRITE_CLEAR = 'clear'

Properties

>VPropertyprotected\Zend_Service_WindowsAzure_Credentials_SharedAccessSignature $_sharedAccessSignatureCredentials = null
SharedAccessSignature credentials
>VPropertyprotectedarray $_wrapperClients = array()
static
Stream wrapper clients
Default valuearray()Details
Type
array

Methods

methodpublic__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) : void

Creates a new Zend_Service_WindowsAzure_Storage_Blob instance

Parameters
NameTypeDescription
$hoststring

Storage host name

$accountNamestring

Account name for Windows Azure

$accountKeystring

Account key for Windows Azure

$usePathStyleUriboolean

Use path-style URI's

$retryPolicy\Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract

Retry policy to use when making requests

methodprotected_generateBlockId(int $part = 0) : string

Generate block id

Parameters
NameTypeDescription
$partint

Block number

Returns
TypeDescription
stringWindows Azure Blob Storage block number
methodprotected_getErrorMessage(\Zend_Http_Response $response, string $alternativeError = 'Unknown error.') : string

Get error message from Zend_Http_Response

Parameters
NameTypeDescription
$response\Zend_Http_Response

Repsonse

$alternativeErrorstring

Alternative error message

Returns
TypeDescription
string
methodpublicblobExists(string $containerName = '', string $blobName = '', string $snapshotId = null) : boolean

Check if a blob exists

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

Returns
TypeDescription
boolean
methodpubliccontainerExists(string $containerName = '') : boolean

Check if a container exists

Parameters
NameTypeDescription
$containerNamestring

Container name

Returns
TypeDescription
boolean
methodpubliccopyBlob(string $sourceContainerName = '', string $sourceBlobName = '', string $destinationContainerName = '', string $destinationBlobName = '', array $metadata = array(), string $sourceSnapshotId = null, string $destinationLeaseId = null, array $additionalHeaders = array()) : object

Copy blob

Parameters
NameTypeDescription
$sourceContainerNamestring

Source container name

$sourceBlobNamestring

Source blob name

$destinationContainerNamestring

Destination container name

$destinationBlobNamestring

Destination blob name

$metadataarray

Key/value pairs of meta data

$sourceSnapshotIdstring

Source snapshot identifier

$destinationLeaseIdstring

Destination lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd894037.aspx for more information.

Returns
TypeDescription
objectPartial blob properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliccreateContainer(string $containerName = '', array $metadata = array()) : object

Create container

Parameters
NameTypeDescription
$containerNamestring

Container name

$metadataarray

Key/value pairs of meta data

Returns
TypeDescription
objectContainer properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliccreateContainerIfNotExists(string $containerName = '', array $metadata = array()) : void

Create container if it does not exist

Parameters
NameTypeDescription
$containerNamestring

Container name

$metadataarray

Key/value pairs of meta data

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliccreatePageBlob(string $containerName = '', string $blobName = '', int $size = 0, array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : object

Create page blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$sizeint

Size of the page blob in bytes

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
objectPartial blob properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliccreateResourceName(string $containerName = '', string $blobName = '') : string
static

Create resource name

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

Returns
TypeDescription
string
methodpublicdeleteBlob(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : void

Delete blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicdeleteContainer(string $containerName = '', array $additionalHeaders = array()) : void

Delete container

Parameters
NameTypeDescription
$containerNamestring

Container name

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgenerateSharedAccessUrl(string $containerName = '', string $blobName = '', string $resource = 'b', string $permissions = 'r', string $start = '', string $expiry = '', string $identifier = '') : string

Generate shared access URL

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$resourcestring

Signed resource - container (c) - blob (b)

$permissionsstring

Signed permissions - read (r), write (w), delete (d) and list (l)

$startstring

The time at which the Shared Access Signature becomes valid.

$expirystring

The time at which the Shared Access Signature becomes invalid.

$identifierstring

Signed identifier

Returns
TypeDescription
string
methodpublicgetBlob(string $containerName = '', string $blobName = '', string $localFileName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : void

Get blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$localFileNamestring

Local file name to store downloaded blob

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlobData(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : mixed

Get blob data

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
mixedBlob contents
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlobInstance(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, array $additionalHeaders = array()) : \Zend_Service_WindowsAzure_Storage_BlobInstance

Get blob instance

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_BlobInstance
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlobMetadata(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null) : array

Get blob metadata

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

Returns
TypeDescription
arrayKey/value pairs of meta data
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlobProperties(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null) : \Zend_Service_WindowsAzure_Storage_BlobInstance

Get blob properties

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_BlobInstance
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlockList(string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null, integer $type = 0) : array

Get block list

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$snapshotIdstring

Snapshot identifier

$leaseIdstring

Lease identifier

$typeinteger

Type of block list to retrieve. 0 = all, 1 = committed, 2 = uncommitted

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainer(string $containerName = '') : \Zend_Service_WindowsAzure_Storage_BlobContainer

Get container

Parameters
NameTypeDescription
$containerNamestring

Container name

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_BlobContainer
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainerAcl(string $containerName = '', bool $signedIdentifiers = false) : string

Get container ACL

Parameters
NameTypeDescription
$containerNamestring

Container name

$signedIdentifiersbool

Display only private/blob/container or display signed identifiers?

Returns
TypeDescription
stringAcl, to be compared with Zend_Service_WindowsAzure_Storage_Blob::ACL_*
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainerMetadata(string $containerName = '') : array

Get container metadata

Parameters
NameTypeDescription
$containerNamestring

Container name

Returns
TypeDescription
arrayKey/value pairs of meta data
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetPageRegions(string $containerName = '', string $blobName = '', int $startByteOffset = 0, int $endByteOffset = 0, string $leaseId = null) : array

Put page in page blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$startByteOffsetint

Start byte offset

$endByteOffsetint

End byte offset

$leaseIdstring

Lease identifier

Returns
TypeDescription
arrayArray of page ranges
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicgetWrapperClient(string $name) : \Zend_Service_WindowsAzure_Storage_Blob
static

Get wrapper client for stream type

Parameters
NameTypeDescription
$namestring

Protocol name

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_Blob
methodpublicisValidContainerName(string $containerName = '') : boolean
static

Is valid container name?

Parameters
NameTypeDescription
$containerNamestring

Container name

Returns
TypeDescription
boolean
methodpublicleaseBlob(string $containerName = '', string $blobName = '', string $leaseAction = self::LEASE_ACQUIRE, string $leaseId = null) : \Zend_Service_WindowsAzure_Storage_LeaseInstance

Lease blob - See (http://msdn.microsoft.com/en-us/library/ee691972.aspx)

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$leaseActionstring

Lease action (Zend_Service_WindowsAzure_Storage_Blob::LEASE_*)

$leaseIdstring

Lease identifier, required to renew the lease or to release the lease.

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_LeaseInstanceLease instance
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliclistBlobs(string $containerName = '', string $prefix = '', string $delimiter = '', int $maxResults = null, string $marker = null, string $include = null, int $currentResultCount = 0) : array

List blobs

Parameters
NameTypeDescription
$containerNamestring

Container name

$prefixstring

Optional. Filters the results to return only blobs whose name begins with the specified prefix.

$delimiterstring

Optional. Delimiter, i.e. '/', for specifying folder hierarchy

$maxResultsint

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)

$markerstring

Optional string value that identifies the portion of the list to be returned with the next list operation.

$includestring

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 (,)

$currentResultCountint

Current result count (internal use)

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpubliclistContainers(string $prefix = null, int $maxResults = null, string $marker = null, string $include = null, int $currentResultCount = 0) : array

List containers

Parameters
NameTypeDescription
$prefixstring

Optional. Filters the results to return only containers whose name begins with the specified prefix.

$maxResultsint

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)

$markerstring

Optional string value that identifies the portion of the list to be returned with the next list operation.

$includestring

Optional. Include this parameter to specify that the container's metadata be returned as part of the response body. (allowed values: '', 'metadata')

$currentResultCountint

Current result count (internal use)

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputBlob(string $containerName = '', string $blobName = '', string $localFileName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : object

Put blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$localFileNamestring

Local file name to be uploaded

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
objectPartial blob properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputBlobData(string $containerName = '', string $blobName = '', mixed $data = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : object

Put blob data

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$datamixed

Data to store

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
objectPartial blob properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputBlock(string $containerName = '', string $blobName = '', string $identifier = '', array $contents = '', string $leaseId = null) : void

Put large blob block

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$identifierstring

Block ID

$contentsarray

Contents of the block

$leaseIdstring

Lease identifier

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputBlockList(string $containerName = '', string $blobName = '', array $blockList = array(), array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : void

Put block list

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$blockListarray

Array of block identifiers

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputLargeBlob(string $containerName = '', string $blobName = '', string $localFileName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : object

Put large blob (> 64 MB)

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$localFileNamestring

Local file name to be uploaded

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
objectPartial blob properties
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicputPage(string $containerName = '', string $blobName = '', int $startByteOffset = 0, int $endByteOffset = 0, mixed $contents = '', string $writeMethod = self::PAGE_WRITE_UPDATE, string $leaseId = null, array $additionalHeaders = array()) : void

Put page in page blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$startByteOffsetint

Start byte offset

$endByteOffsetint

End byte offset

$contentsmixed

Page contents

$writeMethodstring

Write method (Zend_Service_WindowsAzure_Storage_Blob::PAGE_WRITE_*)

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicregisterAsClient(string $name) : \Zend_Service_WindowsAzure_Storage_Blob

Register this object as stream wrapper client

Parameters
NameTypeDescription
$namestring

Protocol name

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_Blob
methodpublicregisterStreamWrapper(string $name = 'azure') : void

Register this object as stream wrapper

Parameters
NameTypeDescription
$namestring

Protocol name

methodpublicsetBlobMetadata(string $containerName = '', string $blobName = '', array $metadata = array(), string $leaseId = null, array $additionalHeaders = array()) : void

Set blob metadata

Calling the Set Blob Metadata operation overwrites all existing metadata that is associated with the blob. It's not possible to modify an individual name/value pair.
Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$metadataarray

Key/value pairs of meta data

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicsetBlobProperties(string $containerName = '', string $blobName = '', string $leaseId = null, array $additionalHeaders = array()) : void

Set blob properties

All available properties are listed at http://msdn.microsoft.com/en-us/library/ee691966.aspx and should be provided in the $additionalHeaders parameter.
Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$leaseIdstring

Lease identifier

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicsetContainerAcl(string $containerName = '', bool $acl = self::ACL_PRIVATE, array $signedIdentifiers = array()) : void

Set container ACL

Parameters
NameTypeDescription
$containerNamestring

Container name

$aclbool

Zend_Service_WindowsAzure_Storage_Blob::ACL_*

$signedIdentifiersarray

Signed identifiers

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicsetContainerMetadata(string $containerName = '', array $metadata = array(), array $additionalHeaders = array()) : void

Set container metadata

Calling the Set Container Metadata operation overwrites all existing metadata that is associated with the container. It's not possible to modify an individual name/value pair.
Parameters
NameTypeDescription
$containerNamestring

Container name

$metadataarray

Key/value pairs of meta data

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicsnapshotBlob(string $containerName = '', string $blobName = '', array $metadata = array(), array $additionalHeaders = array()) : string

Snapshot blob

Parameters
NameTypeDescription
$containerNamestring

Container name

$blobNamestring

Blob name

$metadataarray

Key/value pairs of meta data

$additionalHeadersarray

Additional headers. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.

Returns
TypeDescription
stringDate/Time value representing the snapshot identifier.
Throws
ExceptionDescription
\Zend_Service_WindowsAzure_Exception
methodpublicunregisterAsClient(string $name) : \Zend_Service_WindowsAzure_Storage_Blob

Unregister this object as stream wrapper client

Parameters
NameTypeDescription
$namestring

Protocol name

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_Blob
methodpublicunregisterStreamWrapper(string $name = 'azure') : \Zend_Service_WindowsAzure_Storage_Blob

Unregister this object as stream wrapper

Parameters
NameTypeDescription
$namestring

Protocol name

Returns
TypeDescription
\Zend_Service_WindowsAzure_Storage_Blob
Documentation was generated by phpDocumentor 2.2.0 .