class Service extends AbstractService

Compute v2 service for OpenStack.

Traits

Methods

createServer (array $options) : Server

Create a new server resource. This operation will provision a new virtual machine on a host chosen by your service API.

listServers (bool $detailed = false, array $options = array(), callable $mapFn = null) : Generator

List servers.

getServer (array $options = array()) : Server

Retrieve a server object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Server::retrieve}. For example:

listFlavors (array $options = array(), callable $mapFn = null, bool $detailed = false) : Generator

List flavors.

getFlavor (array $options = array()) : Flavor

Retrieve a flavor object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Flavor::retrieve}.

createFlavor (array $options = array()) : Flavor

Create a new flavor resource.

listImages (array $options = array(), callable $mapFn = null) : Generator

List images.

getImage (array $options = array()) : Image

Retrieve an image object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Image::retrieve}.

listKeypairs (array $options = array(), callable $mapFn = null) : Generator

List key pairs.

createKeypair (array $options) : Keypair

Create or import keypair

getKeypair (array $options = array()) : Keypair

Get keypair

Shows rate and absolute limits for the tenant

Shows summary statistics for all hypervisors over all compute nodes.

listHypervisors (bool $detailed = false, array $options = array(), callable $mapFn = null) : Generator

List hypervisors.

getHypervisor (array $options = array()) : Hypervisor

Shows details for a given hypervisor.

listHosts (array $options = array(), callable $mapFn = null) : Generator

List hosts.

getHost (array $options = array()) : Host

Retrieve a host object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Host::retrieve}. For example:

listAvailabilityZones (array $options = array(), callable $mapFn = null) : Generator

List AZs

getQuotaSet (string $tenantId, bool $detailed = false) : QuotaSet

Shows A Quota for a tenant

Details

createServer(array $options)

Create a new server resource. This operation will provision a new virtual machine on a host chosen by your service API.

Parameters

$options array {see \OpenStack\Compute\v2\Api::postServer}

Return value

Server

Example code

$server = $service->createServer($options);

listServers(bool $detailed = false, array $options = array(), callable $mapFn = null)

List servers.

Parameters

$detailed bool Determines whether detailed information will be returned. If FALSE is specified, only the ID, name and links attributes are returned, saving bandwidth.
$options array {see \OpenStack\Compute\v2\Api::getServers}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listServers($detailed, $options, $mapFn);

getServer(array $options = array())

Retrieve a server object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Server::retrieve}. For example:

$server = $service->getServer(['id' => '{serverId}']);

Parameters

$options array An array of attributes that will be set on the {see Server} object. The array keys need to correspond to the class public properties.

Return value

Server

Example code

$server = $service->getServer($options);

listFlavors(array $options = array(), callable $mapFn = null, bool $detailed = false)

List flavors.

Parameters

$options array {see \OpenStack\Compute\v2\Api::getFlavors}
$mapFn callable A callable function that will be invoked on every iteration of the list.
$detailed bool Set to true to fetch flavors' details.

Return value

Generator

Example code

$generator = $service->listFlavors($options, $mapFn, $detailed);

getFlavor(array $options = array())

Retrieve a flavor object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Flavor::retrieve}.

Parameters

$options array An array of attributes that will be set on the {see Flavor} object. The array keys need to correspond to the class public properties.

Return value

Flavor

Example code

$flavor = $service->getFlavor($options);

createFlavor(array $options = array())

Create a new flavor resource.

Parameters

$options array {see \OpenStack\Compute\v2\Api::postFlavors}

Return value

Flavor

Example code

$flavor = $service->createFlavor($options);

listImages(array $options = array(), callable $mapFn = null)

List images.

Parameters

$options array {see \OpenStack\Compute\v2\Api::getImages}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listImages($options, $mapFn);

getImage(array $options = array())

Retrieve an image object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Image::retrieve}.

Parameters

$options array An array of attributes that will be set on the {see Image} object. The array keys need to correspond to the class public properties.

Return value

Image

Example code

$image = $service->getImage($options);

listKeypairs(array $options = array(), callable $mapFn = null)

List key pairs.

Parameters

$options array {see \OpenStack\Compute\v2\Api::getKeyPairs}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listKeypairs($options, $mapFn);

createKeypair(array $options)

Create or import keypair

Parameters

$options array

Return value

Keypair

Example code

$keypair = $service->createKeypair($options);

getKeypair(array $options = array())

Get keypair

Parameters

$options array

Return value

Keypair

Example code

$keypair = $service->getKeypair($options);

getLimits()

Shows rate and absolute limits for the tenant

Return value

Limit

Example code

$limit = $service->getLimits();

getHypervisorStatistics()

Shows summary statistics for all hypervisors over all compute nodes.

Return value

HypervisorStatistic

Example code

$hypervisorStatistic = $service->getHypervisorStatistics();

listHypervisors(bool $detailed = false, array $options = array(), callable $mapFn = null)

List hypervisors.

Parameters

$detailed bool Determines whether detailed information will be returned. If FALSE is specified, only the ID, name and links attributes are returned, saving bandwidth.
$options array {see \OpenStack\Compute\v2\Api::getHypervisors}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listHypervisors($detailed, $options, $mapFn);

getHypervisor(array $options = array())

Shows details for a given hypervisor.

Parameters

$options array

Return value

Hypervisor

Example code

$hypervisor = $service->getHypervisor($options);

listHosts(array $options = array(), callable $mapFn = null)

List hosts.

Parameters

$options array {see \OpenStack\Compute\v2\Api::getHosts}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listHosts($options, $mapFn);

getHost(array $options = array())

Retrieve a host object without calling the remote API. Any values provided in the array will populate the empty object, allowing you greater control without the expense of network transactions. To call the remote API and have the response populate the object, call {see Host::retrieve}. For example:

$server = $service->getHost(['name' => '{name}']);

Parameters

$options array An array of attributes that will be set on the {see Host} object. The array keys need to correspond to the class public properties.

Return value

Host

Example code

$host = $service->getHost($options);

listAvailabilityZones(array $options = array(), callable $mapFn = null)

List AZs

Parameters

$options array {see \OpenStack\Compute\v2\Api::getAvailabilityZones}
$mapFn callable A callable function that will be invoked on every iteration of the list.

Return value

Generator

Example code

$generator = $service->listAvailabilityZones($options, $mapFn);

getQuotaSet(string $tenantId, bool $detailed = false)

Shows A Quota for a tenant

Parameters

$tenantId string
$detailed bool

Return value

QuotaSet

Example code

$quotaSet = $service->getQuotaSet($tenantId, $detailed);