Account

Account represents the top-level of the hierarchy. Your service provider creates your account and you own all resources in that account. The account defines a namespace for containers. In the OpenStack environment, account is synonymous with a project or tenant.

More information can be found in the official documentation.

In order to work with accounts you have to create the service first.

Read

To work with an Object Store account, you must first retrieve an account object like so:

$service = $openstack->objectStoreV1();
$account = $service->getAccount();

$account->retrieve();

Get account metadata

$service = $openstack->objectStoreV1();

$account = $service->getAccount();
$metadata = $account->getMetadata();

Replace all metadata with new values

In order to replace all existing metadata with a set of new values, you can use this operation. Any existing metadata items which not specified in the new set will be removed. For example, say an account has the following metadata already set:

Foo: value1
Bar: value2

and you reset the metadata with these values:

Foo: value4
Baz: value3

the metadata of the account will now be:

Foo: value4
Baz: value3

To merge metadata, you must run:

$service = $openstack->objectStoreV1();
$account = $service->getAccount();

$account->resetMetadata([
    '{key_1}' => '{val_1}',
    '{key_2}' => '{val_2}',
]);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Merge new metadata values with existing

In order to merge a set of new metadata values with the existing metadata set, you can use this operation. Any existing metadata items which are not specified in the new set will be preserved. For example, say an account has the following metadata already set:

Foo: value1
Bar: value2

and you merge them with these values:

Foo: value4
Baz: value3

the metadata of the account will now be:

Foo: value4
Bar: value2
Baz: value3

To reset metadata, you must run:

$service = $openstack->objectStoreV1();

$account = $service->getAccount();

$account->mergeMetadata([
    '{key_1}' => '{val_1}',
    '{key_2}' => '{val_2}',
]);