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
false
Details- 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) : boolean
Change 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) : boolean
Change the server's name
Name | Type | Description |
---|---|---|
$id | string | |
$name | string |
Type | Description |
---|---|
boolean |


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


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


createImage(string $serverId, string $name) : \Zend_Service_Rackspace_Servers_Image
Create 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 | boolean
Create 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 | boolean
Create a shared Ip group
Name | Type | Description |
---|---|---|
$name | string | |
$serverId | string |
Type | Description |
---|---|
array | boolean |


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


getSharedIpGroup(integer $id) : \Zend_Service_Rackspace_Servers_SharedIpGroup | boolean
Get 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() : boolean
Return true is the last call was successful
Inherited from: \Zend_Service_Rackspace_Abstract::isSuccessful()Type | Description |
---|---|
boolean |


listFlavors(boolean $details = false) : array | boolean
Get 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 | boolean
Get 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 | boolean
Get 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 | boolean
Get 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) : boolean
Reboot 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) : 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.
Name | Type | Description |
---|---|---|
$id | string | |
$imageId | string |
Type | Description |
---|---|
boolean |


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


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


setServiceNet(boolean $useServiceNet = true) : void
Sets 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) : boolean
Share 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) : boolean
Unshare IP address for a server ($id)
Name | Type | Description |
---|---|---|
$id | string | |
$ip | string |
Type | Description |
---|---|
boolean |