6.1.0
Table Of Contents
- Using the vCenter Orchestrator Plug-In for vCloud Automation Center 6.1
- Contents
- Using the vCenter Orchestrator Plug-In for vCloud Automation Center 6.1
- Introduction to the VMware vCenter Orchestrator Plug-In for vCloud Automation Center
- Configuring the vCloud Automation Center Plug-In
- Using the vCloud Automation Center Plug-In
- Using the vCloud Automation Center Plug-In Inventory
- Using the vCloud Automation Center Plug-In Administration Workflows
- Using the vCloud Automation Center Plug-In Infrastructure Administration Workflows
- Using the vCloud Automation Center Plug-In Requests Workflows
- Using the vCloud Automation Center Plug-In Sample Workflows
- Access the vCloud Automation Center Plug-In API
- Examples of Scripts for Common vCloud Automation Center Tasks
- Examples of Scripts for CRUD vCloud Automation Center Infrastructure Administration Tasks
- Examples of Scripts for Finding vCloud Automation Center Entities
- An Example Script for Getting a Virtual Machine Provisioned as a vCloud Automation Center Catalog Resource
- An Example Script for Content Transfer Between vCloud Automation Center Hosts
- Index
Example: Find Catalog Resources Filtered by Name and Owner
This example script combines the OData queries from the previous two examples into a single one condition
by using the vCACCAFEFilterParam.and(array of conditions) logic operator.
var conditions = new Array();
conditions[0] = vCACCAFEFilterParam.equal("name",
vCACCAFEFilterParam.string("name_of_the_resource_here"));
conditions[1] = vCACCAFEFilterParam.substringOf("owners/ref",
vCACCAFEFilterParam.string("user@domain.com"));
var filter = new Array();
filter[0] = vCACCAFEFilterParam.and(conditions);
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));
You can define other conditions by using different logic operators such as
vCACCAFEFilterParam.group(array of parameters), vCACCAFEFilterParam.not(parameter),
vCACCAFEFilterParam.startsWith(id, string), vCACCAFEFilterParam.endsWith(id, string),
vCACCAFEFilterParam.greaterThan(id, number), vCACCAFEFilterParam.lessThan(id, number), and so on.
An Example Script for Getting a Virtual Machine Provisioned as a
vCloud Automation Center Catalog Resource
You can cut, paste, and edit the JavaScript example to write scripts for retrieving the actual entities of
vCloud Automation Center provisioned resources.
The CatalogResource type represents the provisioned resources in vCloud Automation Center. This type has
an attribute of ProviderBinding type which represents the relation between the catalog resource and its
provider with the following attributes:
n
bindingId - represents the identifier of the entity which is unique for the provider
n
providerRef - identifies the catalog provider which corresponds directly to a service registered in
thevCloud Automation Center component registry
For more information about scripting in vCenter Orchestrator, see Developing with VMware vCenter
Orchestrator.
Example: Get a vCloud Automation Center Resource Provisioned by IaaS
This example uses a vCloud Automation Center host and its IaaS host as input parameters and, for a
provided resource id, returns the corresponding IaaS virtual machine. The scripting code takes only catalog
resources of Virtual Machine type that are provisioned by the iaas-service provider.
Table 3‑21. Input Variables
Variable Type
vcacHost vCACCAFE:VCACHost
iaasHost vCAC:VCACHost
// Id of the catalog resource (or vCACCAFECatalogResource_instance.getId())
var resourceId = "c222629c-6f90-4458-8c92-8ece0ba06173";
var resource = vCACCAFEEntitiesFinder.getCatalogResource(vcacHost, resourceId);
var resourceType = resource.getResourceTypeRef().getLabel();
Using the vCenter Orchestrator Plug-In for vCloud Automation Center 6.1
28 VMware, Inc.