Service/Rackspace/Servers.php

Show: PublicProtectedPrivateinherited
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 license@zend.com 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

>VConstant  LIMIT_FILE_SIZE = 10240
>VConstant  LIMIT_NUM_FILE = 5
>VConstant  ERROR_SERVICE_UNAVAILABLE = 'The service is unavailable'
>VConstant  ERROR_UNAUTHORIZED = 'Unauthorized'
>VConstant  ERROR_OVERLIMIT = 'You reached the limit of requests, please wait some time before retry'
>VConstant  ERROR_PARAM_NO_ID = 'You must specify the item\'s id'
>VConstant  ERROR_PARAM_NO_NAME = 'You must specify the name'
>VConstant  ERROR_PARAM_NO_SERVERID = 'You must specify the server Id'
>VConstant  ERROR_PARAM_NO_IMAGEID = 'You must specify the server\'s image ID'
>VConstant  ERROR_PARAM_NO_FLAVORID = 'You must specify the server\'s flavor ID'
>VConstant  ERROR_PARAM_NO_ARRAY = 'You must specify an array of parameters'
>VConstant  ERROR_PARAM_NO_WEEKLY = 'You must specify a weekly backup schedule'
>VConstant  ERROR_PARAM_NO_DAILY = 'You must specify a daily backup schedule'
>VConstant  ERROR_ITEM_NOT_FOUND = 'The item specified doesn\'t exist.'
>VConstant  ERROR_NO_FILE_EXISTS = 'The file specified doesn\'t exist'
>VConstant  ERROR_LIMIT_FILE_SIZE = 'You reached the size length of a file'
>VConstant  ERROR_IN_PROGRESS = 'The item specified is still in progress'
>VConstant  ERROR_BUILD_IN_PROGRESS = 'The build is still in progress'
>VConstant  ERROR_RESIZE_NOT_ALLOWED = 'The resize is not allowed'
>VConstant  VERSION = 'v1.0'
>VConstant  US_AUTH_URL = 'https://auth.api.rackspacecloud.com'
>VConstant  UK_AUTH_URL = 'https://lon.auth.api.rackspacecloud.com'
>VConstant  API_FORMAT = 'json'
>VConstant  USER_AGENT = 'Zend_Service_Rackspace'
>VConstant  STORAGE_URL = "X-Storage-Url"
>VConstant  AUTHTOKEN = "X-Auth-Token"
>VConstant  AUTHUSER_HEADER = "X-Auth-User"
>VConstant  AUTHKEY_HEADER = "X-Auth-Key"
>VConstant  AUTHUSER_HEADER_LEGACY = "X-Storage-User"
>VConstant  AUTHKEY_HEADER_LEGACY = "X-Storage-Pass"
>VConstant  AUTHTOKEN_LEGACY = "X-Storage-Token"
>VConstant  CDNM_URL = "X-CDN-Management-Url"
>VConstant  MANAGEMENT_URL = "X-Server-Management-Url"

Properties

>VPropertyprotectedstring $authUrl
inherited
Authentication URL
Inherited from: \Zend_Service_Rackspace_Abstract::$$authUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$authUrl  
>VPropertyprotectedstring $cdnUrl
inherited
CDN URL
Inherited from: \Zend_Service_Rackspace_Abstract::$$cdnUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$cdnUrl  
>VPropertyprotectedstring $errorCode
inherited
HTTP error code
Inherited from: \Zend_Service_Rackspace_Abstract::$$errorCode
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$errorCode  
>VPropertyprotectedstring $errorMsg
inherited
Error Msg
Inherited from: \Zend_Service_Rackspace_Abstract::$$errorMsg
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$errorMsg  
>VPropertyprotected\Zend_Http_Client $httpClient
>VPropertyprotectedstring $key
inherited
Rackspace Key
Inherited from: \Zend_Service_Rackspace_Abstract::$$key
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$key  
>VPropertyprotectedstring $managementUrl
inherited
Server management URL
Inherited from: \Zend_Service_Rackspace_Abstract::$$managementUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$managementUrl  
>VPropertyprotectedstring $storageUrl
inherited
Storage URL
Inherited from: \Zend_Service_Rackspace_Abstract::$$storageUrl
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$storageUrl  
>VPropertyprotectedstring $token
inherited
Token of authentication
Inherited from: \Zend_Service_Rackspace_Abstract::$$token
Details
Type
string
Inherited_from
\Zend_Service_Rackspace_Abstract::$$token  
>VPropertyprotectedboolean $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  
>VPropertyprotectedstring $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
NameTypeDescription
$userstring
$keystring
$authUrlstring
methodpublicauthenticate() : boolean
inherited

