Documentation

ServerMetadata extends Metadata
in package

This class handles specialized metadata for OpenStack Server objects (metadata items can be managed individually or in aggregate).

Server metadata is a weird beast in that it has resource representations and HTTP calls to set the entire server metadata as well as individual items.

Table of Contents

PATCH_CONTENT_TYPE  = OpenCloudCommonConstantsMime::JSON_PATCH
$aliases  : array<string|int, mixed>
The aliases configure for the properties of the instance.
$key  : mixed
$metadata  : array<string|int, mixed>
$logger  : LoggerInterface
The logger instance
$parent  : mixed
$properties  : array<string|int, mixed>
Holds all the properties added by overloading.
$url  : mixed
__call()  : mixed
Intercept non-existent method calls for dynamic getter/setter functionality.
__construct()  : mixed
Constructs a Metadata object associated with a Server or Image object
__get()  : mixed
__isset()  : mixed
__set()  : void
This setter overrides the base one, since the metadata key can be anything
checkJsonError()  : mixed
Checks the most recent JSON operation for errors.
count()  : mixed
create()  : void
Sets a new metadata value or block
delete()  : void
Deletes a metadata key or block
generateUuid()  : mixed
getInstance()  : static
getLogger()  : LoggerInterface
Returns the Logger object.
getParent()  : mixed
getUrl()  : string
Returns the URL of the metadata (key or block)
hasLogger()  : bool
keylist()  : array<string|int, mixed>
Returns the list of keys defined
makeResourceIteratorOptions()  : mixed
populate()  : mixed
Populates the current object based on an unknown data type.
setArray()  : void
Sets metadata values from an array, with optional prefix
setLogger()  : $this
Sets the logger.
setParent()  : mixed
stripNamespace()  : mixed
toArray()  : mixed
toCamel()  : mixed
Convert a string to camelCase format.
toUnderscores()  : mixed
Convert string to underscore format.
update()  : void
Updates a metadata key or block
url()  : mixed
getJsonHeader()  : mixed
getPatchHeaders()  : mixed
getProperty()  : mixed
Grab value out of the data array.
propertyExists()  : bool
Basic check to see whether property exists.
setProperty()  : mixed
We can set a property under three conditions:
checkAttributePrefix()  : bool
Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
getMetadataJson()  : string
Builds a metadata JSON string
isAccessible()  : bool
Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

Constants

PATCH_CONTENT_TYPE

public mixed PATCH_CONTENT_TYPE = OpenCloudCommonConstantsMime::JSON_PATCH

Properties

$aliases

The aliases configure for the properties of the instance.

protected array<string|int, mixed> $aliases = array()

$metadata

protected array<string|int, mixed> $metadata = array()

Internal data store.

$properties

Holds all the properties added by overloading.

private array<string|int, mixed> $properties = array()

Methods

__call()

Intercept non-existent method calls for dynamic getter/setter functionality.

public __call( $method,  $args) : mixed
Parameters
$method :
$args :
Tags
throws
RuntimeException
Return values
mixed

__construct()

Constructs a Metadata object associated with a Server or Image object

public __construct(object $parent[, string $key = null ]) : mixed
Parameters
$parent : object

either a Server or an Image object

$key : string = null

the (optional) key for the metadata item

Tags
throws
MetadataError
Return values
mixed

__get()

public __get(mixed $key) : mixed
Parameters
$key : mixed
Return values
mixed

__isset()

public __isset(mixed $property) : mixed
Parameters
$property : mixed
Return values
mixed

__set()

This setter overrides the base one, since the metadata key can be anything

public __set(mixed $key, mixed $value) : void
Parameters
$key : mixed
$value : mixed
Return values
void

checkJsonError()

Checks the most recent JSON operation for errors.

public static checkJsonError() : mixed
Tags
throws
JsonError
codeCoverageIgnore
Return values
mixed

count()

public count() : mixed
Return values
mixed

create()

Sets a new metadata value or block

public create() : void

