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.
- Verify that all general prerequisites and prerequisites for theAutomation AssemblerInfrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have the ID of the virtual machine in your deployment. See Get Deployment Resource IDs.
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.
- Assign your virtual machine ID variable.Assigning this variable is useful if you plan to update the machine again.virtual_machine_id='<your_virtual_machine_id>'
- Update the machine with custom property names and values that you choose.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": { "additionalPropName1": "<custom_prop_value_1>", "additionalPropName2": "<custom_prop_value_2>", "additionalPropName3": "<custom_prop_value_3>" }, "description": "string", "tags": "[ { \"key\" : \"ownedBy\", \"value\": \"Rainpole\" } ]" }' | jq "."
- A snippet of the response lists the added custom properties.
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": "VMuser_Example@mycompany.com", "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": "VMuser_Example@mycompany.com", "ownerCell": "123.456.7890" "image": "ubuntu", "OStype": "LINUX", "imageId": "ami-b1234cc5", ... }, ...