FINDING ALL ITEMS IN A BUSINESS GROUP

I recently needed to figure out how many items are deployed for a specific vRA Business Group. Items include virtual machines but also anything else a user can deploy. That seemed an easy task but finding all items in a business group turned out to be a bit harder than expected.

So to save others the trouble of figuring out how this works I’ll share my code here. You can copy-paste the code below directly to a vRO action.


var cafeHost = vCACCAFEEntitiesFinder.getHostForEntity(businessGroup);
service = cafeHost.createCatalogClient().getCatalogConsumerResourceService();
var filter = new Array();
filter[0] = vCACCAFEFilterParam.substringOf("organization/subTenant/id", vCACCAFEFilterParam.string(businessGroup.id));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var odataRequest = new vCACCAFEPageOdataRequest(1, 10000, query);
resources = service.getResourcesList(odataRequest);


return resources;

Comments

Popular posts from this blog

CSP-102547 Patch Upgrade Experience VMware Identity Manager 3.3.7 & Aria Suite Lifecycle 8.18.0 (Patch 5 → 7)

Bulk Import DFW Rules to NSX-T using Aria Automation

VCF 9 Automation vs Aria Automation 8.x (Part 1)