6.1.0

Table Of Contents
System.log("resource type: " + resourceType);
var providerBinding = resource.getProviderBinding();
var bindingId = providerBinding.getBindingId();
System.log("provider binding id: " + bindingId);
var provider = providerBinding.getProviderRef();
System.log("provider id: " + provider.getId());
System.log("provider name: " + provider.getLabel());
if ((resourceType == "Virtual Machine") && (provider.getLabel() == "iaas-service")) {
System.log("It is an IaaS VM!");
// IaaS virtual machine
var vm = Server.findForType("vCAC:VirtualMachine", bindingId);
System.log("IaaS VM id: " + vm.virtualMachineID);
System.log("IaaS VM name: " + vm.displayName);
// IaaS Entity
var entity =
System.getModule("com.vmware.library.vcac").getVirtualMachineEntityFromId(iaasHost, bindingId);
System.log("IaaS entity id: " + entity.keyString);
}
An Example Script for Content Transfer Between
vCloud Automation Center Hosts
You can cut, paste, and edit the JavaScript example to write scripts for content transfer between
vCloud Automation Center hosts by using the Content service.
For more information about scripting in vCenter Orchestrator, see Developing with VMware vCenter
Orchestrator.
Example: Transfer Content from One vCloud Automation Center Host to
Another vCloud Automation Center Host
This example script performs the following actions:
1 Defines the source host that is based on a tenant administrator role.
2 Exports the content of the source host.
3 Defines the target host that is based on a tenant administrator role.
4 Imports the content to the target source.
Table 322. Input Variables
Variable Type
sourceHost string
targetHost string
var CONTENT_MANAGEMENT_SERVICE = "com.vmware.csp.core.content.service.api";
var content;
System.log("Source host: " + sourceHost.url);
Chapter 3 Using the vCloud Automation Center Plug-In
VMware, Inc. 29