Service/Rackspace/Servers.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_Servers

Package: Default
Parent(s)
\Zend_Service_Rackspace_Abstract

Constants

Constant  LIMIT_FILE_SIZE = 10240
Constant  LIMIT_NUM_FILE = 5
Constant  ERROR_SERVICE_UNAVAILABLE = 'The service is unavailable'
Constant  ERROR_UNAUTHORIZED = 'Unauthorized'
Constant  ERROR_OVERLIMIT = 'You reached the limit of requests, please wait some time before retry'
Constant  ERROR_PARAM_NO_ID = 'You must specify the item\'s id'
Constant  ERROR_PARAM_NO_NAME = 'You must specify the name'
Constant  ERROR_PARAM_NO_SERVERID = 'You must specify the server Id'
Constant  ERROR_PARAM_NO_IMAGEID = 'You must specify the server\'s image ID'
Constant  ERROR_PARAM_NO_FLAVORID = 'You must specify the server\'s flavor ID'
Constant  ERROR_PARAM_NO_ARRAY = 'You must specify an array of parameters'
Constant  ERROR_PARAM_NO_WEEKLY = 'You must specify a weekly backup schedule'
Constant  ERROR_PARAM_NO_DAILY = 'You must specify a daily backup schedule'
Constant  ERROR_ITEM_NOT_FOUND = 'The item specified doesn\'t exist.'
Constant  ERROR_NO_FILE_EXISTS = 'The file specified doesn\'t exist'
Constant  ERROR_LIMIT_FILE_SIZE = 'You reached the size length of a file'
Constant  ERROR_IN_PROGRESS = 'The item specified is still in progress'
Constant  ERROR_BUILD_IN_PROGRESS = 'The build is still in progress'
Constant  ERROR_RESIZE_NOT_ALLOWED = 'The resize is not allowed'
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
methodpublicchangeBackupSchedule(string $id, string $weekly, string $daily) : boolean

Change the backup schedule of a server

Parameters
Name Type Description
$id string

server's Id

$weekly string
$daily string
Returns
Type Description
boolean
methodpublicchangeServerName(string $id, string $name) : boolean

Change the server's name

Parameters
Name Type Description
$id string
$name string
Returns
Type Description
boolean
methodpublicchangeServerPassword(string $id, string $password) : boolean

Change the admin password of the server

Parameters
Name Type Description
$id string
$password string
Returns
Type Description
boolean
methodpublicconfirmResizeServer(string $id) : boolean

Confirm resize of a server

During a resize operation, the original server is saved for a period of time to allow roll back if there is a problem. Once the newly resized server is tested and has been confirmed to be functioning properly, use this operation to confirm the resize. After confirmation, the original server is removed and cannot be rolled back to. All resizes are automatically confirmed after 24 hours if they are not explicitly confirmed or reverted.

Parameters
Name Type Description
$id string
Returns
Type Description
boolean
methodpubliccreateImage(string $serverId, string $name) : \Zend_Service_Rackspace_Servers_Image

Create an image for a serverId

Parameters
Name Type Description
$serverId string
$name string
Returns
Type Description
\Zend_Service_Rackspace_Servers_Image
methodpubliccreateServer(array $data, array $metadata = array(), array $files = array()) : \Zend_Service_Rackspace_Servers_Server | boolean

Create a new server

The required parameters are specified in $data (name, imageId, falvorId) The $files is an associative array with 'serverPath' => 'localPath'

Parameters
Name Type Description
$data array
$metadata array
$files array
Returns
Type Description
\Zend_Service_Rackspace_Servers_Server | boolean
methodpubliccreateSharedIpGroup(string $name, string $serverId) : array | boolean

Create a shared Ip group

Parameters
Name Type Description
$name string
$serverId string
Returns
Type Description
array | boolean
methodpublicdeleteImage(string $id) : boolean

Delete an image

Parameters
Name Type Description
$id string
Returns
Type Description
boolean
methodpublicdeleteServer(string $id) : boolean

Delete a server

Parameters
Name Type Description
$id string
Returns
Type Description
boolean
methodpublicdeleteSharedIpGroup(integer $id) : boolean

Delete a Shared Ip Group

Parameters
Name Type Description
$id integer
Returns
Type Description
boolean
methodpublicdisableBackupSchedule(string $id) : boolean

Disable the backup schedule for a server

Parameters
Name Type Description
$id string

server's Id

Returns
Type Description
boolean
methodpublicgetAuthUrl() : string
inherited

Get authentication URL

Inherited from: \Zend_Service_Rackspace_Abstract::getAuthUrl()
Returns
Type Description
string
methodpublicgetBackupSchedule(string $id) : array | boolean

Get the backup schedule of a server

Parameters
Name Type Description
$id string

server's Id

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
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
methodpublicgetFlavor(string $flavorId) : array | boolean

Get the detail of a flavor

Parameters
Name Type Description
$flavorId string
Returns
Type Description
array | boolean
methodpublicgetHttpClient() : \Zend_Http_Client
inherited

