Where is the best place to keep track of states?
I have a resource action I'd like to be idempotent (i.e only be allowed to run once).
The resource action operates on a vm resource. In vRA 7.x we'd simply update the custom properties of that vm. But the PATCH on /iaas/api/machines/{id} only allows tags to be set. Could do it as a tag but ... But pref. not.
Using Configuration Elements as a small DB is an option but then keeping them in sync would be required.
The resource action spins of a "Run script in guest" so I could also place a guard in the script making it idempotent. But then I couldn't filter out the status to make the resource action greyed out if the action had already been run earlier...
You can update machine custom properties by
curl -k -s -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "https://vra8.corp.local/iaas/api/machines/0bef43a7-cfcf-45fc-b98d-6087c1c7cb59" -X PATCH -d '{"customProperties":{"myprop":"updated"}}'
Hi Xian,
My thread is really about PATCH not ALLOWING new customProperties to be passed if you read my post. It's not allowed and not part of the schema looking at the documentation. I have tried it and it does not work.
Sorry to hear that. It worked for me.
Patching via vRA API does not involve the schema.
Hi again,
Actually this is a feature of 8.2 looking at the release notes. Thanks for responding!
Custom property update via API
Update custom property for machines through IaaS API