6.2

Table 46. Input Variables
Variable Type
host vCAC:VcacHost
var modelName = 'ManagementModelEntities.svc';
var entitySetName = 'VirtualMachines';
var filter = "VirtualMachineState eq 'Off' and IsComponent eq true";
var orderBy = 'VirtualMachineName asc';
var top = 10; {
var skip = 0;,
var headers = null;
var select = null;
var entities = vCACEntityManager
readModelEntitiesBySystemQuery(host.id, modelName, entitySetName, filter, orderBy, select,
top, skip, headers);
Finding vCloud Automation Center Entities Example Scripts
You can cut, paste, and edit the JavaScript examples to write scripts for finding vCloud Automation Center
entities by using the vCACCAFEEntitiesFinder scripting utility object.
For more information about scripting in vCenter Orchestrator, see Developing with VMware vCenter
Orchestrator.
Example: Find Catalog Resources Filtered by Name
Table 47. Input Variables
Variable Type
host vCAC:VcacHost
You can use one the following examples:
n
This example script gets all catalog resources for the target host matching the query of
name_of_the_resource by name and description.
var items = vCACCAFEEntitiesFinder.findCatalogResources(host, "name_of_the_resource");
n
This example script performs the following actions:
a Gets the Consumer Resource service and invokes the get method passing as a Pageable parameter
an instance of the vCACCAFEPageOdataRequest object.
b Creates the vCACCAFEPageOdataRequest object by providing an OData query as a single filter of the
name attribute matching the name_of_the_resource string.
var service = host.createCatalogClient().getCatalogConsumerResourceService();
var filter = new Array();
filter[0] = vCACCAFEFilterParam.equal("name",
vCACCAFEFilterParam.string("name_of_the_resource"));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));
Chapter 4 Example vCloud Automation Center Plug-In Scripts
VMware, Inc. 29