Note that, if you're setting a block, the block specified will entirely replace the existing block.

Tags
throws
MetadataCreateError
Return values
void

delete()

Deletes a metadata key or block

public delete() : void
Tags
throws
MetadataDeleteError
Return values
void

generateUuid()

public static generateUuid() : mixed
Return values
mixed

getInstance()

public static getInstance() : static
Return values
static

getUrl()

Returns the URL of the metadata (key or block)

public getUrl([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : string
Parameters
$path : mixed = null
$query : array<string|int, mixed> = array()
Tags
throws
ServerUrlerror
Return values
string

hasLogger()

public hasLogger() : bool
Return values
bool

keylist()

Returns the list of keys defined

public keylist() : array<string|int, mixed>
Return values
array<string|int, mixed>

makeResourceIteratorOptions()

public makeResourceIteratorOptions(mixed $resource) : mixed
Parameters
$resource : mixed
Return values
mixed

populate()

Populates the current object based on an unknown data type.

public populate(mixed $info[, mixed $setObjects = true ]) : mixed
Parameters
$info : mixed
$setObjects : mixed = true
Tags
throws
InvalidArgumentError
Return values
mixed

setArray()

Sets metadata values from an array, with optional prefix

public setArray(array<string|int, mixed> $values[, string $prefix = null ]) : void

If $prefix is provided, then only array keys that match the prefix are set as metadata values, and $prefix is stripped from the key name.

Parameters
$values : array<string|int, mixed>

an array of key/value pairs to set

$prefix : string = null

if provided, a prefix that is used to identify metadata values. For example, you can set values from headers for a Container by using $prefix='X-Container-Meta-'.

Return values
void

setParent()

public setParent(mixed $parent) : mixed
Parameters
$parent : mixed
Return values
mixed

stripNamespace()

public stripNamespace(mixed $namespace) : mixed
Parameters
$namespace : mixed
Return values
mixed

toArray()

public toArray() : mixed
Return values
mixed

toCamel()

Convert a string to camelCase format.

public toCamel( $string[, bool $capitalise = true ]) : mixed
Parameters
$string :
$capitalise : bool = true

Optional flag which allows for word capitalization.

Return values
mixed

toUnderscores()

Convert string to underscore format.

public toUnderscores( $string) : mixed
Parameters
$string :
Return values
mixed

update()

Updates a metadata key or block

public update() : void
Tags
throws
MetadataUpdateError
Return values
void

url()

public url([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
$path : mixed = null
$query : array<string|int, mixed> = array()
Tags
deprecated
Return values
mixed

getJsonHeader()

protected static getJsonHeader() : mixed
Return values
mixed

getPatchHeaders()

protected static getPatchHeaders() : mixed
Return values
mixed

getProperty()

Grab value out of the data array.

protected getProperty(string $property) : mixed
Parameters
$property : string
Return values
mixed

propertyExists()

Basic check to see whether property exists.

protected propertyExists(string $property[, bool $allowRetry = true ]) : bool
Parameters
$property : string

The property name being investigated.

$allowRetry : bool = true

If set to TRUE, the check will try to format the name in underscores because there are sometimes discrepancies between camelCaseNames and underscore_names.

Return values
bool

setProperty()

We can set a property under three conditions:

protected setProperty(mixed $property, mixed $value) : mixed
  1. If it has a concrete setter: setProperty()
  2. If the property exists
  3. If the property name's prefix is in an approved list
Parameters
$property : mixed
$value : mixed
Return values
mixed

checkAttributePrefix()

Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array

private checkAttributePrefix(string $property) : bool

This is to support extension namespaces in some services.

Parameters
$property : string

the name of the attribute

Return values
bool

getMetadataJson()

Builds a metadata JSON string

private getMetadataJson() : string
Tags
throws
MetadataJsonError
codeCoverageIgnore
Return values
string

isAccessible()

Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

private isAccessible( $property) : bool
Parameters
$property :
Return values
bool

Search results