Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kclinden/c870dcd394395fe68816a6b6916843b6 to your computer and use it in GitHub Desktop.

Select an option

Save kclinden/c870dcd394395fe68816a6b6916843b6 to your computer and use it in GitHub Desktop.
Get Applicable Networks for Reservation Policy with Custom Form Dropdown
//Description: This action is used with vRA to get applicable reservations policies using a custom form dropdown.
//Inputs:
//[STRING] resPolicyId -> bind to ReservationPolicyId
//[STRING] tenant -> bind to tenant reference
//Return Type: Properties
var result = new Properties();
if(!resPolicyId) {
return result;
}
var host = vCACCAFEHostManager.getDefaultHostForTenant(tenant , true);
var reservations = vCACCAFEEntitiesFinder.getReservations(host);
for each(var resloop in reservations) {
if (resloop.reservationPolicyId == resPolicyId) {
var reservation = resloop;
}
}
var extensionData = reservation.getExtensionData();
var networks = extensionData.get("reservationNetworks").getValue();
for each (var network in networks) {
var networkId = network.getValue().get("networkPath").getValue().getId();
var networkName = network.getValue().get("networkPath").getValue().getLabel();
result.put(networkName, networkName);
}
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment