API

cloudcontrol

From GoGrid



This is the GoGrid cloudcenter command line tool called cloudcontrol. This is a BETA release. It has not been tested on all OS platforms and results may vary. You can download the jar file from the downloads section below.


GoGrid's cloudcontrol command line tool is currently licensed under the LGPL and the source code can be found on GitHub. This tool is specifically designed to work with the GoGrid cloudcenter OpenSpec.

Contents

Prerequisites

  • Java JDK or JRE 1.5 or Higher

Downloads

Command Line Help

To get command line usage, enter the following:

% java –jar cloudcontrol.jar -h

This is a simple wrapper around cloudcenter API functionality and does not provide any particular logic of its own. The GoGrid cloudcontrol utility provides usage notes by giving it a -help command line option.

CloudControl Required Arguments

Required Name Type Description
Required api string Specify the Cloud provider URL (e.g. api.gogrid.com) or environment variable CC_API.
  key string The user key credential for provider access or environment variable CC_KEY.
secret string The user secret credential for provider access or environment variable CC_SECRET.

Commands

Commands Name Type Description
Commands -list string Show information about your servers, load balancers, etc.:
  • servers -servertype <type>
  • loadbalancers
  • images
  • ips -state {assigned | unassigned} -type {public | private}
  • passwords
  • billingsummary
  • lookups -type
  -create string Create a new server, load balancer, etc.:
  • server -name <name> -image <image> -ram <ram> -ip <public_ip> -desc <description>
  • loadbalancer -name <name> -ip <virtual_ip> -port <virtual_port> -ip <real_ip1 real_ip2> -ports <real_port1 real_port2> -desc <description> -type <type> -persistence <persistence>
-delete string Delete a server, load balancer, etc.:
  • server -name <name> | -id <id>
  • loadbalancer -name <name> | -id <id>
-startserver string Start a server:
  • -name <name> | -id <id>
-stopserver string Stop a server:
  • -name <name> | -id <id>
-bootserver string Boot a server:
  • -name <name> | -id <id>
-help string Display the help screen
  • <command> -help

Examples

List All Assigned Public IP Addresses

To display all assigned public IP addresses, enter the following command:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list ips -state assigned -type public

An example of usage and output:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list ips -state assigned -type public
Id         IP                   Subnet                         Public    
1345       218.111.97.64        218.111.97.64/255.255.255.240  true      
1346       218.111.97.65        218.111.97.64/255.255.255.240  true      
1351       218.111.97.70        218.111.97.64/255.255.255.240  true      
1352       218.111.97.71        218.111.97.64/255.255.255.240  true      
1353       218.111.97.72        218.111.97.64/255.255.255.240  true      
1360       218.111.97.79        218.111.97.64/255.255.255.240  true 

Where KEY is your GoGrid API key and SECRET is your GoGrid shared secret password.

List All Servers in your GoGrid Cloud

Another example of usage to list all servers in your GoGrid cloud:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list servers
Id         Name                           Friendly name                            Description                                        Public    
1          centos44_32_apache22php5       CentOS 4.4 (32-bit) w/ Apache 2.2 + PHP5 CentOS 4.4 (32-bit) w/ Apache 2.2 + PHP5           true      
2          rhel4_32_apache22php5          RHEL 4 (32-bit) w/ Apache 2.2 + PHP5     RHEL 4 (32-bit) w/ Apache 2.2 + PHP5               true      
3          w2k3r2dc_32_iis6               Windows 2003 (32-bit) w/ IIS 6.0         Windows 2003 (32-bit) w/ IIS 6.0                   true      
4          centos44_32_mysql5             CentOS 4.4 (32-bit) w/ MySQL 5.0         CentOS 4.4 (32-bit) w/ MySQL 5.0                   true      
5          rhel4_32_mysql5                RHEL 4 (32-bit) w/ MySQL 5.0             RHEL 4 (32-bit) w/ MySQL 5.0                       true      
6          w2k3r2dc_32_mssql2k5wg         Windows 2003 (32-bit) w/ MSSQL 2005 Work Windows 2003 (32-bit) w/ MSSQL 2005 Workgroup      true      
7          w2k3r2dc_32_mssql2k5std        Windows 2003 (32-bit) w/ MSSQL 2005 Stan Windows 2003 (32-bit) w/ MSSQL 2005 Standard       true      
8          centos45_32_pgsql              CentOS 4.5 (32-bit) w/ PostgreSQL 8.2    CentOS 4.5 (32-bit) w/ PostgreSQL 8.2              true      
9          rhel44_32_pgsql                RHEL 4 (32-bit) w/ PostgreSQL 8.2        RHEL 4 (32-bit) w/ PostgreSQL 8.2                  true  

List all Unassigned Public IP's in your GoGrid Cloud

To list all unassigned public IP's available in your GoGrid cloud, enter the following command:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list ips -type public -state unassigned

The output should be similar to the following:

Id         IP                   Subnet                         Public    
1345       218.111.97.64        218.111.97.64/255.255.255.0    true      

Create a Server in your GoGrid Cloud

To create a new server with the IP address of 218.111.97.64 using the RHEL 4 (32-bit) w/ PostgreSQL 8.2 server image with 512MB RAM, enter the following command:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -create server -name Test_Server -image rhel44_32_pgsql -ram 512MB -ip 218.111.97.64 -desc "My First Test Server"

Start a Server instance in your GoGrid Cloud

To start an existing server instance with the name Test Server and an id 1895, enter the following:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -startserver -name Test_Server 

Delete a Server Instance in your GoGrid Cloud

To delete an existing server instance with the name Test Server and an id of 1895, enter the following:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -delete -id 1895

Known Issues

There is currently a deficiency in the way the back-end of GoGrid and the API work together. This is being addressed in the next version release of the API. The result is that it is not obvious when a server is finished being instantiated. To determine when a server has finished being instantiated, the Id returned will no longer be a '0'.


For example, the following output insinuates that your server has not finished being deployed:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list servers
Id         Name                 Description                             
0          test1                Test Box                  

When the server is deployed and has started, the Id will be populated with a number:

% java -jar cloudcontrol.jar -key KEY -secret SECRET -api api.gogrid.com -list servers
Id         Name                 Description                             
18321      test1                Test Box  
Personal tools