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.

Namespace

The object extension namespace.

Vendor

The object extension vendor.

Important

The combination of Namespace and Vendor must be unique among all extension services and object extensions registered in the system. If a service tries to register an object extension that specifies a Namespace and Vendor that are already registered with this vCloud Director installation, registration fails. Vendor and namespace names that follow the naming convention used for Java packages are more likely to be unique.

Selectors

Zero or more Selector elements that specify the extension points in which the extension has an interest. If you register an object extension with no Selectors, the system assumes that the extension is interested in all extension points.

Exchange

The AMQP exchange name that vCloud Director must use when routing messages to the extension. The extension must create the specified exchange on the AMQP service that vCloud Director uses. The exchange type must be direct. Exchange names must be globally unique.

This operation is restricted to system administrators.

1

Retrieve the XML representation of the cloud.

Use a request like this one:

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.

Request:

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.

Response:

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>