#include <Rackspace.h>
Public Member Functions | |
SystemAddress | Authenticate (TCPInterface *_tcpInterface, const char *_authenticationURL, const char *_rackspaceCloudUsername, const char *_apiAccessKey) |
Authenticate with Rackspace servers, required before executing any commands. | |
void | ListServers (void) |
Get a list of running servers. | |
void | ListServersWithDetails (void) |
Get a list of running servers, with extended details on each server. | |
void | CreateServer (RakNet::RakString name, RakNet::RakString imageId, RakNet::RakString flavorId) |
Create a server. | |
void | GetServerDetails (RakNet::RakString serverId) |
Get details on a particular server. | |
void | UpdateServerNameOrPassword (RakNet::RakString serverId, RakNet::RakString newName, RakNet::RakString newPassword) |
Changes the name or password for a server. | |
void | DeleteServer (RakNet::RakString serverId) |
Deletes a server. | |
void | ListServerAddresses (RakNet::RakString serverId) |
Lists the IP addresses available to a server. | |
void | ShareServerAddress (RakNet::RakString serverId, RakNet::RakString ipAddress) |
Shares an IP address with a server. | |
void | DeleteServerAddress (RakNet::RakString serverId, RakNet::RakString ipAddress) |
Stops sharing an IP address with a server. | |
void | RebootServer (RakNet::RakString serverId, RakNet::RakString rebootType) |
Reboots a server. | |
void | RebuildServer (RakNet::RakString serverId, RakNet::RakString imageId) |
Rebuilds a server with a different image (harddrive contents). | |
void | ResizeServer (RakNet::RakString serverId, RakNet::RakString flavorId) |
Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer(). | |
void | ConfirmResizedServer (RakNet::RakString serverId) |
Confirm a resize for the specified server. | |
void | RevertResizedServer (RakNet::RakString serverId) |
Reverts a resize for the specified server. | |
void | ListFlavors (void) |
List all flavors (hardware configs, primarily memory). | |
void | GetFlavorDetails (RakNet::RakString flavorId) |
Get extended details about a specific flavor. | |
void | ListImages (void) |
List all images (software configs, including operating systems), which includes images you create yourself. | |
void | CreateImage (RakNet::RakString serverId, RakNet::RakString imageName) |
Images a running server. This essentially copies the harddrive, and lets you start a server with the same harddrive contents later. | |
void | GetImageDetails (RakNet::RakString imageId) |
Get extended details about a particular image. | |
void | DeleteImage (RakNet::RakString imageId) |
Delete a custom image created with CreateImage(). | |
void | ListSharedIPGroups (void) |
List IP groups. | |
void | ListSharedIPGroupsWithDetails (void) |
List IP groups with extended details. | |
void | AddEventCallback (RackspaceEventCallback *callback) |
Adds a callback to the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added. | |
void | RemoveEventCallback (RackspaceEventCallback *callback) |
Removes a callback from the list of callbacks to be called when any of the above functions finish executing The callbacks are called in the order they are added. | |
void | ClearEventCallbacks (void) |
Removes all callbacks. | |
void | OnReceive (Packet *packet) |
Call this anytime TCPInterface returns a packet. | |
void | OnClosedConnection (SystemAddress systemAddress) |
Call this when TCPInterface returns something other than UNASSIGNED_SYSTEM_ADDRESS from HasLostConnection(). | |
void | AddOperation (RackspaceOperationType type, RakNet::RakString httpCommand, RakNet::RakString operation, RakNet::RakString xml) |
Mostly for internal use, but you can use it to execute an operation with more complex xml if desired See the Rackspace.cpp on how to use it. | |
Static Public Member Functions | |
static const char * | EventTypeToString (RackspaceEventType eventType) |
String representation of each RackspaceEventType. |
Packets returned from TCPInterface::OnReceive() must be passed to Rackspace::OnReceive()
Packets returned from TCPInterface::HasLostConnection() must be passed to Rackspace::OnClosedConnection()
SystemAddress RakNet::Rackspace::Authenticate | ( | TCPInterface * | _tcpInterface, | |
const char * | _authenticationURL, | |||
const char * | _rackspaceCloudUsername, | |||
const char * | _apiAccessKey | |||
) |
Authenticate with Rackspace servers, required before executing any commands.
All requests to authenticate and operate against Cloud Servers are performed using SSL over HTTP (HTTPS) on TCP port 443. Times out after 24 hours - if you get RET_Authenticate_Unauthorized in the RackspaceEventCallback callback, call again
[in] | _tcpInterface | An instance of TCPInterface, build with OPEN_SSL_CLIENT_SUPPORT 1 and already started |
[in] | _authenticationURL | See http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf . US-based accounts authenticate through auth.api.rackspacecloud.com. UK-based accounts authenticate through lon.auth.api.rackspacecloud.com |
[in] | _rackspaceCloudUsername | Username you registered with Rackspace on their website |
[in] | _apiAccessKey | Obtain your API access key from the Rackspace Cloud Control Panel in the Your Account API Access section. |
void RakNet::Rackspace::ConfirmResizedServer | ( | RakNet::RakString | serverId | ) |
Confirm a resize for the specified server.
RackspaceEventCallback::OnConfirmResizedServerResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
void RakNet::Rackspace::CreateImage | ( | RakNet::RakString | serverId, | |
RakNet::RakString | imageName | |||
) |
Images a running server. This essentially copies the harddrive, and lets you start a server with the same harddrive contents later.
RackspaceEventCallback::OnCreateImageResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | imageName | What to call this image |
void RakNet::Rackspace::CreateServer | ( | RakNet::RakString | name, | |
RakNet::RakString | imageId, | |||
RakNet::RakString | flavorId | |||
) |
Create a server.
Create a server with a given image (harddrive contents) and flavor (hardware configuration) Get the available images with ListImages() Get the available flavors with ListFlavors() It is possible to configure the server in more detail. See the XML schema at http://docs.rackspacecloud.com/servers/api/v1.0 You can execute such a custom command by calling AddOperation() manually. See the implementation of CreateServer for how to do so. The server takes a while to build. Call GetServerDetails() to get the current build status. Server id to pass to GetServerDetails() is returned in the field <server ... id="1234">
RackspaceEventCallback::OnCreateServerResult()
[in] | name | Name of the server. Only alphanumeric characters, periods, and hyphens are valid. Server Name cannot start or end with a period or hyphen. |
[in] | imageId | Which image (harddrive contents, including OS) to use |
[in] | flavorId | Which flavor (hardware config) to use, primarily how much memory is available. |
void RakNet::Rackspace::DeleteImage | ( | RakNet::RakString | imageId | ) |
Delete a custom image created with CreateImage().
RackspaceEventCallback::OnDeleteImageResult()
[in] | imageId | Which image |
void RakNet::Rackspace::DeleteServer | ( | RakNet::RakString | serverId | ) |
Deletes a server.
RackspaceEventCallback::OnDeleteServerResult()
[in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers. |
void RakNet::Rackspace::DeleteServerAddress | ( | RakNet::RakString | serverId, | |
RakNet::RakString | ipAddress | |||
) |
Stops sharing an IP address with a server.
RackspaceEventCallback::OnDeleteServerAddressResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | ipAddress | Which IP address. You can call ListServerAddresses() to get the list of addresses for the specified server |
void RakNet::Rackspace::GetFlavorDetails | ( | RakNet::RakString | flavorId | ) |
Get extended details about a specific flavor.
RackspaceEventCallback::OnGetFlavorDetailsResult()
[in] | flavorId | Which flavor (hardware config) |
void RakNet::Rackspace::GetImageDetails | ( | RakNet::RakString | imageId | ) |
Get extended details about a particular image.
RackspaceEventCallback::OnGetImageDetailsResult()
[in] | imageId | Which image |
void RakNet::Rackspace::GetServerDetails | ( | RakNet::RakString | serverId | ) |
Get details on a particular server.
RackspaceEventCallback::OnGetServerDetailsResult()
[in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers. |
void RakNet::Rackspace::ListFlavors | ( | void | ) |
List all flavors (hardware configs, primarily memory).
RackspaceEventCallback::OnListFlavorsResult()
void RakNet::Rackspace::ListImages | ( | void | ) |
List all images (software configs, including operating systems), which includes images you create yourself.
RackspaceEventCallback::OnListImagesResult()
void RakNet::Rackspace::ListServerAddresses | ( | RakNet::RakString | serverId | ) |
Lists the IP addresses available to a server.
RackspaceEventCallback::OnListServerAddressesResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
void RakNet::Rackspace::ListServers | ( | void | ) |
Get a list of running servers.
RackspaceEventCallback::OnListServersResult()
void RakNet::Rackspace::ListServersWithDetails | ( | void | ) |
Get a list of running servers, with extended details on each server.
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
RackspaceEventCallback::OnListServersWithDetailsResult()
void RakNet::Rackspace::ListSharedIPGroups | ( | void | ) |
List IP groups.
RackspaceEventCallback::OnListSharedIPGroupsResult()
void RakNet::Rackspace::ListSharedIPGroupsWithDetails | ( | void | ) |
List IP groups with extended details.
RackspaceEventCallback::OnListSharedIPGroupsWithDetailsResult()
void RakNet::Rackspace::RebootServer | ( | RakNet::RakString | serverId, | |
RakNet::RakString | rebootType | |||
) |
Reboots a server.
RackspaceEventCallback::OnRebootServerResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | rebootType | Should be either "HARD" or "SOFT" |
void RakNet::Rackspace::RebuildServer | ( | RakNet::RakString | serverId, | |
RakNet::RakString | imageId | |||
) |
Rebuilds a server with a different image (harddrive contents).
RackspaceEventCallback::OnRebuildServerResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | imageId | Which image (harddrive contents, including OS) to use |
void RakNet::Rackspace::ResizeServer | ( | RakNet::RakString | serverId, | |
RakNet::RakString | flavorId | |||
) |
Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer().
RackspaceEventCallback::OnResizeServerResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | flavorId | Which flavor (hardware config) to use, primarily how much memory is available. |
void RakNet::Rackspace::RevertResizedServer | ( | RakNet::RakString | serverId | ) |
Reverts a resize for the specified server.
RackspaceEventCallback::OnRevertResizedServerResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
void RakNet::Rackspace::ShareServerAddress | ( | RakNet::RakString | serverId, | |
RakNet::RakString | ipAddress | |||
) |
Shares an IP address with a server.
RackspaceEventCallback::OnShareServerAddressResult()
[in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers. |
[in] | ipAddress | Which IP address. You can call ListServerAddresses() to get the list of addresses for the specified server |
void RakNet::Rackspace::UpdateServerNameOrPassword | ( | RakNet::RakString | serverId, | |
RakNet::RakString | newName, | |||
RakNet::RakString | newPassword | |||
) |
Changes the name or password for a server.
RackspaceEventCallback::OnUpdateServerNameOrPasswordResult()
[in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers. |
[in] | newName | The new server name. Leave blank to leave unchanged. Only alphanumeric characters, periods, and hyphens are valid. Server Name cannot start or end with a period or hyphen. |
[in] | newPassword | The new server password. Leave blank to leave unchanged. |