You can add a service link to an existing service.
A ServiceLink element must contain the following child elements:
- LinkHref
-
The value of
href
attribute of the Link. This can be any URI, and can include the variables{baseUri}
and{resourceId}
. When constructing thehref
value of the Link, VMware Cloud Director replaces{baseUri}
with the VMware Cloud Director REST API base URL, and replaces{resourceId}
with the UUID portion of theid
attribute value of the resource in which the Link is inserted. The following example might expand to the stringhttps://vcloud.example.com/org/17
.<LinkHref> {baseUri}/org/{resourceId} </LinkHref>
- MimeType
-
The value, specified as a MIME content type, of the
type
attribute of the Link. - Rel
- Defines the relationship of the link to the object that contains it. A relationship can be the name of an operation on the object, a reference to a contained or containing object, or a reference to an alternate representation of the object. The relationship value implies the HTTP verb to use when you use the link's href value as a request URL.
- ResourceType
- The object type, specified as a MIME content type, of the object in which the Link appears.
Note:
You can constrain the Link to appear in a specific resource by including a ResourceId element in the ServiceLink. This element contains the id
of the resource in which the Link will appear. This resource must be of the type specified in the ResourceType element of the ServiceLink.
Prerequisites
This operation is restricted to system administrators.
Procedure
Example: Add a Service Link
This request adds a ServiceLink to the service created in Register an Extension Service
Request:
POST https://vcloud.example.com/api/admin/extension/service/45/links Content-type: application/vnd.vmware.admin.serviceLink+xml <?xml version="1.0" encoding="UTF-8"?> <vmext:ServiceLink xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.serviceLink+xml"> <vmext:LinkHref>{baseUri}vApp/vapp-{resourceId}/action/deleteBackup</vmext:LinkHref> <vmext:MimeType>application/vnd.example.vcd-backup.createBackupParams+xml</vmext:MimeType> <vmext:Rel>deleteBackup</vmext:Rel> <vmext:ResourceType>application/vnd.example.vcd-backup.vApp+xml</vmext:ResourceType> </vmext:ServiceLink>
Response:
200 OK Content-type: application/vnd.vmware.admin.serviceLink+xml ... <vmext:ServiceLink ...> ... </vmext:ServiceLink>