Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the ID of the Reservation Policy of a vRA Reservation
// VMware vRealize Orchestrator action sample
//
// Get the ID of the Reservation Policy of a vRA Reservation
//
// For vRO/VRA 7.0+
//
// Action Inputs:
// host - vCAC:VCACHost - vRA IaaS Host
// reservation - vCAC:Reservation - vRA IaaS Reservation
//
// Return type: string - the ID of the Reservation Policy
var entity = reservation.getEntity();
var policies = entity.getLink(host, "HostReservationPolicy");
if (policies.length == 0) {
System.warn("No Reservation Policy found for the Reservation");
return null;
}
var policyEntity = policies[0];
var policyName = policyEntity.getProperty("name");
var policyId = policyEntity.getProperty("id");
System.log("Found Reservation Policy '" + policyName + "' with ID '" + policyId + "'");
return policyId;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment