Service/Rackspace/Servers.php
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
- Parent(s)
- \Zend_Service_Rackspace_Abstract
Constants
VERSION
= 'v1.0'- Inherited_from
- \Zend_Service_Rackspace_Abstract::VERSION
US_AUTH_URL
= 'https://auth.api.rackspacecloud.com'- Inherited_from
- \Zend_Service_Rackspace_Abstract::US_AUTH_URL
UK_AUTH_URL
= 'https://lon.auth.api.rackspacecloud.com'- Inherited_from
- \Zend_Service_Rackspace_Abstract::UK_AUTH_URL
API_FORMAT
= 'json'- Inherited_from
- \Zend_Service_Rackspace_Abstract::API_FORMAT
USER_AGENT
= 'Zend_Service_Rackspace'- Inherited_from
- \Zend_Service_Rackspace_Abstract::USER_AGENT
STORAGE_URL
= "X-Storage-Url"- Inherited_from
- \Zend_Service_Rackspace_Abstract::STORAGE_URL
AUTHTOKEN
= "X-Auth-Token"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHTOKEN
AUTHUSER_HEADER
= "X-Auth-User"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHUSER_HEADER
AUTHKEY_HEADER
= "X-Auth-Key"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHKEY_HEADER
AUTHUSER_HEADER_LEGACY
= "X-Storage-User"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHUSER_HEADER_LEGACY
AUTHKEY_HEADER_LEGACY
= "X-Storage-Pass"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHKEY_HEADER_LEGACY
AUTHTOKEN_LEGACY
= "X-Storage-Token"- Inherited_from
- \Zend_Service_Rackspace_Abstract::AUTHTOKEN_LEGACY
CDNM_URL
= "X-CDN-Management-Url"- Inherited_from
- \Zend_Service_Rackspace_Abstract::CDNM_URL
MANAGEMENT_URL
= "X-Server-Management-Url"- Inherited_from
- \Zend_Service_Rackspace_Abstract::MANAGEMENT_URL
Properties

string $errorCode =
- Type
- string
- Inherited_from
- \Zend_Service_Rackspace_Abstract::$$errorCode

\Zend_Http_Client $httpClient = - Type
- \Zend_Http_Client
- Inherited_from
- \Zend_Service_Rackspace_Abstract::$$httpClient

string $managementUrl =
- Type
- string
- Inherited_from
- \Zend_Service_Rackspace_Abstract::$$managementUrl

string $storageUrl =
- Type
- string
- Inherited_from
- \Zend_Service_Rackspace_Abstract::$$storageUrl

boolean $useServiceNet = false
falseDetails- Type
- boolean
- Inherited_from
- \Zend_Service_Rackspace_Abstract::$$useServiceNet
Methods

__construct(string $user, string $key, string $authUrl = self::US_AUTH_URL) : void
You must pass the account and the Rackspace authentication key. Optional: the authentication url (default is US)
| Name | Type | Description |
|---|---|---|
| $user | string | |
| $key | string | |
| $authUrl | string |

changeBackupSchedule(string $id, string $weekly, string $daily) : booleanChange the backup schedule of a server
| Name | Type | Description |
|---|---|---|
| $id | string | server's Id |
| $weekly | string | |
| $daily | string |
| Type | Description |
|---|---|
| boolean |

changeServerName(string $id, string $name) : booleanChange the server's name
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $name | string |
| Type | Description |
|---|---|
| boolean |

changeServerPassword(string $id, string $password) : booleanChange the admin password of the server
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $password | string |
| Type | Description |
|---|---|
| boolean |

confirmResizeServer(string $id) : booleanConfirm 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.
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

createImage(string $serverId, string $name) : \Zend_Service_Rackspace_Servers_ImageCreate an image for a serverId
| Name | Type | Description |
|---|---|---|
| $serverId | string | |
| $name | string |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_Image |

createServer(array $data, array $metadata = array(), array $files = array()) : \Zend_Service_Rackspace_Servers_Server | booleanCreate a new server
The required parameters are specified in $data (name, imageId, falvorId) The $files is an associative array with 'serverPath' => 'localPath'
| Name | Type | Description |
|---|---|---|
| $data | array | |
| $metadata | array | |
| $files | array |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_Server | boolean |

createSharedIpGroup(string $name, string $serverId) : array | booleanCreate a shared Ip group
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $serverId | string |
| Type | Description |
|---|---|
| array | boolean |

deleteImage(string $id) : booleanDelete an image
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

deleteServer(string $id) : booleanDelete a server
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

deleteSharedIpGroup(integer $id) : booleanDelete a Shared Ip Group
| Name | Type | Description |
|---|---|---|
| $id | integer |
| Type | Description |
|---|---|
| boolean |

disableBackupSchedule(string $id) : booleanDisable the backup schedule for a server
| Name | Type | Description |
|---|---|---|
| $id | string | server's Id |
| Type | Description |
|---|---|
| boolean |

getBackupSchedule(string $id) : array | booleanGet the backup schedule of a server
| Name | Type | Description |
|---|---|---|
| $id | string | server's Id |
| Type | Description |
|---|---|
| array | boolean |

