Setting vSphere Cluster Setting 'VM dependency restart condition' via PowerCLI

A colleague requested some assistance as to whether it was possible to configure the vSphere Cluster Setting ‘VM dependency restart condition’ via PowerCLI. If you’re not familiar with this setting, it can be found in the vSphere Client web interface by editing the vSphere Availability cluster settings:

Digging around in the ExtensionData of a Cluster object in PowerCLI got us close, but it would appear that this value is not currently visible. (If you know where to find it, please let me know in the comments)

$cluster.ExtensionData.Configuration.DasConfig.DefaultVmSettings

However, looking through some of the API documentation gave us some info on how to change the value that is set. The below document lists possible values for a ClusterVmReadinessReadyCondition:

https://vdc-download.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.cluster.VmReadiness.ReadyCondition.html

Combined with these two other docs, we were able to code a solution:

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/6b586ed2-655c-49d9-9029-bc416323cb22/fa0b429a-a695-4c11-b7d2-2cbc284049dc/doc/vim.cluster.OrchestrationInfo.html#field_detail

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/6b586ed2-655c-49d9-9029-bc416323cb22/fa0b429a-a695-4c11-b7d2-2cbc284049dc/doc/vim.cluster.VmReadiness.html

For example to set the readyCondition to guestHbStatusGreen: