Account

Show account details

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

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);
$account = $openstack->objectStoreV1()
                     ->getAccount();

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

Get account metadata

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);
$service = $openstack->objectStoreV1();

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

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

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:

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);
$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:

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);
$service = $openstack->objectStoreV1();

$account = $service->getAccount();

$account->mergeMetadata([
    '{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.