RakNet::Rackspace Class Reference

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

#include <Rackspace.h>

List of all members.

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.


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()


Member Function Documentation

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

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 RakNet::Rackspace::ConfirmResizedServer ( RakNet::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.

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.

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 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">

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 RakNet::Rackspace::DeleteImage ( RakNet::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 RakNet::Rackspace::DeleteServer ( RakNet::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 RakNet::Rackspace::DeleteServerAddress ( RakNet::RakString  serverId,
RakNet::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 RakNet::Rackspace::GetFlavorDetails ( RakNet::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 RakNet::Rackspace::GetImageDetails ( RakNet::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

void RakNet::Rackspace::GetServerDetails ( RakNet::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 RakNet::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 RakNet::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 RakNet::Rackspace::ListServerAddresses ( RakNet::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 RakNet::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 RakNet::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 RakNet::Rackspace::ListSharedIPGroups ( void   ) 

List IP groups.

See also:
http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20110112.pdf

RackspaceEventCallback::OnListSharedIPGroupsResult()

void RakNet::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 RakNet::Rackspace::RebootServer ( RakNet::RakString  serverId,
RakNet::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 RakNet::Rackspace::RebuildServer ( RakNet::RakString  serverId,
RakNet::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 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().

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 RakNet::Rackspace::RevertResizedServer ( RakNet::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 RakNet::Rackspace::ShareServerAddress ( RakNet::RakString  serverId,
RakNet::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 RakNet::Rackspace::UpdateServerNameOrPassword ( RakNet::RakString  serverId,
RakNet::RakString  newName,
RakNet::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.


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

Generated on Wed Feb 1 13:33:47 2012 for RakNet by  doxygen 1.5.7.1