Register an object extension to specify its namespace, vendor, and AMQP exchange name.
An object extension typically authenticates with the vCloud API as a system administrator, then registers with vCloud Director by POSTing an ObjectExtension element to the system's .../api/admin/extension/object URL. An ObjectExtension element must include the following elements.
1 | Retrieve the XML representation of the cloud. GET https://vcloud.example.com/api/admin/extension |
2 | Examine the response to find the Link for adding object extensions. This Link is present in the VMWExtension element, and has the following form. <vcloud:Link rel="add" href="https://vcloud.example.com/api/admin/extension/object" type="application/vnd.vmware.admin.extensibility.object+xml" /> |
3 | Construct an ObjectExtension element. See the request portion of Example: Register an Object Extension. |
4 | POST the ObjectExtension element to the URL described in Step 2. See the request portion of Example: Register an Object Extension. |
This example registers an object extension for the providerVdc extension point but does not enable it. The example assumes that an AMQP exchange named example-exchange has been created.
POST https://vcloud.example.com/api/admin/extension/object Content Type: application/vnd.vmware.admin.extensibility.object+xml ... <?xml version="1.0" encoding="UTF-8"?> <ObjectExtension xmlns="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vcloud_v1.5="http://www.vmware.com/vcloud/v1.5"> <Namespace>vcdx.vmdeploy</Namespace> <Enabled>false</Enabled> <Exchange>example-exchange</Exchange> <Vendor>com.example</Vendor> <Selectors> <Selector name="urn:selector:providerVdc" /> </Selectors> </ObjectExtension>
The system registers the extension and returns an ObjectExtension element that includes information derived from the contents you POSTed, and a set of Link elements that you can use to access or modify the new object extension. The AMQP message ContentType, which was not specified in the request, is returned with the default value, XML.
201 Created Content Type: application/vnd.vmware.admin.service+xml ... <vmext:ObjectExtension xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" id="83...0d39" href="https://vcloud.example.com/api/admin/extension/object/83...0d39" > <vcloud:Link rel="up" href="https://vcloud.example.com/api/admin/extension/object" type="application/vnd.vmware.admin.extensibility.objects+xml" /> <vcloud:Link rel="remove" href="https://vcloud.example.com/api/admin/extension/object/83...0d39" type="application/vnd.vmware.admin.extensibility.object+xml" /> <vcloud:Link rel="edit" href="https://vcloud.example.com/api/admin/extension/object/83...0d39" type="application/vnd.vmware.admin.extensibility.object+xml" /> <vcloud:Link rel="down" href="https://vcloud.example.com/api/admin/extension/object/83...0d39/selectorExtensions" type="application/vnd.vmware.admin.extensibility.selectors+xml" /> <vmext:Namespace>example-object</vmext:Namespace> <vmext:Enabled>false</vmext:Enabled> <vmext:Exchange>example-exchange</vmext:Exchange> <vmext:ContentType>XML</vmext:ContentType> <vmext:Vendor>com.example</vmext:Vendor> <vmext:Selectors> <vmext:Selector name="urn:selector:providerVdc" /> </vmext:Selectors> </vmext:ObjectExtension>