Authentication

Inherited from: \Zend_Service_Rackspace_Abstract::authenticate()
Returns
TypeDescription
boolean
methodpublicchangeBackupSchedule(string $id, string $weekly, string $daily) : boolean

Change the backup schedule of a server

Parameters
NameTypeDescription
$idstring

server's Id

$weeklystring
$dailystring
Returns
TypeDescription
boolean
methodpublicchangeServerName(string $id, string $name) : boolean

Change the server's name

Parameters
NameTypeDescription
$idstring
$namestring
Returns
TypeDescription
boolean
methodpublicchangeServerPassword(string $id, string $password) : boolean

Change the admin password of the server

Parameters
NameTypeDescription
$idstring
$passwordstring
Returns
TypeDescription
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
NameTypeDescription
$idstring
Returns
TypeDescription
boolean
methodpubliccreateImage(string $serverId, string $name) : \Zend_Service_Rackspace_Servers_Image

Create an image for a serverId

Parameters
NameTypeDescription
$serverIdstring
$namestring
Returns
TypeDescription
\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
NameTypeDescription
$dataarray
$metadataarray
$filesarray
Returns
TypeDescription
\Zend_Service_Rackspace_Servers_Server | boolean
methodpubliccreateSharedIpGroup(string $name, string $serverId) : array | boolean

Create a shared Ip group

Parameters
NameTypeDescription
$namestring
$serverIdstring
Returns
TypeDescription
array | boolean
methodpublicdeleteImage(string $id) : boolean

Delete an image

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
boolean
methodpublicdeleteServer(string $id) : boolean

Delete a server

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
boolean
methodpublicdeleteSharedIpGroup(integer $id) : boolean

Delete a Shared Ip Group

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
boolean
methodpublicdisableBackupSchedule(string $id) : boolean

Disable the backup schedule for a server

Parameters
NameTypeDescription
$idstring

server's Id

Returns
TypeDescription
boolean
methodpublicgetAuthUrl() : string
inherited

Get authentication URL

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

Get the backup schedule of a server

Parameters
NameTypeDescription
$idstring

server's Id

Returns
TypeDescription
array | boolean
methodpublicgetCdnUrl() : string | boolean
inherited

Get the CDN URL

Inherited from: \Zend_Service_Rackspace_Abstract::getCdnUrl()
Returns
TypeDescription
string | boolean
methodpublicgetErrorCode() : \strig
inherited

Get the error code of the last HTTP call

Inherited from: \Zend_Service_Rackspace_Abstract::getErrorCode()
Returns
TypeDescription
\strig
methodpublicgetErrorMsg() : string
inherited

Get the error msg of the last HTTP call

Inherited from: \Zend_Service_Rackspace_Abstract::getErrorMsg()
Returns
TypeDescription
string
methodpublicgetFlavor(string $flavorId) : array | boolean

Get the detail of a flavor

Parameters
NameTypeDescription
$flavorIdstring
Returns
TypeDescription
array | boolean
methodpublicgetHttpClient() : \Zend_Http_Client
inherited

get the HttpClient instance

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

Get detail about an image

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
\Zend_Service_Rackspace_Servers_Image | boolean
methodpublicgetKey() : string
inherited

Get user key

Inherited from: \Zend_Service_Rackspace_Abstract::getKey()
Returns
TypeDescription
string
methodpublicgetManagementUrl() : string | boolean
inherited

Get the management server URL

Inherited from: \Zend_Service_Rackspace_Abstract::getManagementUrl()
Returns
TypeDescription
string | boolean
methodpublicgetServer(string $id) : \Zend_Service_Rackspace_Servers_Server

