Skip to content

Instantly share code, notes, and snippets.

@trisharia
Last active March 25, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trisharia/ca27a32f025416b6c59cfb5a65028abd to your computer and use it in GitHub Desktop.
Save trisharia/ca27a32f025416b6c59cfb5a65028abd to your computer and use it in GitHub Desktop.
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