getErrorCode() : \strigGet the error code of the last HTTP call
Inherited from: \Zend_Service_Rackspace_Abstract::getErrorCode()| Type | Description |
|---|---|
| \strig |

getErrorMsg() : stringGet the error msg of the last HTTP call
Inherited from: \Zend_Service_Rackspace_Abstract::getErrorMsg()| Type | Description |
|---|---|
| string |

getFlavor(string $flavorId) : array | booleanGet the detail of a flavor
| Name | Type | Description |
|---|---|---|
| $flavorId | string |
| Type | Description |
|---|---|
| array | boolean |

getHttpClient() : \Zend_Http_Clientget the HttpClient instance
Inherited from: \Zend_Service_Rackspace_Abstract::getHttpClient()| Type | Description |
|---|---|
| \Zend_Http_Client |

getImage(string $id) : \Zend_Service_Rackspace_Servers_Image | booleanGet detail about an image
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_Image | boolean |

getManagementUrl() : string | booleanGet the management server URL
Inherited from: \Zend_Service_Rackspace_Abstract::getManagementUrl()| Type | Description |
|---|---|
| string | boolean |

getServer(string $id) : \Zend_Service_Rackspace_Servers_ServerGet the specified server
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_Server |

getServerIp(string $id) : array | booleanGet the server's IPs (public and private)
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| array | boolean |

getServerPrivateIp(string $id) : array | booleanGet the Private IPs of a server
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| array | boolean |

getServerPublicIp(string $id) : array | booleanGet the Public IPs of a server
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| array | boolean |

getServiceNet() : booleanGet whether we're using ServiceNet
Inherited from: \Zend_Service_Rackspace_Abstract::getServiceNet()| Type | Description |
|---|---|
| boolean |

getSharedIpGroup(integer $id) : \Zend_Service_Rackspace_Servers_SharedIpGroup | booleanGet the shared IP group
| Name | Type | Description |
|---|---|---|
| $id | integer |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_SharedIpGroup | boolean |

httpCall(string $url, string $method, array $headers = array(), $data = array(), string $body = null) : \Zend_Http_Response
| Name | Type | Description |
|---|---|---|
| $url | string | |
| $method | string | |
| $headers | array | |
| $data | ||
| $body | string |
| Type | Description |
|---|---|
| \Zend_Http_Response |

isSuccessful() : booleanReturn true is the last call was successful
Inherited from: \Zend_Service_Rackspace_Abstract::isSuccessful()| Type | Description |
|---|---|
| boolean |

listFlavors(boolean $details = false) : array | booleanGet the list of the flavors
If $details is true returns detail info
| Name | Type | Description |
|---|---|---|
| $details | boolean |
| Type | Description |
|---|---|
| array | boolean |

listImages(boolean $details = false) : \Zend_Service_Rackspace_Servers_ImageList | booleanGet the list of the images
| Name | Type | Description |
|---|---|---|
| $details | boolean |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_ImageList | boolean |

listServers(boolean $details = false) : \Zend_Service_Rackspace_Servers_ServerList | booleanGet the list of the servers If $details is true returns detail info
| Name | Type | Description |
|---|---|---|
| $details | boolean |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_ServerList | boolean |

listSharedIpGroups(boolean $details = false) : \Zend_Service_Rackspace_Servers_SharedIpGroupList | booleanGet the list of shared IP groups
| Name | Type | Description |
|---|---|---|
| $details | boolean |
| Type | Description |
|---|---|
| \Zend_Service_Rackspace_Servers_SharedIpGroupList | boolean |

rebootServer(string $id, boolean $hard = false) : booleanReboot a server
$hard true is the equivalent of power cycling the server $hard false is a graceful shutdown
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $hard | boolean |
| Type | Description |
|---|---|
| boolean |

rebuildServer(string $id, string $imageId) : booleanRebuild 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.
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $imageId | string |
| Type | Description |
|---|---|
| boolean |

resizeServer(string $id, string $flavorId) : booleanResize 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.
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $flavorId | string |
| Type | Description |
|---|---|
| boolean |

revertResizeServer(string $id) : booleanRevert 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.
| Name | Type | Description |
|---|---|---|
| $id | string |
| Type | Description |
|---|---|
| boolean |

setServiceNet(boolean $useServiceNet = true) : voidSets whether to use ServiceNet
Inherited from: \Zend_Service_Rackspace_Abstract::setServiceNet()ServiceNet is Rackspace's internal network. Bandwidth on ServiceNet is not charged.
| Name | Type | Description |
|---|---|---|
| $useServiceNet | boolean |

shareIpAddress(string $id, string $ip, string $groupId, $configure = true) : booleanShare an ip address for a server (id)
| Name | Type | Description |
|---|---|---|
| $id | string | server |
| $ip | string | |
| $groupId | string | |
| $configure |
| Type | Description |
|---|---|
| boolean |

unshareIpAddress(string $id, string $ip) : booleanUnshare IP address for a server ($id)
| Name | Type | Description |
|---|---|---|
| $id | string | |
| $ip | string |
| Type | Description |
|---|---|
| boolean |