Policy > Infra > Realized State

Apply tags on virtual machine

Allows an admin to apply multiple tags to a virtual machine. This operation
does 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.
This API is available when using VMware Cloud (AWS, Dell-EMC, Outpost) or VMware NSX-T.

Request:

Method:
POST
URI Path(s):
/policy/api/v1/infra/realized-state/enforcement-points/<enforcement-point-name>/virtual-machines?action=update_tags
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
VirtualMachineTagsUpdate+

Example Request:

POST https://<policy-mgr>/policy/api/v1/infra/realized-state/enforcement-points/default/virtual-machines?action=update_tags { "virtual_machine_id": "ID-0", "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

Required Permissions:

crud

Feature:

policy_vm_vm_tags

Additional Errors: