# Databases v1

## Setup

### Rackspace setup

The first step is to pass in your credentials and set up a client. For Rackspace users, you will need your username and API key:

    use OpenCloud\Rackspace;

    $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
      'username' => '{username}',
      'apiKey'   => '{apiKey}',
    ));

### OpenStack setup

If you’re an OpenStack user, you will also need to prove a few other configuration parameters:

    $client = new OpenCloud\OpenStack('{keystoneUrl}', array(
      'username' => '{username}',
      'password' => '{apiKey}',
      'tenantId' => '{tenantId}',
    ));

### Databases service

Now to instantiate the Databases service:

    $service = $client->databaseService('{catalogName}', '{region}', '{urlType}');

- `{catalogName}` is the name of the service as it appears in the service catalog. OpenStack users must set this value. For Rackspace users, a default will be provided if you pass in `null`.
- `{region}` is the region the service will operate in. For Rackspace users, you can select one of the following from the supported regions page.
- `{urlType}` is the type of URL to use, depending on which endpoints your catalog provides. If omitted, it will default to the public network.

## Operations

- Instances
  - Create a new instance
    - Waiting for the instance to build
    - Connecting an instance to a load balancer
  - Retrieving an instance
  - Updating an instance
  - Deleting an instance
  - Restarting an instance
  - Resizing an instance’s RAM
  - Resizing an instance’s volume
- Databases
  - Setup
  - Creating a new database
  - Deleting a database
  - Listing databases
- Users
  - Setup
  - Creating users
  - Deleting a user
  - The root user
  - Check if root user is enabled
- Datastores
  - Listing datastores
  - Retrieving a datastore
  - Listing datastore versions
  - Retrieving a datastore version

## Glossary

configuration group
  A configuration group is a collection of key/value pairs which configure a database instance. Some directives are capable of being applied dynamically, while other directives require a server restart to take effect. The configuration group can be applied to an instance at creation or applied to an existing instance to modify the behavior of the running datastore on the instance.
flavor
  A flavor is an available hardware configuration for a database instance. Each flavor has a unique combination of memory capacity and priority for CPU time.
instance
  A database instance is an isolated MySQL instance in a single tenant environment on a shared physical host machine. Also referred to as instance.
database
  A database is a local MySQL database running on an instance.
user
  A user is a local MySQL user that can access a database running on an instance.
datastore
  The database engine running on your instance. Currently, there is support for MySQL 5.6, MySQL 5.1, Percona 5.6 and MariaDB 10.
volume
  A volume is user-specified storage that contains the database engine data directory. Volumes are automatically provisioned on shared Internet Small Computer System Interface (iSCSI) storage area networks (SAN) that provide for increased performance, scalability, availability and manageability. Applications with high I/O demands are performance optimized and data is protected through both local and network RAID-10.

## Further Links

- Getting Started Guide for the API
- API Developer Guide
- API release history