ZendService\Rackspace¶
Introduction¶
The ZendService\Rackspace\Rackspace is a class that provides a simple API to manage the Rackspace services Cloud Files and Cloud Servers.
Note
Load balancers service
The load balancers service of Rackspace is not implemented yet. We are planning to release it in the next future.
Registering with Rackspace¶
Before you can get started with ZendService\Rackspace\Rackspace, you must first register for an account. Please see the Cloud services page on the Rackspace website for more information.
After registering, you can get the Username and the API Key from the Rackspace management console under the menu “Your Account” > “API Access”. These informations are required to use the ZendService\Rackspace\Rackspace classes.
Cloud Files¶
The Cloud Files is a service to store any files in a cloud environment. A user can store an unlimited quantity of files and each file can be as large as 5 gigabytes. The files can be private or public. The private files can be accessed using the API of Rackspace. The public files are accessed using a CDN (Content Delivery Network). Rackspace exposes a REST API to manage the Cloud Files.
ZendService\Rackspace\Files provides the following functionality:
- Upload files programmatically for tight integration with your application
- Enable Cloud Files CDN integration on any container for public distribution
- Create Containers programmatically
- Retrieve lists of containers and files
Cloud Servers¶
Rackspace Cloud Servers is a compute service that provides server capacity in the cloud. Cloud Servers come in different flavors of memory, disk space, and CPU.
ZendService\Rackspace\Servers provides the following functionality:
- Create/delete new servers
- List and get information on each server
- Manage the public/private IP addresses of a server
- Resize the server capacity
- Reboot a server
- Create new images for a server
- Manage the backup of a server
- Create a group of server to share the IP addresses for High Availability architecture
Available Methods¶
Eeach service class (Files, Servers) of Rackspace extends the ZendService\Rackspace\Rackspace abstract class. This class contains a set of public methods shared with all the service. This public methods are reported as follow:
- authenticate
authenticate()
Authenticate the Rackspace API using the user and the key specified in the concrete class that extend ZendService\Rackspace\Rackspace. Return true in case of success and false in case of error.
- setServiceNet
setServiceNet(boolean $useServiceNet = true)
Use the Rackspace ‘ServiceNet’ internal network.
- getServiceNet
getServiceNet()
Are we using the Rackspace ‘ServiceNet’ internal network? Returns a boolean.
- getAuthUrl
getAuthUrl()
Get the authentication URL of Rackspace. Returns a string.
- getCdnUrl
getCdnUrl()
Get the URL for the CDN. Returns a string.
- getErrorCode
getErrorCode()
Get the last HTTP error code. Returns a string.
- getErrorMsg
getErrorMsg()
Get the last error message. Returns a string.
- getHttpClient
getHttpClient()
Get the HTTP client used to call the API of the Rackspace. Returns a Zend\Http\Client instance.
- getKey
getKey()
Get the authentication key. Returns a string.
- getManagementUrl
getManagementUrl()
Get the URL for the management services. Returns a string.
- getStorageUrl
getStorageUrl()
Get the URL for the storage (files) service. Returns a string.
- getToken
getToken()
Get the token returned after a successful authentication. Returns a string.
- getUser
getUser()
Get the user authenticated with the Rackspace service. Returns a string.
- isSuccessful
isSuccessful()
Return true if the last service call was successful, false otherwise.
- setAuthUrl
setAuthUrl(string $url)
Set the authentication URL to be used.
$url is the URL for the authentication
- setKey
setKey(string $key)
Set the key for the API authentication.
$key is the key string for the authentication
- setUser
setUser(string $user)
Set the user for the API authentication.
$user is the user string for the authentication