Skip to content

Instantly share code, notes, and snippets.

@trisharia
Last active October 23, 2018 16:25
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/e75c1bae98c0195bf1a820a4cc04f43b to your computer and use it in GitHub Desktop.
Save trisharia/e75c1bae98c0195bf1a820a4cc04f43b to your computer and use it in GitHub Desktop.
Get day-2 or resource action requests of a vRA catalog resource
// VMware vRealize Orchestrator action sample
//
// Returns day-2 or resource action request(s) that have been submitted for a vRA catalog resource
//
// For vRA 7.0+/vRO 7.0+
//
// Action Inputs:
// cafeHost - vCACCAFE:VCACHost - vRA CAFE host
// resource - vCACCAFE:CatalogResource - catalog resource for which to get day-2 requests
// actionLabel - string - optional action label to filter by
//
// Return type: Array/vCACCAFE:ResourceActionRequest - the value for the given key
var resourceActionRequests = [];
var allActionRequests = vCACCAFEEntitiesFinder.getResourceActionRequests(cafeHost);
var resourceId = resource.id;
//System.log("allActionRequests "+allActionRequests);
for each (request in allActionRequests) {
if (resourceId === request.resourceRef.getId()) {
System.log("Found requestID match : " + request.resourceRef.getId());
if (actionLabel !== null && actionLabel !== "") {
System.log("Label defined : "+actionLabel);
if (actionLabel === request.resourceActionRef.getLabel()) {
System.log("Label matched action label");
resourceActionRequests.push(request);
}
} else {
resourceActionRequests.push(request);
System.log("Label not defined, grabbing action request with label : " + request.resourceActionRef.getLabel());
}
}
}
return resourceActionRequests;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment