Metadata — php-opencloud 1.12.1 documentation

# Metadata

## Setup

In order to interact with this feature you must first retrieve a particular load balancer, like so:

    $loadBalancer = $service->loadBalancer('{id}');

## List metadata

    $metadataList = $loadBalancer->metadataList();

    foreach ($metadataList as $metadataItem) {
        printf("Key: %s, Value: %s", $metadataItem->key, $metadataItem->value);
    }

## Add metadata

    $metadataItem = $loadBalancer->metadata();
    $metadataItem->create(array(
        'key'   => 'foo',
        'value' => 'bar'
    ));

## Modify metadata

    $metadataItem = $loadBalancer->metadata('foo');
    $metadataItem->update(array(
        'value' => 'baz'
    ));

## Remove metadata

    $metadataItem->delete();