Service/Rackspace/Files.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 [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Service  
Subpackage
Rackspace  

\Zend_Service_Rackspace_Files

Package: Default
Parent(s)
\Zend_Service_Rackspace_Abstract

Constants

Constant  ERROR_CONTAINER_NOT_EMPTY = 'The container is not empty, I cannot delete it.'
Constant  ERROR_CONTAINER_NOT_FOUND = 'The container was not found.'
Constant  ERROR_OBJECT_NOT_FOUND = 'The object was not found.'
Constant  ERROR_OBJECT_MISSING_PARAM = 'Missing Content-Length or Content-Type header in the request'
Constant  ERROR_OBJECT_CHECKSUM = 'Checksum of the file content failed'
Constant  ERROR_CONTAINER_EXIST = 'The container already exists'
Constant  ERROR_PARAM_NO_NAME_CONTAINER = 'You must specify the container name'
Constant  ERROR_PARAM_NO_NAME_OBJECT = 'You must specify the object name'
Constant  ERROR_PARAM_NO_CONTENT = 'You must specify the content of the object'
Constant  ERROR_PARAM_NO_NAME_SOURCE_CONTAINER = 'You must specify the source container name'
Constant  ERROR_PARAM_NO_NAME_SOURCE_OBJECT = 'You must specify the source object name'
Constant  ERROR_PARAM_NO_NAME_DEST_CONTAINER = 'You must specify the destination container name'
Constant  ERROR_PARAM_NO_NAME_DEST_OBJECT = 'You must specify the destination object name'
Constant  ERROR_PARAM_NO_METADATA = 'You must specify the metadata array'
Constant  ERROR_CDN_TTL_OUT_OF_RANGE = 'TTL must be a number in seconds, min is 900 sec and maximum is 1577836800 (50 years)'
Constant  ERROR_PARAM_UPDATE_CDN = 'You must specify at least one the parameters: ttl, cdn_enabled or log_retention'
Constant  HEADER_CONTENT_TYPE = 'Content-Type'
Constant  HEADER_HASH = 'Etag'
Constant  HEADER_LAST_MODIFIED = 'Last-Modified'
Constant  HEADER_CONTENT_LENGTH = 'Content-Length'
Constant  HEADER_COPY_FROM = 'X-Copy-From'
Constant  METADATA_OBJECT_HEADER = "X-Object-Meta-"
Constant  METADATA_CONTAINER_HEADER = "X-Container-Meta-"
Constant  CDN_URI = "X-CDN-URI"
Constant  CDN_SSL_URI = "X-CDN-SSL-URI"
Constant  CDN_ENABLED = "X-CDN-Enabled"
Constant  CDN_LOG_RETENTION = "X-Log-Retention"
Constant  CDN_ACL_USER_AGENT = "X-User-Agent-ACL"
Constant  CDN_ACL_REFERRER = "X-Referrer-ACL"
Constant  CDN_TTL = "X-TTL"
Constant  CDN_TTL_MIN = 900
Constant  CDN_TTL_MAX = 1577836800
Constant  CDN_EMAIL = "X-Purge-Email"
Constant  ACCOUNT_CONTAINER_COUNT = "X-Account-Container-Count"
Constant  ACCOUNT_BYTES_USED = "X-Account-Bytes-Used"
Constant  ACCOUNT_OBJ_COUNT = "X-Account-Object-Count"
Constant  CONTAINER_OBJ_COUNT = "X-Container-Object-Count"
Constant  CONTAINER_BYTES_USE = "X-Container-Bytes-Used"
Constant  MANIFEST_OBJECT_HEADER = "X-Object-Manifest"
Constant  VERSION = 'v1.0'
Constant  US_AUTH_URL = 'https://auth.api.rackspacecloud.com'
Constant  UK_AUTH_URL = 'https://lon.auth.api.rackspacecloud.com'
Constant  API_FORMAT = 'json'
Constant  USER_AGENT = 'Zend_Service_Rackspace'
Constant  STORAGE_URL = "X-Storage-Url"
Constant  AUTHTOKEN = "X-Auth-Token"
Constant  AUTHUSER_HEADER = "X-Auth-User"
Constant  AUTHKEY_HEADER = "X-Auth-Key"
Constant  AUTHUSER_HEADER_LEGACY = "X-Storage-User"
Constant  AUTHKEY_HEADER_LEGACY = "X-Storage-Pass"
Constant  AUTHTOKEN_LEGACY = "X-Storage-Token"
Constant  CDNM_URL = "X-CDN-Management-Url"
Constant  MANAGEMENT_URL = "X-Server-Management-Url"

Properties

Propertyprotectedstring $authUrl =
inherited

Authentication URL

Inherited from: \Zend_Service_Rackspace_Abstract::$$authUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$authUrl  
Propertyprotectedstring $cdnUrl =
inherited

CDN URL

Inherited from: \Zend_Service_Rackspace_Abstract::$$cdnUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$cdnUrl  
Propertyprotectedstring $errorCode =
inherited

HTTP error code

Inherited from: \Zend_Service_Rackspace_Abstract::$$errorCode
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$errorCode  
Propertyprotectedstring $errorMsg =
inherited

Error Msg

Inherited from: \Zend_Service_Rackspace_Abstract::$$errorMsg
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$errorMsg  
Propertyprotected\Zend_Http_Client $httpClient =
Propertyprotectedstring $key =
inherited

Rackspace Key

Inherited from: \Zend_Service_Rackspace_Abstract::$$key
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$key  
Propertyprotectedstring $managementUrl =
inherited

Server management URL

Inherited from: \Zend_Service_Rackspace_Abstract::$$managementUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$managementUrl  
Propertyprotectedstring $storageUrl =
inherited

Storage URL

Inherited from: \Zend_Service_Rackspace_Abstract::$$storageUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$storageUrl  
Propertyprotectedstring $token =
inherited

Token of authentication

Inherited from: \Zend_Service_Rackspace_Abstract::$$token
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$token  
Propertyprotectedboolean $useServiceNet = false
inherited

Do we use ServiceNet?

Inherited from: \Zend_Service_Rackspace_Abstract::$$useServiceNet
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Service_Rackspace_Abstract::$$useServiceNet  
Propertyprotectedstring $user =
inherited

Rackspace account name

Inherited from: \Zend_Service_Rackspace_Abstract::$$user
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$user  

Methods

methodpublic__construct(string $user, string $key, string $authUrl = self::US_AUTH_URL) : void
inherited

Constructor

Inherited from: \Zend_Service_Rackspace_Abstract::__construct()

You must pass the account and the Rackspace authentication key. Optional: the authentication url (default is US)

Parameters
Name Type Description
$user string
$key string
$authUrl string
methodpublicauthenticate() : boolean
inherited

Authentication

Inherited from: \Zend_Service_Rackspace_Abstract::authenticate()
Returns
Type Description
boolean
methodpubliccopyObject(string $container_source, string $obj_source, string $container_dest, string $obj_dest, array $metadata = array(), string $content_type = null) : boolean

Copy an object from a container to another

Parameters
Name Type Description
$container_source string
$obj_source string
$container_dest string
$obj_dest string
$metadata array
$content_type string
Returns
Type Description
boolean
methodpubliccreateContainer(string $container, array $metadata = array()) : \Zend_Service_Rackspace_Files_Container | boolean

Create a container

Parameters
Name Type Description
$container string
$metadata array
Returns
Type Description
\Zend_Service_Rackspace_Files_Container | boolean
methodpublicdeleteContainer(\sting $container) : boolean

Delete a container (only if it's empty)

Parameters
Name Type Description
$container \sting
Returns
Type Description
boolean
methodpublicdeleteObject(string $container, string $object) : boolean

Delete an object in a container

Parameters
Name Type Description
$container string
$object string
Returns
Type Description
boolean
methodpublicenableCdnContainer(string $container, integer $ttl = self::CDN_TTL_MIN) : array | boolean

Enable the CDN for a container

Parameters
Name Type Description
$container string
$ttl integer
Returns
Type Description
array | boolean
methodpublicgetAuthUrl() : string
inherited

Get authentication URL

Inherited from: \Zend_Service_Rackspace_Abstract::getAuthUrl()
Returns
Type Description
string
methodpublicgetCdnContainers(array $options = array()) : array | boolean

Get all the CDN containers

Parameters
Name Type Description
$options array
Returns
Type Description
array | boolean
methodpublicgetCdnUrl() : string | boolean
inherited

Get the CDN URL

Inherited from: \Zend_Service_Rackspace_Abstract::getCdnUrl()
Returns
Type Description
string | boolean
methodpublicgetContainer(string $container) : \Container | boolean

Get a container

Parameters
Name Type Description
$container string
Returns
Type Description
\Container | boolean
methodpublicgetContainers(array $options = array()) : \Zend_Service_Rackspace_Files_ContainerList | boolean

Get all the containers

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Service_Rackspace_Files_ContainerList | boolean
methodpublicgetCountContainers() : integer

Return the total count of containers

Returns
Type Description
integer
methodpublicgetCountObjects() : integer

Return the count of objects contained in all the containers

Returns
Type Description
integer
methodpublicgetErrorCode() : \strig
inherited

Get the error code of the last HTTP call

Inherited from: \Zend_Service_Rackspace_Abstract::getErrorCode()
Returns
Type Description
\strig
methodpublicgetErrorMsg() : string
inherited

Get the error msg of the last HTTP call

Inherited from: \Zend_Service_Rackspace_Abstract::getErrorMsg()
Returns
Type Description
string
methodpublicgetHttpClient() : \Zend_Http_Client
inherited

get the HttpClient instance

Inherited from: \Zend_Service_Rackspace_Abstract::getHttpClient()
Returns
Type Description
\Zend_Http_Client
methodpublicgetInfoAccount() : array | boolean

Get the metadata information of the accounts: - total count containers - size in bytes of all the containers - total objects in all the containers

Returns
Type Description
array | boolean
methodpublicgetInfoCdnContainer(string $container) : array | boolean

Get the information of a Cdn container

Parameters
Name Type Description
$container string
Returns
Type Description
array | boolean
methodpublicgetKey() : string
inherited

Get user key

Inherited from: \Zend_Service_Rackspace_Abstract::getKey()
Returns
Type Description
string
methodpublicgetManagementUrl() : string | boolean
inherited

Get the management server URL

Inherited from: \Zend_Service_Rackspace_Abstract::getManagementUrl()
Returns
Type Description
string | boolean
methodpublicgetMetadataContainer(string $container) : array | boolean

Get the metadata of a container

Parameters
Name Type Description
$container string
Returns
Type Description
array | boolean
methodpublicgetMetadataObject(string $container, string $object) : array | boolean

Get the metadata of an object

Parameters
Name Type Description
$container string
$object string
Returns
Type Description
array | boolean
methodpublicgetObject(string $container, string $object, array $headers = array()) : \Zend_Service_Rackspace_Files_Object | boolean

Get an object in a container

Parameters
Name Type Description
$container string
$object string
$headers array
Returns
Type Description
\Zend_Service_Rackspace_Files_Object | boolean
methodpublicgetObjects(string $container, array $options = array()) : \Zend_Service_Rackspace_Files_ObjectList | boolean

Get all the objects of a container

Parameters
Name Type Description
$container string
$options array
Returns
Type Description
\Zend_Service_Rackspace_Files_ObjectList | boolean
methodpublicgetServiceNet() : boolean
inherited

Get whether we're using ServiceNet

Inherited from: \Zend_Service_Rackspace_Abstract::getServiceNet()
Returns
Type Description
boolean
methodpublicgetSizeContainers() : integer

Return the size in bytes of all the containers

Returns
Type Description
integer
methodpublicgetStorageUrl() : string | boolean
inherited

Get the storage URL

Inherited from: \Zend_Service_Rackspace_Abstract::getStorageUrl()
Returns
Type Description
string | boolean
methodpublicgetToken() : string
inherited

Get the authentication token

Inherited from: \Zend_Service_Rackspace_Abstract::getToken()
Returns
Type Description
string
methodpublicgetUser() : string
inherited

Get User account

Inherited from: \Zend_Service_Rackspace_Abstract::getUser()
Returns
Type Description
string
methodprotectedhttpCall(string $url, string $method, array $headers = array(),  $data = array(), string $body = null) : \Zend_Http_Response
inherited

HTTP call

Inherited from: \Zend_Service_Rackspace_Abstract::httpCall()
Parameters
Name Type Description
$url string
$method string
$headers array
$data
$body string
Returns
Type Description
\Zend_Http_Response
methodpublicisSuccessful() : boolean
inherited

Return true is the last call was successful

Inherited from: \Zend_Service_Rackspace_Abstract::isSuccessful()
Returns
Type Description
boolean
methodpublicsetAuthUrl(string $url) : void
inherited

Set the Authentication URL

Inherited from: \Zend_Service_Rackspace_Abstract::setAuthUrl()
Parameters
Name Type Description
$url string
methodpublicsetKey(string $key) : void
inherited

Set the authentication key

Inherited from: \Zend_Service_Rackspace_Abstract::setKey()
Parameters
Name Type Description
$key string
methodpublicsetMetadataObject(string $container, string $object, array $metadata) : boolean

Set the metadata of a object in a container The old metadata values are replaced with the new one

Parameters
Name Type Description
$container string
$object string
$metadata array
Returns
Type Description
boolean
methodpublicsetServiceNet(boolean $useServiceNet = true) : void
inherited

Sets whether to use ServiceNet

Inherited from: \Zend_Service_Rackspace_Abstract::setServiceNet()

ServiceNet is Rackspace's internal network. Bandwidth on ServiceNet is not charged.

Parameters
Name Type Description
$useServiceNet boolean
methodpublicsetUser(string $user) : void
inherited

Set the user account

Inherited from: \Zend_Service_Rackspace_Abstract::setUser()
Parameters
Name Type Description
$user string
methodpublicstoreObject(string $container, string $object, string $content, array $metadata = array(), string $content_type = null) : boolean

Store a file in a container

Parameters
Name Type Description
$container string
$object string
$content string
$metadata array
$content_type string
Returns
Type Description
boolean
methodpublicupdateCdnContainer(string $container, integer $ttl = null, boolean $cdn_enabled = null, boolean $log = null) : boolean

Update the attribute of a CDN container

Parameters
Name Type Description
$container string
$ttl integer
$cdn_enabled boolean
$log boolean
Returns
Type Description
boolean
Documentation was generated by phpDocumentor 2.0.0a8.