Update the Custom Properties of a Machine
After deploying a machine, you can use the IaaS APIs to update the machine with custom properties. Custom properties provide you with the flexibility to add any information about the machine that you want.
For example, machine IDs are
typically autogenerated. By updating the custom properties, you can identify the machine
owner and include their contact email or phone information.
Prerequisites
- Verify that all general prerequisites have been satisfied. See Prerequisites for working with the vRealize Automation Cloud Assembly APIs.
- Verify that you have the ID of the virtual machine in your deployment. See Get Deployment Resource IDs.
Procedure
Example: Add a Custom Properties to Your Virtual Machine
Update the virtual machine with resource ID 42f49781-1490-4a08-ae21-8baf383a72ac by adding custom properties.
Assign variables.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
Assign the virtual machine ID.
$ virtual_machine_id='42f49781-1490-4a08-ae21-8baf383a72ac'
Update the machine with custom properties.
$ curl -X PATCH \ $url/iaas/api/machines/$virtual_machine_id?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "customProperties": { "ownerName": "VMuser_Example", "ownerEmail": "[email protected]", "ownerCell": "123.456.7890" }, "description": "string", "tags": "[ { \"key\" : \"my.enumeration.type\", \"value\": \"ec2_instance\" } ]" }' | jq "."
A snippet of the response shows that the request was successful.
... "customProperties": { "ownerName": "VMuser_Example", "ownerEmail": "[email protected]", "ownerCell": "123.456.7890" "image": "ubuntu", "OStype": "LINUX", "imageId": "ami-b1234cc5", ... }, ...