Class CloudDB::Connection
In: lib/clouddb/connection.rb
Parent: Object

Methods

Attributes

auth_url  [R] 
authkey  [R] 
authok  [RW] 
authtoken  [RW] 
authuser  [R] 
dbmgmthost  [RW] 
dbmgmtpath  [RW] 
dbmgmtport  [RW] 
dbmgmtscheme  [RW] 
region  [R] 

Public Class methods

Creates a new CloudDB::Connection object. Uses CloudDB::Authentication to perform the login for the connection.

Setting the retry_auth option to false will cause an exception to be thrown if your authorization token expires. Otherwise, it will attempt to re-authenticate.

This will likely be the base class for most operations.

The constructor takes a hash of options, including:

  :username - Your Rackspace Cloud username *required*
  :api_key - Your Rackspace Cloud API key *required*
  :region - The region in which to manage database instances. Current options are :dfw (Rackspace Dallas/Ft. Worth
            Datacenter), :ord (Rackspace Chicago Datacenter) and :lon (Rackspace London Datacenter). *required*
  :auth_url - The URL to use for authentication.  (defaults to Rackspace USA).
  :retry_auth - Whether to retry if your auth token expires (defaults to true)

Example:

  dbaas = CloudDB::Connection.new(:username => 'YOUR_USERNAME', :api_key => 'YOUR_API_KEY', :region => :dfw)

Public Instance methods

Returns true if the authentication was successful and returns false otherwise.

Example:

  dbaas.authok?
  => true

Creates a brand new database instance under your account.

Options:

  :flavor_ref - reference to a flavor as specified in the response from the List Flavors API call. *required*
  :name - the name of the database instance.  Limited to 128 characters or less. *required*
  :size - specifies the volume size in gigabytes (GB). The value specified must be between 1 and 10. *required*
  :databases - the databases to be created for the instance.
  :users - the users to be created for the instance.

Example:

  i = dbaas.create_instance(:flavor_ref => "https://ord.databases.api.rackspacecloud.com/v1.0/1234/flavors/1",
                            :name => "test_instance",
                            :volume => {:size => "1"},
                            :databases => [{:name => "testdb"}],
                            :users => [{:name => "test",
                                        :password => "test",
                                        :databases => [{:name => "testdb"}]}
                                      ]
                           )
flavor(id)

Alias for get_flavor

flavors()

Alias for list_flavors

flavors_detail()

Returns a CloudDB::Flavor object for the given flavor id number.

Example:

  dbaas.get_flavor(3)

Returns a CloudDB::Instance object for the given instance ID number.

Example:

  dbaas.get_instance(692d8418-7a8f-47f1-8060-59846c6e024f)
instance(id)

Alias for get_instance

instances()

Alias for list_instances

instances_detail()

Returns the list of available database flavors.

Information returned includes:

  :id - The numeric id of this flavor
  :name - The name of the flavor
  :links - Useful information regarding the flavor

Returns the list of available database flavors in detail.

Information returned includes:

  :id - The numeric id of this flavor
  :name - The name of the flavor
  :vcpus - The amount of virtual cpu power
  :ram - The available memory in MB
  :links - Useful information regarding the flavor

Returns the list of available database instances.

Information returned includes:

  :id - The numeric id of the instance.
  :name - The name of the instance.
  :status - The current state of the instance (BUILD, ACTIVE, BLOCKED, RESIZE, SHUTDOWN, FAILED).

Returns the list of available database instances with detail.

Information returned includes:

  :id - The numeric ID of the instance.
  :name - The name of the instance.
  :status - The current state of the instance (BUILD, ACTIVE, BLOCKED, RESIZE, SHUTDOWN, FAILED).
  :hostname - A DNS-resolvable hostname associated with the database instance.
  :flavor - The flavor of the instance.
  :volume - The volume size of the instance.
  :created - The time when the instance was created.
  :updated - The time when the instance was last updated.

[Validate]