# Volumes 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}',
    ));

### Volume service

Now to instantiate the Volume service:

    $service = $client->volumeService('{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

- Volumes
  - Create a volume
  - List volumes
  - Get details on a single volume
  - To delete a volume
  - Attach a volume to a server
  - Detach a volume from a server
- Volume Types
  - List volume types
  - Describe a volume type
- Snapshots
  - Create a snapshot
  - List snapshots
  - To get details on a single snapshot
  - To delete a snapshot

## Glossary

volume
  A volume is a detachable block storage device. You can think of it as a USB hard drive. It can only be attached to one instance at a time.
volume type
  Providers may support multiple types of volumes; at Rackspace, a volume can either be `SSD` (solid state disk: expensive, high-performance) or `SATA` (serial attached storage: regular disks, less expensive).
snapshot
  A snapshot is a point-in-time copy of the data contained in a volume.

## Further links

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