Stack resources — php-opencloud 1.12.1 documentation

# Stack resources

A stack is made up of zero or more resources such as databases, load balancers, and servers, and the software installed on servers.

## List stack resources

You can list all the resources for a stack as shown in the following example:

    $resources = $stack->listResources();

    foreach ($resources as $resource) {
        /** @var $resource OpenCloud\Orchestration\Resource\Resource **/
    }

Get the executable PHP script for this example

## Get stack resource

You can retrieve a specific resource in a stack bt using that resource’s name, as shown in the following example:

    /** @var $resource OpenCloud\Orchestration\Resource\Resource **/
    $resource = $stack->getResource('load-balancer');

Get the executable PHP script for this example

## Get stack resource metadata

You can retrieve the metadata for a specific resource in a stack as shown in the following example:

    /** @var $resourceMetadata \stdClass **/
    $resourceMetadata = $resource->getMetadata();

Get the executable PHP script for this example