Using the vCloud SDK for PHP: Part 3
In Part 2 of this series we deployed a vApp. Now we’re going to add some metadata to the vApp.
We periodically collect statistics on customer vCloud usage for billing purposes?—?so some customers like to add metadata to their vApps with their own internal reference (e.g. PO-0001-WEB-TIER). We can then automatically use this metadata as their internal reference, when we generate invoices. If you Google for “vcloud sdk add metadata” you may come across a great blog post by William Lam on this subject (http://blogs.vmware.com/vsphere/2012/03/creating-custom-metadata-using-the-vcloud-api.html)?—?we are going to expand on the API examples listed, with some that specifically use the SDK for PHP.
First, create an SDK object to your VDC, the same as in Part 2. Then, follow the same process with your vApp. For this example we will use an Ubuntu Snappy vApp used in a previous post.
This gives me the existing metadata?—?I have already added an entry allocating the vApp to an internal department:
Let’s say that I want to add a metadata entry of ‘inv_description’ with my own PO reference, as this will be picked up by the Cloudhelix invoicing system.
Re-running the first code snippet shows that the metadata is now present:
This can also be seen in the vCD web interface.
Feel free to leave a comment with anything you’d like to see in a future post!
Posts in this series
Part 1: Initial Setup
Part 2: Deploying a vApp
Part 3: Adding Metadata
Our specialists have the answer