Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Enum
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • Service
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Service

The Compute class represents the OpenStack Nova service.

It is constructed from a OpenStack object and requires a service name, region, and URL type to select the proper endpoint from the service catalog. However, constants can be used to define default values for these to make it easier to use:

Creating a compute object:

$rackspace = new OpenCloud\Rackspace(...);
$dallas = new Compute(
   $rackspace,              // connection
  'cloudServersOpenStack',  // the service's name
  'DFW',                    // region identifier
  'publicURL'               // URL type
 );

The easy way (with defaults); this assumes that the constants (RAXSDK_...) are defined elsewhere before the inclusion of the first SDK library file:

$rackspace = new OpenCloud\Rackspace(...);
$dallas = new OpenCloud\Compute($rackspace); // uses defaults
OpenCloud\Common\Base
Extended by OpenCloud\Common\Service\AbstractService implements OpenCloud\Common\Service\ServiceInterface
Extended by OpenCloud\Common\Service\CatalogService
Extended by OpenCloud\Common\Service\NovaService
Extended by OpenCloud\Compute\Service
Namespace: OpenCloud\Compute
Located at OpenCloud/Compute/Service.php
Methods summary
public
# __construct( OpenCloud\Common\Http\Client $client, string $type = null, string $name = null, string $region = null, string $urlType = null )

Creates a service object, based off the specified client.

Creates a service object, based off the specified client.

The service's URL is defined in the client's serviceCatalog; it uses the $type, $name, $region, and $urlType to find the proper endpoint and set it. If it cannot find a URL in the service catalog that matches the criteria, then an exception is thrown.

Parameters

$client
OpenCloud\Common\Http\Client
$client Client object
$type
string
$type Service type (e.g. 'compute')
$name
string
$name Service name (e.g. 'cloudServersOpenStack')
$region
string
$region Service region (e.g. 'DFW', 'ORD', 'IAD', 'LON', 'SYD' or 'HKG')
$urlType
string
$urlType Either 'publicURL' or 'privateURL'

Overrides

OpenCloud\Common\Service\CatalogService::__construct()
public
# server( string $id = null )

Returns a Server object associated with this Compute service

Returns a Server object associated with this Compute service

This is a factory method and should generally be used to create server objects (thus ensuring that they are correctly associated with the server) instead of calling the Server class explicitly.

Parameters

$id
string
$id - if specified, the server with the ID is retrieved

Api

Returns

Resource\Server object
public
# serverList( boolean $details = true, array $filter = array() )

Returns a Collection of server objects, filtered by the specified parameters

Returns a Collection of server objects, filtered by the specified parameters

This is a factory method and should normally be called instead of creating a ServerList object directly.

Parameters

$details
boolean
$details - if TRUE, full server details are returned; if FALSE, just the minimal set of info is listed. Defaults to TRUE; you might set this to FALSE to improve performance at the risk of not having all the information you need.
$filter
array
$filter - a set of key/value pairs that is passed to the servers list for filtering

Api

Returns

\OpenCloud\Common\Collection
public OpenCloud\Compute\Resource\Network
# network( string $id = null )

Returns a Network object

Returns a Network object

Parameters

$id
string
$id the network ID

Returns

OpenCloud\Compute\Resource\Network

Api

public OpenCloud\Common\Collection
# networkList( array $filter = array() )

Returns a Collection of Network objects

Returns a Collection of Network objects

Parameters

$filter
array
$filter array of filter key/value pairs

Returns

OpenCloud\Common\Collection

Api

public OpenCloud\Compute\Resource\Image
# image( string $id = null )

Returns an image from the service

Returns an image from the service

This is a factory method and should normally be called instead of creating an Image object directly.

Parameters

$id
string
$id - if supplied, returns the image with the specified ID.

Returns

OpenCloud\Compute\Resource\Image
object

Api

public OpenCloud\Common\Collection
# imageList( boolean $details = true, array $filter = array() )

Returns a Collection of images (class Image)

Returns a Collection of images (class Image)

This is a factory method and should normally be used instead of creating an ImageList object directly.

Parameters

$details
boolean
$details - if TRUE (the default), returns complete image details. Set to FALSE to improve performance, but only return a minimal set of data
$filter
array
$filter - key/value pairs to pass to the images resource. The actual values available here are determined by the OpenStack code and any extensions installed by your cloud provider; see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html for current filters available.

Returns

OpenCloud\Common\Collection

Api

public
# keypair( mixed $data = null )
public
# listKeypairs( )
Methods inherited from OpenCloud\Common\Service\NovaService
flavor(), flavorList(), loadNamespaces()
Methods inherited from OpenCloud\Common\Service\CatalogService
getBaseUrl(), getExtensions(), getName(), getRegion(), getType(), getUrl(), getUrlType(), limits()
Methods inherited from OpenCloud\Common\Service\AbstractService
collection(), getClient(), getCurrentNamespace(), getEndpoint(), getNamespaces(), getResources(), resolveResourceClass(), resource(), resourceList(), setClient(), setEndpoint()
Methods inherited from OpenCloud\Common\Base
__call(), checkJsonError(), generateUuid(), getInstance(), getJsonHeader(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()
Constants summary
string DEFAULT_TYPE 'compute'
#
string DEFAULT_NAME 'cloudServersOpenStack'
#
Constants inherited from OpenCloud\Common\Service\CatalogService
DEFAULT_URL_TYPE
Properties summary
protected array $additionalExtensions array('OS-FLV-DISABLED')
#
Properties inherited from OpenCloud\Common\Service\CatalogService
$regionless
Properties inherited from OpenCloud\Common\Service\AbstractService
$client, $endpoint, $namespaces, $resources
Properties inherited from OpenCloud\Common\Base
$aliases
PHP OpenCloud API API documentation generated by ApiGen 2.8.0