NSX-T Data Center REST API
Apply tags on virtual machine
Allows an admin to apply multiple tags to a virtual machine. This operationdoes not store the intent on the policy side. It applies the tag directly
on the specified enforcement point. This operation will replace the existing
tags on the virtual machine with the ones that have been passed. If the
application of tag fails on the enforcement point, then an error is
reported. The admin will have to retry the operation again. Policy
framework does not perform a retry. Failure could occur due to multiple
reasons. For e.g enforcement point is down, Enforcement point could not
apply the tag due to constraints like max tags limit exceeded, etc.
NOTE: The "virtual_machine_id" field in the payload will be ignored and the
virtual machine ID provided in the URL will be honored.
This API is available when using VMware Cloud (AWS, Dell-EMC, Outpost, Hyperscalers) or VMware NSX.
Request:
Method:
POST
URI Path(s):
/policy/api/v1/infra/realized-state/virtual-machines/{virtual-machine-id}/tags
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra/realized-state/virtual-machines/{virtual-machine-id}/tags
/policy/api/v1/orgs/{org-id}/projects/{project-id}/infra/realized-state/virtual-machines/{virtual-machine-id}/tags
Request Headers:
n/a
Query Parameters:
RealizationListRequestParameters+
Request Body:
VirtualMachineTagsUpdate+
Example Request:
{ "tags": [ {"scope": "web", "tag": "web-vm"}, {"scope": "ostype", "tag": "WINDOWS"} ] }Successful Response:
Response Code:
204 No Content
Response Headers:
n/a
Response Body:
n/a