SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::Rackspace Class Reference

Code that uses the TCPInterface class to communicate with the Rackspace API servers. More...

`#include <slikenet/Rackspace.h>`

## Classes

struct | RackspaceOperation

## Public Member Functions

| Rackspace ()
| ~Rackspace ()
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 (SLNet::RakString name, SLNet::RakString imageId, SLNet::RakString flavorId)
| Create a server.
void | GetServerDetails (SLNet::RakString serverId)
| Get details on a particular server.
void | UpdateServerNameOrPassword (SLNet::RakString serverId, SLNet::RakString newName, SLNet::RakString newPassword)
| Changes the name or password for a server.
void | DeleteServer (SLNet::RakString serverId)
| Deletes a server.
void | ListServerAddresses (SLNet::RakString serverId)
| Lists the IP addresses available to a server.
void | ShareServerAddress (SLNet::RakString serverId, SLNet::RakString ipAddress)
| Shares an IP address with a server.
void | DeleteServerAddress (SLNet::RakString serverId, SLNet::RakString ipAddress)
| Stops sharing an IP address with a server.
void | RebootServer (SLNet::RakString serverId, SLNet::RakString rebootType)
| Reboots a server.
void | RebuildServer (SLNet::RakString serverId, SLNet::RakString imageId)
| Rebuilds a server with a different image (harddrive contents)
void | ResizeServer (SLNet::RakString serverId, SLNet::RakString flavorId)
| Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer()
void | ConfirmResizedServer (SLNet::RakString serverId)
| Confirm a resize for the specified server.
void | RevertResizedServer (SLNet::RakString serverId)
| Reverts a resize for the specified server.
void | ListFlavors (void)
| List all flavors (hardware configs, primarily memory)
void | GetFlavorDetails (SLNet::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 (SLNet::RakString serverId, SLNet::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 (SLNet::RakString imageId)
| Get extended details about a particular image.
void | DeleteImage (SLNet::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 | CreateSharedIPGroup (SLNet::RakString name, SLNet::RakString optionalServerId)
void | GetSharedIPGroupDetails (SLNet::RakString groupId)
void | DeleteSharedIPGroup (SLNet::RakString groupId)
void | AddEventCallback (Rackspace2EventCallback *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 (Rackspace2EventCallback *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, SLNet::RakString httpCommand, SLNet::RakString operation, SLNet::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.

## Protected Member Functions

bool | HasOperationOfType (RackspaceOperationType t)
unsigned int | GetOperationOfTypeIndex (RackspaceOperationType t)
bool | ExecuteOperation (RackspaceOperation &ro)
void | ReadLine (const char *data, const char *stringStart, SLNet::RakString &output)
bool | ConnectToServerManagementDomain (RackspaceOperation &ro)

## Protected Attributes

DataStructures::List < Rackspace2EventCallback * > | eventCallbacks
TCPInterface * | tcpInterface
DataStructures::List < RackspaceOperation > | operations
SLNet::RakString | serverManagementURL
SLNet::RakString | serverManagementDomain
SLNet::RakString | serverManagementPath
SLNet::RakString | storageURL
SLNet::RakString | storageDomain
SLNet::RakString | storagePath
SLNet::RakString | cdnManagementURL
SLNet::RakString | cdnManagementDomain
SLNet::RakString | cdnManagementPath
SLNet::RakString | storageToken
SLNet::RakString | authToken
SLNet::RakString | rackspaceCloudUsername
SLNet::RakString | apiAccessKey

## Detailed Description

Code that uses the TCPInterface class to communicate with the Rackspace API servers.

Precondition
  Compile RakNet with OPEN_SSL_CLIENT_SUPPORT set to 1
  Packets returned from TCPInterface::OnReceive() must be passed to Rackspace::OnReceive()
  Packets returned from TCPInterface::HasLostConnection() must be passed to Rackspace::OnClosedConnection()

Definition at line 171 of file Rackspace.h.

## Class Documentation

struct SLNet::Rackspace::RackspaceOperation

Definition at line 371 of file Rackspace.h.

Class Members
SystemAddress | connectionAddress |
RakString | httpCommand |
RakString | incomingStream |
bool | isPendingAuthentication |
RakString | operation |
RackspaceOperationType | type |
RakString | xml |

## Constructor & Destructor Documentation

SLNet::Rackspace::Rackspace | ( |  | ) |

SLNet::Rackspace::~Rackspace | ( |  | ) |

## Member Function Documentation

void SLNet::Rackspace::AddEventCallback | ( | Rackspace2EventCallback * | 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 SLNet::Rackspace::AddOperation | ( | RackspaceOperationType | type,
|  | SLNet::RakString | httpCommand,
|  | SLNet::RakString | operation,
|  | SLNet::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.

SystemAddress SLNet::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

See Also
  RackspaceEventCallback::OnAuthenticationResult()

Parameters

  [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.

Returns
  The address of the authentication server, or UNASSIGNED_SYSTEM_ADDRESS if the connection attempt failed

void SLNet::Rackspace::ClearEventCallbacks | ( | void |  | ) |

Removes all callbacks.

void SLNet::Rackspace::ConfirmResizedServer | ( | SLNet::RakString | serverId | ) |

Confirm a resize for the specified server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnConfirmResizedServerResult()
  ResizeServer()

Parameters

  [in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.

bool SLNet::Rackspace::ConnectToServerManagementDomain | ( | RackspaceOperation & | ro | ) |

protected

void SLNet::Rackspace::CreateImage | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | imageName
| ) |  |

Images a running server. This essentially copies the harddrive, and lets you start a server with the same harddrive contents later.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnCreateImageResult()
  ListImages()

Parameters

  [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 SLNet::Rackspace::CreateServer | ( | SLNet::RakString | name,
|  | SLNet::RakString | imageId,
|  | SLNet::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">

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnCreateServerResult()

Parameters

  [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 SLNet::Rackspace::CreateSharedIPGroup | ( | SLNet::RakString | name,
|  | SLNet::RakString | optionalServerId
| ) |  |

void SLNet::Rackspace::DeleteImage | ( | SLNet::RakString | imageId | ) |

Delete a custom image created with CreateImage()

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnDeleteImageResult()
  ListImages()

Parameters

  [in] | imageId | Which image

void SLNet::Rackspace::DeleteServer | ( | SLNet::RakString | serverId | ) |

Deletes a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnDeleteServerResult()

Parameters

  [in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers.

void SLNet::Rackspace::DeleteServerAddress | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | ipAddress
| ) |  |

Stops sharing an IP address with a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnDeleteServerAddressResult()

Parameters

  [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 SLNet::Rackspace::DeleteSharedIPGroup | ( | SLNet::RakString | groupId | ) |

static const char* SLNet::Rackspace::EventTypeToString | ( | RackspaceEventType | eventType | ) |

static

String representation of each RackspaceEventType.

bool SLNet::Rackspace::ExecuteOperation | ( | RackspaceOperation & | ro | ) |

protected

void SLNet::Rackspace::GetFlavorDetails | ( | SLNet::RakString | flavorId | ) |

Get extended details about a specific flavor.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnGetFlavorDetailsResult()
  ListFlavors()

Parameters

  [in] | flavorId | Which flavor (hardware config)

void SLNet::Rackspace::GetImageDetails | ( | SLNet::RakString | imageId | ) |

Get extended details about a particular image.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnGetImageDetailsResult()
  ListImages()

Parameters

  [in] | imageId | Which image

unsigned int SLNet::Rackspace::GetOperationOfTypeIndex | ( | RackspaceOperationType | t | ) |

protected

void SLNet::Rackspace::GetServerDetails | ( | SLNet::RakString | serverId | ) |

Get details on a particular server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnGetServerDetailsResult()

Parameters

  [in] | serverId | Which server to get details on. You can call ListServers() to get the list of active servers.

void SLNet::Rackspace::GetSharedIPGroupDetails | ( | SLNet::RakString | groupId | ) |

bool SLNet::Rackspace::HasOperationOfType | ( | RackspaceOperationType | t | ) |

protected

void SLNet::Rackspace::ListFlavors | ( | void |  | ) |

List all flavors (hardware configs, primarily memory)

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListFlavorsResult()

void SLNet::Rackspace::ListImages | ( | void |  | ) |

List all images (software configs, including operating systems), which includes images you create yourself.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListImagesResult()
  CreateImage()

void SLNet::Rackspace::ListServerAddresses | ( | SLNet::RakString | serverId | ) |

Lists the IP addresses available to a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListServerAddressesResult()

Parameters

  [in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.

void SLNet::Rackspace::ListServers | ( | void |  | ) |

Get a list of running servers.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListServersResult()

void SLNet::Rackspace::ListServersWithDetails | ( | void |  | ) |

Get a list of running servers, with extended details on each server.

See Also
  GetServerDetails()
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListServersWithDetailsResult()

void SLNet::Rackspace::ListSharedIPGroups | ( | void |  | ) |

List IP groups.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListSharedIPGroupsResult()

void SLNet::Rackspace::ListSharedIPGroupsWithDetails | ( | void |  | ) |

List IP groups with extended details.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnListSharedIPGroupsWithDetailsResult()

void SLNet::Rackspace::OnClosedConnection | ( | SystemAddress | systemAddress | ) |

Call this when TCPInterface returns something other than UNASSIGNED_SYSTEM_ADDRESS from HasLostConnection()

void SLNet::Rackspace::OnReceive | ( | Packet * | packet | ) |

Call this anytime TCPInterface returns a packet.

void SLNet::Rackspace::ReadLine | ( | const char * | data,
|  | const char * | stringStart,
|  | SLNet::RakString & | output
| ) |  |

protected

void SLNet::Rackspace::RebootServer | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | rebootType
| ) |  |

Reboots a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnRebootServerResult()

Parameters

  [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 SLNet::Rackspace::RebuildServer | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | imageId
| ) |  |

Rebuilds a server with a different image (harddrive contents)

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnRebuildServerResult()

Parameters

  [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 SLNet::Rackspace::RemoveEventCallback | ( | Rackspace2EventCallback * | 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 SLNet::Rackspace::ResizeServer | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | flavorId
| ) |  |

Changes the hardware configuration of a server. This does not take effect until you call ConfirmResizedServer()

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnResizeServerResult()
  RevertResizedServer()

Parameters

  [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 SLNet::Rackspace::RevertResizedServer | ( | SLNet::RakString | serverId | ) |

Reverts a resize for the specified server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnRevertResizedServerResult()
  ResizeServer()

Parameters

  [in] | serverId | Which server to operate on. You can call ListServers() to get the list of active servers.

void SLNet::Rackspace::ShareServerAddress | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | ipAddress
| ) |  |

Shares an IP address with a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnShareServerAddressResult()

Parameters

  [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 SLNet::Rackspace::UpdateServerNameOrPassword | ( | SLNet::RakString | serverId,
|  | SLNet::RakString | newName,
|  | SLNet::RakString | newPassword
| ) |  |

Changes the name or password for a server.

See Also
  http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf
  RackspaceEventCallback::OnUpdateServerNameOrPasswordResult()

Parameters

  [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.

## Member Data Documentation

SLNet::RakString SLNet::Rackspace::apiAccessKey

protected

Definition at line 405 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::authToken

protected

Definition at line 403 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementDomain

protected

Definition at line 399 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementPath

protected

Definition at line 400 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::cdnManagementURL

protected

Definition at line 398 of file Rackspace.h.

DataStructures::List<Rackspace2EventCallback*> SLNet::Rackspace::eventCallbacks

protected

Definition at line 369 of file Rackspace.h.

DataStructures::List<RackspaceOperation> SLNet::Rackspace::operations

protected

Definition at line 388 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::rackspaceCloudUsername

protected

Definition at line 404 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementDomain

protected

Definition at line 393 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementPath

protected

Definition at line 394 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::serverManagementURL

protected

Definition at line 392 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageDomain

protected

Definition at line 396 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storagePath

protected

Definition at line 397 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageToken

protected

Definition at line 402 of file Rackspace.h.

SLNet::RakString SLNet::Rackspace::storageURL

protected

Definition at line 395 of file Rackspace.h.

TCPInterface* SLNet::Rackspace::tcpInterface

protected

Definition at line 383 of file Rackspace.h.

The documentation for this class was generated from the following file:

- Source/include/slikenet/Rackspace.h