Skip to content

Instantly share code, notes, and snippets.

@trisharia
Created May 12, 2018 00:50
Show Gist options
  • Save trisharia/532e065baa3b3103277ed2b043c6aec6 to your computer and use it in GitHub Desktop.
Save trisharia/532e065baa3b3103277ed2b043c6aec6 to your computer and use it in GitHub Desktop.
Get a vRA reservation object given its ID
// VMware vRealize Orchestrator action sample
//
// Get a vRA reservation object given its ID
//
// For vRO/VRA 7.0+
//
// Action Inputs:
// cafeHost - vCACCAFE:VCACHost - vRA host
// reservationId - string - ID of a Reservation
//
// Return type: vCACCAFE:Reservation - vRA reservation
var client = cafeHost.createReservationClient();
var service = client.getReservationReservationService();
var reservations = service.getAllReservations().getContent(); //Array, vCACCAFE:vCACCAFEReservation
for each (var reservation in reservations) {
if (reservation.getId() === reservationId) {
System.log("Reservation found in vCACCAFE inventory with ID '" + reservationId + "'");
return reservation;
}
}
System.warn("No Reservation found in vCACCAFE inventory with ID '" + reservationId + "'");
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment