Compute v2 — php-opencloud 1.12.1 documentation

# Compute v2

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

### Compute service

Now to instantiate the Compute service:

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

- Images
  - List images
    - Detailed results
    - Filtering
  - Retrieve details about an image
  - Delete an image
- Flavors
  - Get a flavor
  - List flavors
    - Detailed results
    - Filtering
- Servers
  - Get server
  - List servers
    - URL parameters for filtering servers
  - Create server
    - Using an image
    - Using a bootable volume
    - Create parameters
    - Creating a server with keypairs
    - Creating a server with personality files
  - Update server
    - Updatable attributes
    - Updating the access IP address(es)
  - Retrieving the server’s IP address
  - Delete server
- Keypairs
  - Generate a new keypair
  - Upload existing keypair
  - List keypairs
  - Delete keypairs

## Glossary

image
  An image is a collection of files for a specific operating system that you use to create or rebuild a server. Rackspace provides prebuilt images. You can also create custom images from servers that you have launched.
flavor
  A flavor is a named definition of certain server parameters such as the amount of RAM and disk space available. (There are other parameters set via the flavor, such as the amount of disk space and the number of virtual CPUs, but a discussion of those is too in-depth for a simple Getting Started Guide like this one.)
server
  A server is a virtual machine instance in the Cloud Servers environment.

## Further Links

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