A DataObject is an object in the ObjectStore This class uses the name DataObject because "Object" is too generic and conflicts with
certain PHP keywords.
Returns the CDN URL (for managing the object) Note that the DataObject::PublicURL() method is used to return the
publicly-available URL of the object, while the CDNURL() is used
to manage the object.
Copies the object to another container/object Note that this function, because it operates within the Object Store
itself, is much faster than downloading the object and re-uploading it
to a new object.
Deletes an object from the Object Store Note that we can delete without retrieving by specifying the name in the
parameter array.
Arguments
Name
Type
Description
Default
$params
array
an array of parameters
array()
Return value
Type
Description
\OpenCloud\ObjectStore\HttpResponse
if successful; FALSE if not
Tags
Name
Description
api
throws
Fetch(
)
:
void
Description
Retrieves a single object, parses headers
Return value
Type
Description
void
Tags
Name
Description
throws
ObjFetchError
PublicURL(
string
$type
= null,
)
:
string
Description
Returns the object's Public CDN URL, if available
Arguments
Name
Type
Description
Default
$type
string
can be 'streaming', 'ssl', or anything else for the
default URL.
null
Return value
Type
Description
string
Tags
Name
Description
api
PurgeCDN(
string
$email,
)
:
void
Description
Purges the object from the CDN Note that the object will still be served up to the time of its
TTL value.
Arguments
Name
Type
Description
Default
$email
string
An email address that will be notified when
the object is purged.
Return value
Type
Description
void
Tags
Name
Description
api
throws
if the container is not CDN-enabled
throws
if there is an HTTP error in the transaction
SaveToFilename(
string
$filename,
)
:
boolean
Description
Saves the object's data to local filename Given a local filename, the Object's data will be written to the newly
created file.
Example:
# ... authentication/connection/container code excluded
# ... see previous examples
# Whoops! I deleted my local README, let me download/save it
#
$my_docs = $conn->get_container("documents");
$doc = $my_docs->get_object("README");
$doc->SaveToFilename("/home/ej/cloudfiles/readme.restored");
Arguments
Name
Type
Description
Default
$filename
string
name of local file to write data to
Return value
Type
Description
boolean
<kbd>TRUE</kbd> if successful
Tags
Name
Description
throws
error opening file
throws
unexpected response
SaveToStream(
$resource,
)
:
boolean
Description
Saves the object's to a stream filename Given a local filename, the Object's data will be written to the stream
Example:
# ... authentication/connection/container code excluded
# ... see previous examples
# If I want to write the README to a temporary memory string I
# do :
#
$my_docs = $conn->get_container("documents");
$doc = $my_docs->DataObject(array("name"=>"README"));
$fp = fopen('php://temp', 'r+');
$doc->SaveToStream($fp);
fclose($fp);
Arguments
Name
Type
Description
Default
$resource
n/a
Return value
Type
Description
boolean
<kbd>TRUE</kbd> if successful
Tags
Name
Description
throws
error opening file
throws
unexpected response
SaveToString(
)
:
string
Description
Return object's data as a string
Return value
Type
Description
string
the entire object
Service(
)
:
n/a
Description
Returns the service associated with this object It's actually the object's container's service, so this method will
simplify things a bit.
Return value
Type
Description
n/a
n/a
SetData(
string
$data,
)
:
void
Description
Sets object data from string This is a convenience function to permit the use of other technologies
for setting an object's content.
returns the TEMP_URL for the object Some notes:
* The `$secret` value is arbitrary; it must match the value set for
the `X-Account-Meta-Temp-URL-Key` on the account level. This can be
set by calling `$service->SetTempUrlSecret($secret)`.
* The `$expires` value is the number of seconds you want the temporary
URL to be valid for. For example, use `60` to make it valid for a
minute
* The `$method` must be either GET or PUT. No other methods are
supported.
Update() is provided as an alias for the Create() method Since update and create both use a PUT request, the different functions
may allow the developer to distinguish between the semantics in his or
her application.
Arguments
Name
Type
Description
Default
$params
array
an optional associative array that can contain the
'name' and 'type' of the object
A DataObject is related to a container and has a name If `$name` is specified, then it attempts to retrieve the object from the
object store.
Arguments
Name
Type
Description
Default
$container
\OpenCloud\ObjectStore\Container
the container holding this object
$cdata
mixed
if an object or array, it is treated as values
with which to populate the object. If it is a string, it is
treated as a name and the object's info is retrieved from
the service.
NULL
Return value
Type
Description
void
_guess_content_type(
string
$handle,
)
:
boolean
Description
Performs an internal check to get the proper MIME type for an object This function would go over the available PHP methods to get
the MIME type.
By default it will try to use the PHP fileinfo library which is
available from PHP 5.3 or as an PECL extension
(http://pecl.php.net/package/Fileinfo).
It will get the magic file by default from the system wide file
which is usually available in /usr/share/magic on Unix or try
to use the file specified in the source directory of the API
(share directory).
if fileinfo is not available it will try to use the internal
mime_content_type function.
Arguments
Name
Type
Description
Default
$handle
string
name of file or buffer to guess the type from
Return value
Type
Description
boolean
<kbd>TRUE</kbd> if successful
Tags
Name
Description
throws
getETag(
)
:
string
Description
Returns the object's MD5 checksum Accessor method for reading Object's private ETag attribute.
Metadata The Metadata class represents either Server or Image metadata
Nova Nova is an abstraction layer for the OpenStack compute service.
ObjectStore Intermediate (abstract) class to implement shared
features of all object-storage classes
PersistentObject represents an object that has the ability to be
retrieved, created, updated, and deleted.
Service This class defines a "service"—a relationship between a specific OpenStack
and a provided service, represented by a URL in the service catalog.
ServiceCatalogItem Holds information on a single service from the Service Catalog
Curl The CurlRequest class is a simple wrapper to CURL functions. Not only does
this permit stubbing of the interface as described under the HttpRequest
interface, it could potentially allow us to replace the interface methods
with other function calls in the future.
HttpRequestInterface The HttpRequest interface defines methods for wrapping CURL; this allows
those methods to be stubbed out for unit testing, thus allowing us to
test without actually making live calls.
Response
Blank The HttpResponse returns an object with status information, separated
headers, and any response body necessary.
Http The HttpResponse returns an object with status information, separated
headers, and any response body necessary.
Compute
Flavor The Flavor class represents a flavor defined by the Compute service
Image The Image class represents a stored machine image returned by the
Compute service.
Network The Network class represents a single virtual network
Server The Server class represents a single server node.
Record The Record class represents a single domain record
Service This class defines a "service"—a relationship between a specific OpenStack
and a provided service, represented by a URL in the service catalog.
Subdomain The Subdomain is basically another domain, albeit one that is a child of
a parent domain. In terms of the code involved, the JSON is slightly
different than a top-level domain, and the parent is a domain instead of
the DNS service itself.
Database
Database This class represents a Database in the Rackspace "Red Dwarf"
database-as-a-service product.
Instance Instance represents an instance of DbService, similar to a Server in a
Compute service
Service The Rackspace Database As A Service (aka "Red Dwarf")
User This class represents a User in the Rackspace "Red Dwarf"
database-as-a-service product.
LoadBalancer
Algorithm sub-resource to manage algorithms (read-only)
AllowedDomain sub-resource to manage allowed domains
BillableLoadBalancer used to get a list of billable load balancers for a specific date range
LoadBalancer The LoadBalancer class represents a single load balancer
Protocol sub-resource to manage protocols (read-only)
Node information on a single node in the load balancer
NodeEvent a single node event, usually called as part of a Collection
Readonly This defines a read-only SubResource - one that cannot be created, updated,
or deleted. Many subresources are like this, and this simplifies their
class definitions.
Stats Stats returns statistics about the load balancer
SubResource SubResource is an abstract class that handles subresources of a
LoadBalancer object; for example, the
`/loadbalancers/{id}/errorpage`. Since most of the subresources are
handled in a similar manner, this consolidates the functions.
Curl The CurlRequest class is a simple wrapper to CURL functions. Not only does
this permit stubbing of the interface as described under the HttpRequest
interface, it could potentially allow us to replace the interface methods
with other function calls in the future.
DataObject A DataObject is an object in the ObjectStore
Database This class represents a Database in the Rackspace "Red Dwarf"
database-as-a-service product.
HttpRequestInterface The HttpRequest interface defines methods for wrapping CURL; this allows
those methods to be stubbed out for unit testing, thus allowing us to
test without actually making live calls.
Rackspace Rackspace extends the OpenStack class with support for Rackspace's
API key and tenant requirements.
Readonly This defines a read-only SubResource - one that cannot be created, updated,
or deleted. Many subresources are like this, and this simplifies their
class definitions.
Service This class defines a "service"—a relationship between a specific OpenStack
and a provided service, represented by a URL in the service catalog.
Service The Compute class represents the OpenStack Nova service.
Service The Rackspace Database As A Service (aka "Red Dwarf")
Service This class defines a "service"—a relationship between a specific OpenStack
and a provided service, represented by a URL in the service catalog.
Stack The Stack class requires a CloudFormation template and may contain additional
parameters for that template.
Stats Stats returns statistics about the load balancer
SubResource SubResource is an abstract class that handles subresources of a
LoadBalancer object; for example, the
`/loadbalancers/{id}/errorpage`. Since most of the subresources are
handled in a similar manner, this consolidates the functions.
Subdomain The Subdomain is basically another domain, albeit one that is a child of
a parent domain. In terms of the code involved, the JSON is slightly
different than a top-level domain, and the parent is a domain instead of
the DNS service itself.