API Documentation

Zend/Service/WindowsAzure/Storage/Blob.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
name_todo  
Package
Zend_Service_WindowsAzure  
Subpackage
Storage  
Version
$Id: Blob.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Service_WindowsAzure_Storage_Blob

Package: Zend\Service\WindowsAzure\Storage

Parent(s)
\Zend_Service_WindowsAzure_Storage
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  ACL_PRIVATE = null

ACL - Private access

Constant  ACL_PUBLIC = 'container'

ACL - Public access (read all blobs)

Deprecated
Use ACL_PUBLIC_CONTAINER or ACL_PUBLIC_BLOB instead.  
Constant  ACL_PUBLIC_BLOB = 'blob'

ACL - Blob Public access (read all blobs)

Constant  ACL_PUBLIC_CONTAINER = 'container'

ACL - Container Public access (enumerate and read all blobs)

Constant  LEASE_ACQUIRE = 'acquire'

Blob lease constants

Constant  LEASE_RENEW = 'renew'
Constant  LEASE_RELEASE = 'release'
Constant  LEASE_BREAK = 'break'
Constant  MAX_BLOB_SIZE = 67108864

Maximal blob size (in bytes)

Constant  MAX_BLOB_TRANSFER_SIZE = 4194304

Maximal blob transfer size (in bytes)

Constant  BLOBTYPE_BLOCK = 'BlockBlob'

Blob types

Constant  BLOBTYPE_PAGE = 'PageBlob'
Constant  PAGE_WRITE_UPDATE = 'update'

Put page write options

Constant  PAGE_WRITE_CLEAR = 'clear'

Properties

Propertyprivate\Zend_Service_WindowsAzure_Credentials_SharedAccessSignature  $_sharedAccessSignatureCredentials= 'null'

SharedAccessSignature credentials

Propertyprotectedarray  $_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
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

methodprotected_generateBlockId( int $part = 0 ) : string

Generate block id

Parameters
Name Type Description
$part int

Block number

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

Get error message from Zend_Http_Response

Parameters
Name Type Description
$response \Zend_Http_Response

Repsonse

$alternativeError string

Alternative error message

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

Check if a blob exists

Parameters
Name Type Description
$containerName string

Container name

$blobName string

Blob name

$snapshotId string

Snapshot identifier

Returns
Type Description
boolean
methodpubliccontainerExists( string $containerName = '' ) : boolean

Check if a container exists

Parameters
Name Type Description
$containerName string

Container name

Returns
Type Description
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
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.

Returns
Type Description
object Partial blob properties
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpubliccreateContainer( string $containerName = '', array $metadata = array() ) : object

Create container

Parameters
Name Type Description
$containerName string

Container name

$metadata array

Key/value pairs of meta data

Returns
Type Description
object Container properties
Throws
Exception Description
\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
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.

Returns
Type Description
object Partial blob properties
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpubliccreateResourceName( string $containerName = '', string $blobName = '' ) : string
static

Create resource name

Parameters
Name Type Description
$containerName string

Container name

$blobName string

Blob name

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

Delete blob

Parameters
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.

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

Delete container

Parameters
Name Type Description
$containerName string

Container name

$additionalHeaders array

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

Throws
Exception Description
\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
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

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

Get blob

Parameters
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.

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

Get blob data

Parameters
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.

Returns
Type Description
mixed Blob contents
Throws
Exception Description
\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
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.

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

Get blob metadata

Parameters
Name Type Description
$containerName string

Container name

$blobName string

Blob name

$snapshotId string

Snapshot identifier

$leaseId string

Lease identifier

Returns
Type Description
array Key/value pairs of meta data
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicgetBlobProperties( string $containerName = '', string $blobName = '', string $snapshotId = null, string $leaseId = null ) : \Zend_Service_WindowsAzure_Storage_BlobInstance

Get blob properties

Parameters
Name Type Description
$containerName string

Container name

$blobName string

Blob name

$snapshotId string

Snapshot identifier

$leaseId string

Lease identifier

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

Get block list

Parameters
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

Returns
Type Description
array
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainer( string $containerName = '' ) : \Zend_Service_WindowsAzure_Storage_BlobContainer

Get container

Parameters
Name Type Description
$containerName string

Container name

Returns
Type Description
\Zend_Service_WindowsAzure_Storage_BlobContainer
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainerAcl( string $containerName = '', bool $signedIdentifiers = false ) : string

Get container ACL

Parameters
Name Type Description
$containerName string

Container name

$signedIdentifiers bool

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

Returns
Type Description
string Acl, to be compared with Zend_Service_WindowsAzure_Storage_Blob::ACL_*
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicgetContainerMetadata( string $containerName = '' ) : array

Get container metadata

Parameters
Name Type Description
$containerName string

Container name

Returns
Type Description
array Key/value pairs of meta data
Throws
Exception Description
\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
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

Returns
Type Description
array Array of page ranges
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicgetWrapperClient( string $name ) : \Zend_Service_WindowsAzure_Storage_Blob
static

Get wrapper client for stream type

Parameters
Name Type Description
$name string

Protocol name

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

Is valid container name?

Parameters
Name Type Description
$containerName string

Container name

Returns
Type Description
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
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.

Returns
Type Description
\Zend_Service_WindowsAzure_Storage_LeaseInstance Lease instance
Throws
Exception Description
\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
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)

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

List containers

Parameters
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)

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

Put blob

Parameters
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.

Returns
Type Description
object Partial blob properties
Throws
Exception Description
\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
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.

Returns
Type Description
object Partial blob properties
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicputBlock( string $containerName = '', string $blobName = '', string $identifier = '', array $contents = '', string $leaseId = null ) : void

Put large blob block

Parameters
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

Throws
Exception Description
\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
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.

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

Put large blob (> 64 MB)

Parameters
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

Returns
Type Description
object Partial blob properties
Throws
Exception Description
\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
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.

Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicregisterAsClient( string $name ) : \Zend_Service_WindowsAzure_Storage_Blob

Register this object as stream wrapper client

Parameters
Name Type Description
$name string

Protocol name

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

Register this object as stream wrapper

Parameters
Name Type Description
$name string

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
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.

Throws
Exception Description
\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
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.

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

Set container ACL

Parameters
Name Type Description
$containerName string

Container name

$acl bool

Zend_Service_WindowsAzure_Storage_Blob::ACL_*

$signedIdentifiers array

Signed identifiers

Throws
Exception Description
\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
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.

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

Snapshot blob

Parameters
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.

Returns
Type Description
string Date/Time value representing the snapshot identifier.
Throws
Exception Description
\Zend_Service_WindowsAzure_Exception
methodpublicunregisterAsClient( string $name ) : \Zend_Service_WindowsAzure_Storage_Blob

Unregister this object as stream wrapper client

Parameters
Name Type Description
$name string

Protocol name

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

Unregister this object as stream wrapper

Parameters
Name Type Description
$name string

Protocol name

Returns
Type Description
\Zend_Service_WindowsAzure_Storage_Blob
Documentation was generated by DocBlox 0.15.1.