You define relations between the vSphere objects by using the RelationSpec object in the plugin.xml manifest file of your vSphere Web Client extension.
You describe each of the relations for the vSphere object using RelationSpec objects, which you must create inside the <relationSpecs> property of the ObjectRelationSetSpec extension object. Each RelationSpec object contains information on the relation target object type, display properties such as icons and labels, and any relevant list extensions for the relation target object.
The following table lists the properties of the RelationSpec object.
The following example presents an example extension definition for a relation extension. In the example, the extension defines relations for the Chassis object type. When the user selects a chassis object, the vSphere Web Client provides related items information for the relations defined in the example. In the example, relations are defined for Rack and Host object types.
<!-- Chassis relations --> <extension id="com.vmware.samples.relateditems.specs.chassis"> <extendedPoint>vise.relateditems.specs</extendedPoint> <object> <type>samples:Chassis</type> <!-- relationsViewId references the "related items view" extension created by the object template. It must be defined for the related items view to be shown on the right-hand side. --> <relationsViewId>com.vmware.samples.chassis.related</relationsViewId> <relationSpecs> <com.vmware.ui.relateditems.model.RelationSpec> <id>rackForChassis</id> <icon>#{rack}</icon> <label>#{rackLabel}</label> <relation>rack</relation> <targetType>samples:Rack</targetType> <!-- listViewId must be defined for the chassis' related items tab to show the rack list. The extension itself gets created as part of the object view template. Here we use ${namespace}.list for id. --> <listViewId>com.vmware.samples.rack.list</listViewId> </com.vmware.ui.relateditems.model.RelationSpec> <com.vmware.ui.relateditems.model.RelationSpec> <id>hostForChassis</id> <icon>#{CommonImages:hostsystem}</icon> <label>#{Common:typeResource.hostPlural}</label> <relation>host</relation> <targetType>HostSystem</targetType> <!-- listViewId below is the id defined by vSphere client for the HostSystem type. This list is shown as one of the items in the chassis Related Items tab. Other vSphere types like VirtualMachine, ClusterComputeResource, etc., have similar lists are predefined. --> <listViewId>vsphere.core.host.list</listViewId> </com.vmware.ui.relateditems.model.RelationSpec> </relationSpecs> </object> </extension>