# Zend_Service_Rackspace

## Introduction

The Zend_Service_Rackspace is a class that provides a simple API to manage the Rackspace services Cloud Files and Cloud Servers.

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

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

Zend_Service_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 Zend_Service_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 the Rackspace API using the user and the key specified in the concrete class that extend Zend_Service_Rackspace. Return true in case of success and false in case of error.

setServiceNet boolean $useServiceNet = true

  Use the Rackspace 'ServiceNet' internal network.

getServiceNet

  Are we using the Rackspace 'ServiceNet' internal network? Returns a boolean.

getAuthUrl

  Get the authentication URL of Rackspace. Returns a string.

getCdnUrl

  Get the URL for the CDN. Returns a string.

getErrorCode

  Get the last HTTP error code. Returns a string.

getErrorMsg

  Get the last error message. Returns a string.

getHttpClient

  Get the HTTP client used to call the API of the Rackspace. Returns a Zend_Http_Client instance.

getKey

  Get the authentication key. Returns a string.

getManagementUrl

  Get the URL for the management services. Returns a string.

getStorageUrl

  Get the URL for the storage (files) service. Returns a string.

getToken

  Get the token returned after a successful authentication. Returns a string.

getUser

  Get the user authenticated with the Rackspace service. Returns a string.

isSuccessful

  Return true if the last service call was successful, false otherwise.

setAuthUrl string $url

  Set the authentication URL to be used.

  $url is the URL for the authentication

setKey string $key

  Set the key for the API authentication.

  $key is the key string for the authentication

setUser string $user

  Set the user for the API authentication.

  $user is the user string for the authentication