Get the specified server

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
\Zend_Service_Rackspace_Servers_Server
methodpublicgetServerIp(string $id) : array | boolean

Get the server's IPs (public and private)

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
array | boolean
methodpublicgetServerPrivateIp(string $id) : array | boolean

Get the Private IPs of a server

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
array | boolean
methodpublicgetServerPublicIp(string $id) : array | boolean

Get the Public IPs of a server

Parameters
NameTypeDescription
$idstring
Returns
TypeDescription
array | boolean
methodpublicgetServiceNet() : boolean
inherited

Get whether we're using ServiceNet

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

Get the shared IP group

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
\Zend_Service_Rackspace_Servers_SharedIpGroup | boolean
methodpublicgetStorageUrl() : string | boolean
inherited

Get the storage URL

Inherited from: \Zend_Service_Rackspace_Abstract::getStorageUrl()
Returns
TypeDescription
string | boolean
methodpublicgetToken() : string
inherited

Get the authentication token

Inherited from: \Zend_Service_Rackspace_Abstract::getToken()
Returns
TypeDescription
string
methodpublicgetUser() : string
inherited

Get User account

Inherited from: \Zend_Service_Rackspace_Abstract::getUser()
Returns
TypeDescription
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
NameTypeDescription
$urlstring
$methodstring
$headersarray
$data
$bodystring
Returns
TypeDescription
\Zend_Http_Response
methodpublicisSuccessful() : boolean
inherited

Return true is the last call was successful

Inherited from: \Zend_Service_Rackspace_Abstract::isSuccessful()
Returns
TypeDescription
boolean
methodpubliclistFlavors(boolean $details = false) : array | boolean

Get the list of the flavors

If $details is true returns detail info

Parameters
NameTypeDescription
$detailsboolean
Returns
TypeDescription
array | boolean
methodpubliclistImages(boolean $details = false) : \Zend_Service_Rackspace_Servers_ImageList | boolean

Get the list of the images

Parameters
NameTypeDescription
$detailsboolean
Returns
TypeDescription
\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
NameTypeDescription
$detailsboolean
Returns
TypeDescription
\Zend_Service_Rackspace_Servers_ServerList | boolean
methodpubliclistSharedIpGroups(boolean $details = false) : \Zend_Service_Rackspace_Servers_SharedIpGroupList | boolean

Get the list of shared IP groups

Parameters
NameTypeDescription
$detailsboolean
Returns
TypeDescription
\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
NameTypeDescription
$idstring
$hardboolean
Returns
TypeDescription
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
NameTypeDescription
$idstring
$imageIdstring
Returns
TypeDescription
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
NameTypeDescription
$idstring
$flavorIdstring
Returns
TypeDescription
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
NameTypeDescription
$idstring
Returns
TypeDescription
boolean
methodpublicsetAuthUrl(string $url) : void
inherited

Set the Authentication URL

Inherited from: \Zend_Service_Rackspace_Abstract::setAuthUrl()
Parameters
NameTypeDescription
$urlstring
methodpublicsetKey(string $key) : void
inherited

Set the authentication key

Inherited from: \Zend_Service_Rackspace_Abstract::setKey()
Parameters
NameTypeDescription
$keystring
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
NameTypeDescription
$useServiceNetboolean
methodpublicsetUser(string $user) : void
inherited

Set the user account

Inherited from: \Zend_Service_Rackspace_Abstract::setUser()
Parameters
NameTypeDescription
$userstring
methodpublicshareIpAddress(string $id, string $ip, string $groupId,  $configure = true) : boolean

Share an ip address for a server (id)

Parameters
NameTypeDescription
$idstring

server

$ipstring
$groupIdstring
$configure
Returns
TypeDescription
boolean
methodpublicunshareIpAddress(string $id, string $ip) : boolean

Unshare IP address for a server ($id)

Parameters
NameTypeDescription
$idstring
$ipstring
Returns
TypeDescription
boolean
methodprotectedupdateServer(string $id, string $name = null, string $password = null) : boolean

Change the name or the admin password for a server

Parameters
NameTypeDescription
$idstring
$namestring
$passwordstring
Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.0.0a12.