get the HttpClient instance

Inherited from: \Zend_Service_Rackspace_Abstract::getHttpClient()
Returns
Type Description
\Zend_Http_Client
methodpublicgetImage(string $id) : \Zend_Service_Rackspace_Servers_Image | boolean

Get detail about an image

Parameters
Name Type Description
$id string
Returns
Type Description
\Zend_Service_Rackspace_Servers_Image | 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
methodpublicgetServer(string $id) : \Zend_Service_Rackspace_Servers_Server

Get the specified server

Parameters
Name Type Description
$id string
Returns
Type Description
\Zend_Service_Rackspace_Servers_Server
methodpublicgetServerIp(string $id) : array | boolean

Get the server's IPs (public and private)

Parameters
Name Type Description
$id string
Returns
Type Description
array | boolean
methodpublicgetServerPrivateIp(string $id) : array | boolean

Get the Private IPs of a server

Parameters
Name Type Description
$id string
Returns
Type Description
array | boolean
methodpublicgetServerPublicIp(string $id) : array | boolean

Get the Public IPs of a server

Parameters
Name Type Description
$id string
Returns
Type Description
array | boolean
methodpublicgetServiceNet() : boolean
inherited

Get whether we're using ServiceNet

Inherited from: \Zend_Service_Rackspace_Abstract::getServiceNet()
Returns
Type Description
boolean
methodpublicgetSharedIpGroup(integer $id) : \Zend_Service_Rackspace_Servers_SharedIpGroup | boolean

Get the shared IP group

Parameters
Name Type Description
$id integer
Returns
Type Description
\Zend_Service_Rackspace_Servers_SharedIpGroup | boolean
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
methodpubliclistFlavors(boolean $details = false) : array | boolean

Get the list of the flavors

If $details is true returns detail info

Parameters
Name Type Description
$details boolean
Returns
Type Description
array | boolean
methodpubliclistImages(boolean $details = false) : \Zend_Service_Rackspace_Servers_ImageList | boolean

Get the list of the images

Parameters
Name Type Description
$details boolean
Returns
Type Description
\Zend_Service_Rackspace_Servers_ImageList | boolean
methodpubliclistServers(boolean $details = false) : \Zend_Service_Rackspace_Servers_ServerList | boolean

Get the list of the servers If $details is true returns detail info

Parameters
Name Type Description
$details boolean
Returns
Type Description
\Zend_Service_Rackspace_Servers_ServerList | boolean
methodpubliclistSharedIpGroups(boolean $details = false) : \Zend_Service_Rackspace_Servers_SharedIpGroupList | boolean

Get the list of shared IP groups

Parameters
Name Type Description
$details boolean
Returns
Type Description
\Zend_Service_Rackspace_Servers_SharedIpGroupList | boolean
methodpublicrebootServer(string $id, boolean $hard = false) : boolean

Reboot a server

$hard true is the equivalent of power cycling the server $hard false is a graceful shutdown

Parameters
Name Type Description
$id string
$hard boolean
Returns
Type Description
boolean
methodpublicrebuildServer(string $id, string $imageId) : boolean

Rebuild a server

The rebuild function removes all data on the server and replaces it with the specified image, serverId and IP addresses will remain the same.

Parameters
Name Type Description
$id string
$imageId string
Returns
Type Description
boolean
methodpublicresizeServer(string $id, string $flavorId) : boolean

Resize a server

The resize function converts an existing server to a different flavor, in essence, scaling the server up or down. The original server is saved for a period of time to allow rollback if there is a problem. All resizes should be tested and explicitly confirmed, at which time the original server is removed. All resizes are automatically confirmed after 24 hours if they are not explicitly confirmed or reverted.

Parameters
Name Type Description
$id string
$flavorId string
Returns
Type Description
boolean
methodpublicrevertResizeServer(string $id) : boolean

Revert resize of a server

During a resize operation, the original server is saved for a period of time to allow for roll back if there is a problem. If you determine there is a problem with a newly resized server, use this operation to revert the resize and roll back to the original server. All resizes are automatically confirmed after 24 hours if they have not already been confirmed explicitly or reverted.

Parameters
Name Type Description
$id string
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
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
methodpublicshareIpAddress(string $id, string $ip, string $groupId,  $configure = true) : boolean

Share an ip address for a server (id)

Parameters
Name Type Description
$id string

server

$ip string
$groupId string
$configure
Returns
Type Description
boolean
methodpublicunshareIpAddress(string $id, string $ip) : boolean

Unshare IP address for a server ($id)

Parameters
Name Type Description
$id string
$ip string
Returns
Type Description
boolean
methodprotectedupdateServer(string $id, string $name = null, string $password = null) : boolean

Change the name or the admin password for a server

Parameters
Name Type Description
$id string
$name string
$password string
Returns
Type Description
boolean
Documentation was generated by phpDocumentor 2.0.0a8.