RakNet  4.0
Public Member Functions | Static Public Member Functions | List of all members
RakNet::Rackspace Class Reference

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

#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 (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, 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]_tcpInterfaceAn instance of TCPInterface, build with OPEN_SSL_CLIENT_SUPPORT 1 and already started
[in]_authenticationURLSee 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]_rackspaceCloudUsernameUsername you registered with Rackspace on their website
[in]_apiAccessKeyObtain 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]serverIdWhich 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]imageNameWhat 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]nameName of the server. Only alphanumeric characters, periods, and hyphens are valid. Server Name cannot start or end with a period or hyphen.
[in]imageIdWhich image (harddrive contents, including OS) to use
[in]flavorIdWhich 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]imageIdWhich 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]serverIdWhich 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]ipAddressWhich 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]flavorIdWhich 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]imageIdWhich 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]serverIdWhich 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]serverIdWhich 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]rebootTypeShould 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]imageIdWhich 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]flavorIdWhich 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]serverIdWhich 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]serverIdWhich server to operate on. You can call ListServers() to get the list of active servers.
[in]ipAddressWhich 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]serverIdWhich server to get details on. You can call ListServers() to get the list of active servers.
[in]newNameThe 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]newPasswordThe new server password. Leave blank to leave unchanged.

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