Overview

Namespaces

  • None
  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Exceptions
      • Log
      • Request
        • Response
    • Compute
    • Database
    • DNS
    • LoadBalancer
      • Resources
    • ObjectStore
      • Resource
    • Orchestration
    • Volume
  • PHP

Classes

  • Flavor
  • Image
  • Network
  • Server
  • ServerMetadata
  • Service
  • VolumeAttachment
  • 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
Extended by OpenCloud\Common\Nova
Extended by OpenCloud\Compute\Service
Namespace: OpenCloud\Compute
Located at OpenCloud/Compute/Service.php
Methods summary
public
# __construct( OpenCloud\OpenStack $conn, string $serviceName, string $serviceRegion, string $urltype )

Called when creating a new Compute service object

Called when creating a new Compute service object

_NOTE_ that the order of parameters for this is different from the parent Service class. This is because the earlier parameters are the ones that most typically change, whereas the later ones are not modified as often.

Parameters

$conn
OpenCloud\Identity
$conn - a connection object
$serviceName
string
$serviceRegion - identifies the region of this Compute service
$serviceRegion
string
$urltype - identifies the URL type ("publicURL", "privateURL")
$urltype
string
$serviceName - identifies the name of the service in the catalog

Overrides

OpenCloud\Common\Nova::__construct()
public string
# url( string $resource = 'servers', array $args = array() )

Returns the selected endpoint URL of this compute Service

Returns the selected endpoint URL of this compute Service

Parameters

$resource
string
$resource - an optional child resource. For example, passing 'details' would return .../servers/details. Should not be prefixed with a slash (/).
$args
array
$args (optional) an array of key-value pairs for query strings to append to the URL

Returns

string

Throws

UrlError

Returns

string - the requested URL

Overrides

OpenCloud\Common\Service::url()
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

Compute\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

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

Returns a Network object

Returns a Network object

Parameters

$id
string
$id the network ID

Returns

Compute\Network

Api

public Collection
# networkList( array $filter = array() )

Returns a Collection of Network objects

Returns a Collection of Network objects

Parameters

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

Returns

Collection

Api

public Compute\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

Compute\Image
object

Api

public 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

Collection

Api

Methods inherited from OpenCloud\Common\Nova
Flavor(), FlavorList(), Request(), load_namespaces()
Methods inherited from OpenCloud\Common\Service
collection(), extensions(), getConnection(), getCurrentNamespace(), getResources(), limits(), name(), namespaces(), region(), request(), resolveResourceClass(), resource(), resourceList(), setConnection()
Methods inherited from OpenCloud\Common\Base
__set(), checkJsonError(), getHttpRequestObject(), getLogger(), makeQueryString(), populate(), setLogger(), setProperty()
Properties inherited from OpenCloud\Common\Service
$_namespaces, $conn
PHP OpenCloud API API documentation generated by ApiGen 2.8.0