GeekAfterFive

Infrastructure as Code

home

vCloud API 5.1 Metadata

20 Feb 2013

There has been very good coverage and code samples for working with Metadata in vCloud Director 1.5 (See posts from William, Alan, and Clinton), so this will simply be an update post for Metadata in vCloud Director 5.1.

What's different?

  1. Typed Values - Metadata must now be put into a certain type. No more throwing random junk into a single metadata entry. :D
  2. Domain and Visibility - Providers now have the ability to provide System metadata entries on objects, which is not editable by users. Providers can additionally make the metadata private, meaning the users cannot see the System metadata on the object at all.
  3. Objects - Metadata can now be added to new vCloud Director 5.1 objects, including disks and storage profiles. Additionally, I believe that because OrgVDC networks are now user manageable, vCloud users can add their own metadata to networks.
For more instruction on Metadata in the vCloud API, read "Working with Object Metadata" in the vCloud Programming Guide.

PowerCLI 5.1 R2 example:

$vapp = Get-CIVapp "MyVApp"
$metadata = $vapp.extensiondata.GetMetadata()
$metadata.MetadataEntry = New-Object VMware.VimAutomation.Cloud.Views.MetadataEntry
# I don't have any other metadata, so index is [0].
$metadata.MetadataEntry[0].Key = "Jake"
$metadata.MetadataEntry[0].TypedValue = New-Object VMware.VimAutomation.Cloud.Views.MetadataStringValue
$metadata.MetadataEntry[0].TypedValue.Value = "vCloudNerd"
$vapp.ExtensionData.CreateMetadata($metadata)
comments powered by Disqus