The vCloud API provides a general-purpose facility for associating user-defined metadata with an object. An administrator or object owner can use the metadata link in the object's representation to access an object's metadata.
Object metadata gives cloud operators and tenants a flexible way to associate user-defined properties (name=value pairs) with objects. Object metadata is preserved when objects are copied, and can be included in query filter expressions (see Add a Metadata Filter to a Query).
The representation of any object that supports metadata includes a link that you can use to retrieve the object's Metadata element. This example shows the metadata link from a VApp element.
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloud.example.com/api/vApp/vapp-7/metadata"/>
The following elements can include a link to a Metadata element.
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
| |
■
|
A Metadata element can contain up to 1024 MetadataEntry elements (name=value pairs) that the object owner or an administrator can create, retrieve, update, and delete. It also contains a group of name=value pairs that are under the control of the system administrator.
Each MetadataEntry includes a single name=value pair, represented in its Key and TypedValue elements. Key names are specified by Key element contents. A key name is a UTF-8 (Unicode) string encoded as described in RFC3986 (pct-encoded).
The key name must be unique within the scope of the containing Metadata element. Because key names are implicitly qualified by the Domain value of the containing MetadataEntry, the two key names in this example are considered to be unique.
<Metadata ... <MetadataEntry> <Domain visibility="READONLY">SYSTEM</Domain> <Key>Foo</Key> ... </MetadataEntry> <MetadataEntry> <Key>Foo</Key> ... </MetadataEntry> </Metadata>
See Access Control for vCloud API Object Metadata for more information about the Domain element.
The type of a Value is expressed in the xsi:type attribute of the containing TypedValue element. Values have various restrictions, based on their type.
UTF-8 character set. Strings longer than 1000 characters cannot be searched for in a query. |
||
UTC date and time in the format defined by http://www.w3.org/TR/xmlschema-2/#dateTime. For example, 2012-06-18T12:00:00-05:00 |
||
The following rules apply when you update a Metadata element.
The Domain element of a MetadataEntry controls access to that entry by users and system administrators. There are two access domains, only one of which can be specified explicitly.
This is the default access domain for metadata, and cannot be explicitly specified in a Domain element. A MetadataEntry that does not include a Domain element is considered to be in the GENERAL domain. User access to metadata in the GENERAL domain is controlled by the user's rights to the object to which the Metadata is attached. The owner of the object can create, read, update, or delete any MetadataEntry in the GENERAL domain. | |
To be placed in the SYSTEM domain, a MetadataEntry must include a Domain element with a value of SYSTEM. Metadata in the SYSTEM domain can be created, updated, and deleted only by a system administrator. User access to metadata in the SYSTEM domain is controlled by the value of the visibility attribute of the Domain element. | |
Object metadata in the VCENTER domain can be applied to Vm objects, including Vm objects contained in VAppTemplate objects, by users in roles that have the right vApp: Allow metadata mapping domain to vCenter. The system uses metadata in this domain to deploy virtual machines on specific ESXi hosts that have been configured by your service provider. Your service provider establishes the set of legal values for metadata in this domain. See Using Metadata to Control Virtual Machine Placement. |