Service
extends AbstractService
in package
The ObjectStore (Cloud Files) service.
Table of Contents
- BATCH_DELETE_MAX = 10000
- DEFAULT_NAME = 'cloudFiles'
- DEFAULT_TYPE = 'object-store'
- DEFAULT_URL_TYPE = 'publicURL'
- MAX_CONTAINER_NAME_LENGTH = 256
- MAX_OBJECT_NAME_LEN = 1024
- MAX_OBJECT_SIZE = 5102410241025
- PATCH_CONTENT_TYPE = OpenCloudCommonConstantsMime::JSON_PATCH
- SUPPORTED_VERSION = null
- $aliases : array<string|int, mixed>
- The aliases configure for the properties of the instance.
- $client : Client
- $endpoint : Endpoint
- $namespaces : array<string|int, mixed>
- $regionless : bool
- $resources : array<string|int, mixed>
- $cdnService : mixed
- This holds the associated CDN service (for Rackspace public cloud) or is NULL otherwise. The existence of an object here is indicative that the CDN service is available.
- $logger : LoggerInterface
- The logger instance
- $name : string
- $properties : array<string|int, mixed>
- Holds all the properties added by overloading.
- $region : string
- $type : string
- $urlType : string
- __call() : mixed
- Intercept non-existent method calls for dynamic getter/setter functionality.
- __construct() : mixed
- batchDelete() : mixed
- Batch delete will delete an array of object paths. By default, the API will only accept a maximum of 10,000 object deletions per request - so for arrays that exceed this size, it is chunked and sent as individual requests.
- bulkDelete() : mixed
- bulkExtract() : Response
- Perform a bulk extraction, expanding an archive file. If the $path is an empty string, containers will be auto-created accordingly, and files in the archive that do not map to any container (files in the base directory) will be ignored. You can create up to 1,000 new containers per extraction request. Also note that only regular files will be uploaded. Empty directories, symlinks, and so on, will not be uploaded.
- checkContainerName() : bool
- Check the validity of a potential container name.
- checkJsonError() : mixed
- Checks the most recent JSON operation for errors.
- collection() : mixed
- createContainer() : bool|Container
- Create a container for this service.
- generateUuid() : mixed
- getAccount() : Account
- Returns the Object Store account associated with the service.
- getBaseUrl() : Url
- Get the base URL for this service, based on the set URL type.
- getCdnService() : CDNService
- Return the CDN version of the ObjectStore service.
- getClient() : Client
- getContainer() : Container
- Return a new or existing (if name is specified) container.
- getEndpoint() : Endpoint
- getExtensions() : array<string|int, mixed>
- Returns the /extensions for the service
- getInstance() : static
- getLogger() : LoggerInterface
- Returns the Logger object.
- getName() : string
- getNamespaces() : array<string|int, mixed>
- Returns a list of supported namespaces
- getRegion() : string
- getResources() : array<string|int, mixed>
- Get all associated resources for this service.
- getType() : string
- getUrl() : Url
- Returns the URL for the Service
- getUrlType() : string
- hasLogger() : bool
- limits() : array<string|int, mixed>
- Returns the limits for the service
- listContainers() : PaginatedIterator
- List all available containers.
- makeResourceIteratorOptions() : mixed
- migrateContainer() : mixed
- Allows files to be transferred from one container to another.
- name() : mixed
- namespaces() : mixed
- populate() : mixed
- Populates the current object based on an unknown data type.
- region() : mixed
- resource() : object
- Factory method for instantiating resource objects.
- resourceList() : PaginatedIterator
- Factory method for instantiating a resource collection.
- setClient() : mixed
- setEndpoint() : mixed
- setLogger() : $this
- Sets the logger.
- stripNamespace() : mixed
- toCamel() : mixed
- Convert a string to camelCase format.
- toUnderscores() : mixed
- Convert string to underscore format.
- url() : mixed
- getCurrentNamespace() : type
- Internal method for accessing child namespace from parent scope.
- getJsonHeader() : mixed
- getPatchHeaders() : mixed
- getProperty() : mixed
- Grab value out of the data array.
- propertyExists() : bool
- Basic check to see whether property exists.
- resolveResourceClass() : string
- Resolves FQCN for local resource.
- setProperty() : mixed
- We can set a property under three conditions:
- checkAttributePrefix() : bool
- Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
- executeBatchDeleteRequest() : Response
- Internal method for dispatching single batch delete requests.
- findEndpoint() : Endpoint
- Extracts the appropriate endpoint from the service catalog based on the name and type of a service, and sets for further use.
- getMetaUrl() : stdClass
- Constructs a specified URL from the subresource
- isAccessible() : bool
- Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
Constants
BATCH_DELETE_MAX
public
mixed
BATCH_DELETE_MAX
= 10000
DEFAULT_NAME
public
mixed
DEFAULT_NAME
= 'cloudFiles'
DEFAULT_TYPE
public
mixed
DEFAULT_TYPE
= 'object-store'
DEFAULT_URL_TYPE
public
mixed
DEFAULT_URL_TYPE
= 'publicURL'
MAX_CONTAINER_NAME_LENGTH
public
mixed
MAX_CONTAINER_NAME_LENGTH
= 256
MAX_OBJECT_NAME_LEN
public
mixed
MAX_OBJECT_NAME_LEN
= 1024
MAX_OBJECT_SIZE
public
mixed
MAX_OBJECT_SIZE
= 5102410241025
PATCH_CONTENT_TYPE
public
mixed
PATCH_CONTENT_TYPE
= OpenCloudCommonConstantsMime::JSON_PATCH
SUPPORTED_VERSION
public
mixed
SUPPORTED_VERSION
= null
Properties
$aliases
The aliases configure for the properties of the instance.
protected
array<string|int, mixed>
$aliases
= array()
$client
protected
Client
$client
The client which interacts with the API.
$endpoint
protected
Endpoint
$endpoint
The endpoint for this service.
$namespaces
protected
array<string|int, mixed>
$namespaces
= array()
Namespaces for this service.
$regionless
protected
bool
$regionless
= false
Indicates whether a service is "regionless" or not. Defaults to FALSE because nearly all services are region-specific.
$resources
protected
array<string|int, mixed>
$resources
= array()
A collection of resource models that this service has control over.
$cdnService
This holds the associated CDN service (for Rackspace public cloud) or is NULL otherwise. The existence of an object here is indicative that the CDN service is available.
private
mixed
$cdnService
$logger
The logger instance
private
LoggerInterface
$logger
$name
private
string
$name
The name of this service, as set in Catalog.
$properties
Holds all the properties added by overloading.
private
array<string|int, mixed>
$properties
= array()
$region
private
string
$region
The chosen region(s) for this service.
$type
private
string
$type
The type of this service, as set in Catalog.
$urlType
private
string
$urlType
Either 'publicURL' or 'internalURL'.
Methods
__call()
Intercept non-existent method calls for dynamic getter/setter functionality.
public
__call( $method, $args) : mixed
Parameters
Tags
Return values
mixed —__construct()
public
__construct(Client $client[, mixed $type = null ][, mixed $name = null ][, mixed $region = null ][, mixed $urlType = null ]) : mixed
Parameters
- $client : Client
- $type : mixed = null
- $name : mixed = null
- $region : mixed = null
- $urlType : mixed = null
Return values
mixed —batchDelete()
Batch delete will delete an array of object paths. By default, the API will only accept a maximum of 10,000 object deletions per request - so for arrays that exceed this size, it is chunked and sent as individual requests.
public
batchDelete(array<string|int, mixed> $paths) : mixed
Parameters
- $paths : array<string|int, mixed>
-
The objects you want to delete. Each path needs be formatted as
/{containerName}/{objectName}. If you are deletingobject_1andobject_2from thephotos_container, the array will be:array( '/photos_container/object_1', '/photos_container/object_2' )
Tags
Return values
mixed —bulkDelete()
public
bulkDelete(array<string|int, mixed> $paths) : mixed
Parameters
- $paths : array<string|int, mixed>
Tags
Return values
mixed —bulkExtract()
Perform a bulk extraction, expanding an archive file. If the $path is an empty string, containers will be auto-created accordingly, and files in the archive that do not map to any container (files in the base directory) will be ignored. You can create up to 1,000 new containers per extraction request. Also note that only regular files will be uploaded. Empty directories, symlinks, and so on, will not be uploaded.
public
bulkExtract([string $path = '' ], string|stream $archive[, string $archiveType = UrlType::TAR_GZ ]) : Response
Parameters
- $path : string = ''
-
The path to the archive being extracted
- $archive : string|stream
-
The contents of the archive (either string or stream)
- $archiveType : string = UrlType::TAR_GZ
-
The type of archive you're using UrlType
Tags
Return values
Response —HTTP response from API
checkContainerName()
Check the validity of a potential container name.
public
checkContainerName(string $name) : bool
Parameters
- $name : string
-
Name of container
Tags
Return values
bool —True if container name is valid
checkJsonError()
Checks the most recent JSON operation for errors.
public
static checkJsonError() : mixed
Tags
Return values
mixed —collection()
public
collection(mixed $class[, mixed $url = null ][, mixed $parent = null ][, mixed $data = null ]) : mixed
Parameters
- $class : mixed
- $url : mixed = null
- $parent : mixed = null
- $data : mixed = null
Tags
Return values
mixed —createContainer()
Create a container for this service.
public
createContainer(string $name[, array<string|int, mixed> $metadata = array() ]) : bool|Container
Parameters
- $name : string
-
The name of the container
- $metadata : array<string|int, mixed> = array()
-
Additional (optional) metadata to associate with the container
Return values
bool|Container —Newly-created Container upon success; false, otherwise
generateUuid()
public
static generateUuid() : mixed
Return values
mixed —getAccount()
Returns the Object Store account associated with the service.
public
getAccount() : Account
Return values
Account —Object Store account
getBaseUrl()
Get the base URL for this service, based on the set URL type.
public
getBaseUrl() : Url
Tags
Return values
Url —getCdnService()
Return the CDN version of the ObjectStore service.
public
getCdnService() : CDNService
Return values
CDNService —CDN version of the ObjectStore service
getClient()
public
getClient() : Client
Return values
Client —getContainer()
Return a new or existing (if name is specified) container.
public
getContainer([stdClass $data = null ]) : Container
Parameters
- $data : stdClass = null
-
Data to initialize container. Optional.
Return values
Container —Container
getEndpoint()
public
getEndpoint() : Endpoint
Return values
Endpoint —getExtensions()
Returns the /extensions for the service
public
getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed> —of objects
getInstance()
public
static getInstance() : static
Return values
static —getLogger()
Returns the Logger object.
public
getLogger() : LoggerInterface
Return values
LoggerInterface —getName()
public
getName() : string
Return values
string —getNamespaces()
Returns a list of supported namespaces
public
getNamespaces() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRegion()
public
getRegion() : string
Return values
string —getResources()
Get all associated resources for this service.
public
getResources() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getType()
public
getType() : string
Return values
string —getUrl()
Returns the URL for the Service
public
getUrl([string $path = null ][, array<string|int, mixed> $query = array() ]) : Url
Parameters
- $path : string = null
-
URL path segment
- $query : array<string|int, mixed> = array()
-
Array of query pairs
Return values
Url —getUrlType()
public
getUrlType() : string
Return values
string —hasLogger()
public
hasLogger() : bool
Return values
bool —limits()
Returns the limits for the service
public
limits() : array<string|int, mixed>
Return values
array<string|int, mixed> —of limits
listContainers()
List all available containers.
public
listContainers([array<string|int, mixed> $filter = array() ]) : PaginatedIterator
Parameters
- $filter : array<string|int, mixed> = array()
-
Array of filter options such as:
-
limit: number of results to limit the list to. Optional. -
marker: name of container after which to start the list. Optional. -
end_marker: name of container before which to end the list. Optional.
-
Return values
PaginatedIterator —Iterator to list of containers
makeResourceIteratorOptions()
public
makeResourceIteratorOptions(mixed $resource) : mixed
Parameters
- $resource : mixed
Return values
mixed —migrateContainer()
Allows files to be transferred from one container to another.
public
migrateContainer(Container $old, Container $new[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $old : Container
-
Where you're moving files from
- $new : Container
-
Where you're moving files to
- $options : array<string|int, mixed> = array()
-
Options to configure the migration. Optional. Available options are:
-
read.batchLimit: Number of files to read at a time from$oldcontainer. Optional; default = 1000. -
write.batchLimit: Number of files to write at a time to$newcontainer. Optional; default = 1000. -
read.pageLimit: Number of filenames to read at a time from$oldcontainer. Optional; default = 10000.
-
Return values
mixed —name()
public
name() : mixed
Tags
Return values
mixed —namespaces()
public
namespaces() : mixed
Tags
Return values
mixed —populate()
Populates the current object based on an unknown data type.
public
populate(mixed $info[, mixed $setObjects = true ]) : mixed
Parameters
- $info : mixed
- $setObjects : mixed = true
Tags
Return values
mixed —region()
public
region() : mixed
Tags
Return values
mixed —resource()
Factory method for instantiating resource objects.
public
resource(string $resourceName[, mixed $info = null ][, mixed $parent = null ]) : object
Parameters
- $resourceName : string
- $info : mixed = null
-
(default: null)
- $parent : mixed = null
-
The parent object
Return values
object —resourceList()
Factory method for instantiating a resource collection.
public
resourceList(string $resourceName[, string|null $url = null ][, string|null $parent = null ]) : PaginatedIterator
Parameters
- $resourceName : string
- $url : string|null = null
- $parent : string|null = null
Return values
PaginatedIterator —setClient()
public
setClient(ClientInterface $client) : mixed
Parameters
- $client : ClientInterface
Return values
mixed —setEndpoint()
public
setEndpoint(Endpoint $endpoint) : mixed
Parameters
- $endpoint : Endpoint
Return values
mixed —setLogger()
Sets the logger.
public
setLogger([LoggerInterface $logger = null ]) : $this
Parameters
- $logger : LoggerInterface = null
Return values
$this —stripNamespace()
public
stripNamespace(mixed $namespace) : mixed
Parameters
- $namespace : mixed
Return values
mixed —toCamel()
Convert a string to camelCase format.
public
toCamel( $string[, bool $capitalise = true ]) : mixed
Parameters
Return values
mixed —toUnderscores()
Convert string to underscore format.
public
toUnderscores( $string) : mixed
Parameters
Return values
mixed —url()
public
url([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
- $path : mixed = null
- $query : array<string|int, mixed> = array()
Tags
Return values
mixed —getCurrentNamespace()
Internal method for accessing child namespace from parent scope.
protected
getCurrentNamespace() : type
Return values
type —getJsonHeader()
protected
static getJsonHeader() : mixed
Return values
mixed —getPatchHeaders()
protected
static getPatchHeaders() : mixed
Return values
mixed —getProperty()
Grab value out of the data array.
protected
getProperty(string $property) : mixed
Parameters
- $property : string
Return values
mixed —propertyExists()
Basic check to see whether property exists.
protected
propertyExists(string $property[, bool $allowRetry = true ]) : bool
Parameters
- $property : string
-
The property name being investigated.
- $allowRetry : bool = true
-
If set to TRUE, the check will try to format the name in underscores because there are sometimes discrepancies between camelCaseNames and underscore_names.
Return values
bool —resolveResourceClass()
Resolves FQCN for local resource.
protected
resolveResourceClass( $resourceName) : string
Parameters
Tags
Return values
string —setProperty()
We can set a property under three conditions:
protected
setProperty(mixed $property, mixed $value) : mixed
- If it has a concrete setter: setProperty()
- If the property exists
- If the property name's prefix is in an approved list
Parameters
- $property : mixed
- $value : mixed
Return values
mixed —checkAttributePrefix()
Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
private
checkAttributePrefix(string $property) : bool
This is to support extension namespaces in some services.
Parameters
- $property : string
-
the name of the attribute
Return values
bool —executeBatchDeleteRequest()
Internal method for dispatching single batch delete requests.
private
executeBatchDeleteRequest(array<string|int, mixed> $paths) : Response
Parameters
- $paths : array<string|int, mixed>
Tags
Return values
Response —findEndpoint()
Extracts the appropriate endpoint from the service catalog based on the name and type of a service, and sets for further use.
private
findEndpoint() : Endpoint
Tags
Return values
Endpoint —getMetaUrl()
Constructs a specified URL from the subresource
private
getMetaUrl(string $resource) : stdClass
Given a subresource (e.g., "extensions"), this constructs the proper URL and retrieves the resource.
Parameters
- $resource : string
-
The resource requested; should NOT have slashes at the beginning or end
Return values
stdClass —object
isAccessible()
Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
private
isAccessible( $property) : bool