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,
'cloudServersOpenStack',
'DFW',
'publicURL'
);
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);
-
OpenCloud\Common\Base
-
OpenCloud\Common\Service\AbstractService
implements
OpenCloud\Common\Service\ServiceInterface
-
OpenCloud\Common\Service\CatalogService
-
OpenCloud\Common\Service\NovaService
-
OpenCloud\Compute\Service
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
|
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
Parameters
- $id
string $id the network ID
Returns
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
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
|
|
public
|
|
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()
|