6.1.0

Table Of Contents
Example: Find Catalog Resources Filtered by Name
Table 320. 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));
Example: Find Catalog Resources Filtered by Owner
This example script performs the following actions:
1 Gets the Consumer Resource service and invokes the get method passing as a Pageable parameter an
instance of the vCACCAFEPageOdataRequest object.
2 Creates the vCACCAFEPageOdataRequest object by providing an OData query as a single filter of the
owner/ref attribute matching the user@domain.com string.
The owners/ref attribute is a composition based on the internal structure and fields of the catalog
resources. The vCACCAFECatalogResource entity has the owners attribute, which is a collection of
vCACCAFECatalogPrincipal entities. The vCACCAFECatalogPrincipal entity has the ref property, which is
a string representation of the principal id of the user.
var filter = new Array();
filter[0] = vCACCAFEFilterParam.substringOf("owners/ref",
vCACCAFEFilterParam.string("user@domain.com"));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));
Chapter 3 Using the vCloud Automation Center Plug-In
VMware, Inc. 27