CloudVendorLocal
Reference for the CloudVendorLocal module: every class and function, with its full signature, parameters and return type. A Local implementation of a Cloud vendor that starts, stops and queries Docker containers through a Local Manager HTTP API. The module registers itself with the Cloud module as the vendor named "local"; server creation and management are not supported.
This page is a pure reference. For how the framework fits together, see the Guide.
CloudVendorLocal- start, stop and query containers for the Local Cloud vendor.CloudVendorLocalDatabase- talks to the Local Manager API to list, start, stop and status containers.CloudVendorLocalDockerContainerData- immutable data for one Docker container reported by the Local Manager.
CloudVendorLocal
The vendor entry points the Cloud module calls: start a container that is in STARTING status, stop a container that is in STOPPING status, and get a container's current status. The server functions always throw, because the Local vendor does not manage servers.
GetContainerStatus
CloudVendorLocal::GetContainerStatus(string $containerName): ?CloudContainerCurrentStatusData
Get the current status of a container by name.
| Name | Type | Description |
|---|---|---|
$containerName | string | Container name, for example queue-eeef26c3e817a769e366c208c5707f05. |
Returns ?CloudContainerCurrentStatusData The container status data, or null if not found.
StartContainer
CloudVendorLocal::StartContainer(CloudContainerData $container): void
Start a container that is in STARTING status. Returns without action when the container is no longer STARTING. Builds the container name from the service identifier and container ref, passes its parameters through as environment variables, starts it via the Local Manager, and updates its status to RUNNING.
| Name | Type | Description |
|---|---|---|
$container | CloudContainerData | Container data object, containing the server. |
Returns void
StartServer
CloudVendorLocal::StartServer(int $serverId): void
Start a server. Server start is not implemented for the Local vendor; this always throws.
| Name | Type | Description |
|---|---|---|
$serverId | int | Server ID. |
Returns void
StopContainer
CloudVendorLocal::StopContainer(CloudContainerData $container): void
Stop a container that is in STOPPING status. Returns without action when the container is no longer STOPPING. Builds the container name from the service identifier and container ref, stops it via the Local Manager, and updates its status to STOPPED.
| Name | Type | Description |
|---|---|---|
$container | CloudContainerData | Container data object, containing the server. |
Returns void
StopServer
CloudVendorLocal::StopServer(int $serverId): void
Stop a server. Server stop is not implemented for the Local vendor; this always throws.
| Name | Type | Description |
|---|---|---|
$serverId | int | Server ID. |
Returns void
CloudVendorLocalDatabase
The client for the Local Manager HTTP API. Reads the server URL and admin token from config, then lists, starts, stops and reads the status of Docker containers over HTTP.
GetAdminToken
CloudVendorLocalDatabase::GetAdminToken(): string
Get the Local Manager admin token from the CLOUD_VENDOR_LOCAL_API_ADMIN_TOKEN config value.
Returns string The admin token.
GetContainerStatus
CloudVendorLocalDatabase::GetContainerStatus(string $containerName): ?CloudContainerCurrentStatusData
Get a container's status from the Local Manager. Returns null when the manager responds 404, and throws when the response is missing, malformed or not valid JSON.
| Name | Type | Description |
|---|---|---|
$containerName | string | Container name. |
Returns ?CloudContainerCurrentStatusData The container status data, or null if not found.
GetServerUrl
CloudVendorLocalDatabase::GetServerUrl(): string
Get the Local Manager server URL from the CLOUD_VENDOR_LOCAL_API_URL config value. Strips surrounding quotes, prefixes http:// when no scheme is present, and defaults to port 5434 when only a hostname is given; throws when the result does not contain a scheme.
Returns string The server URL.
ListContainers
CloudVendorLocalDatabase::ListContainers(): array
List all Docker containers via the Local Manager, throwing when the request does not succeed.
Returns array An array of CloudVendorLocalDockerContainerData objects.
StartContainer
CloudVendorLocalDatabase::StartContainer(string $containerName, string $containerRef, string $serviceIdentifier, ?string $parametersJson = null, ?string $ports = null, ?string $adminToken = null): void
Start a Docker container via the Local Manager. Sends the service identifier and parameters to the manager, which uses registered service callbacks to start the appropriate container type. Throws when the request does not succeed.
| Name | Type | Description |
|---|---|---|
$containerName | string | Container name. |
$containerRef | string | Container ref, 32 character hex. |
$serviceIdentifier | string | Service identifier, for example "queue", "signal" or "location". |
$parametersJson | ?string | JSON string of container parameters, such as environment variables. Null when not set. |
$ports | ?string | Comma separated ports string. Null when not set. |
$adminToken | ?string | Admin token for the container. Null when not set. |
Returns void
StopContainer
CloudVendorLocalDatabase::StopContainer(string $containerName): void
Stop a Docker container via the Local Manager, throwing when the request does not succeed.
| Name | Type | Description |
|---|---|---|
$containerName | string | Container name. |
Returns void
CloudVendorLocalDockerContainerData
Immutable data for one Docker container as reported by the Local Manager, with helpers to convert to and from JSON.
Properties
| Property | Type | Description |
|---|---|---|
$id | string | The container id. |
$image | string | The container image. |
$status | string | The container status. |
$ports | string | The container ports. |
$names | string | The container names. |
__construct
CloudVendorLocalDockerContainerData::__construct(string $id = '', string $image = '', string $status = '', string $ports = '', string $names = '')
Create the container data from its parts. Each is a readonly property, defaulting to an empty string.
| Name | Type | Description |
|---|---|---|
$id | string | The container id. |
$image | string | The container image. |
$status | string | The container status. |
$ports | string | The container ports. |
$names | string | The container names. |
FromJson
CloudVendorLocalDockerContainerData::FromJson(string $json): CloudVendorLocalDockerContainerData
Create a container data object from its JSON representation.
| Name | Type | Description |
|---|---|---|
$json | string | JSON string. |
Returns CloudVendorLocalDockerContainerData The container data.
ToJson
CloudVendorLocalDockerContainerData::ToJson(): string
Convert the container data to a JSON string.
Returns string The JSON representation.