Skip to content

Instantly share code, notes, and snippets.

@trisharia
Last active January 14, 2019 15:09
Show Gist options
  • Save trisharia/7663173413c224dbf62aa9d0dac6a02a to your computer and use it in GitHub Desktop.
Save trisharia/7663173413c224dbf62aa9d0dac6a02a to your computer and use it in GitHub Desktop.
Get the Catalog Resource of a vRA VM
// VMware vRealize Orchestrator action sample
//
// Get the Catalog Resource of a vRA IaaS VM
//
// For vRO/VRA 7.0+
//
// Action Inputs:
// cafeHost - vCACCAFE:VCACHost - vRA CAFE Host
// virtualMachine - vCAC:VirtualMachine - vRA IaaS VM
//
// Return type: vCACCAFE:CatalogResource - the vRA Catalog Resource
var name = virtualMachine.virtualMachineName;
var id = virtualMachine.virtualMachineID;
var catalogResources = vCACCAFEEntitiesFinder.findCatalogResources(cafeHost, name);
for each (var resource in catalogResources) {
if (resource.providerBinding.getBindingId() === id) {
return resource;
}
}
System.warn("Catalog Resource not found for the given Virtual Machine.");
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment