5.5

Table Of Contents
Example: Compose a vApp
This request specifies two vAppTemplate items and one Vm item. The Vm item requires InstantiationParams
that modify its NetworkConnectionSection to specify the vApp network created for this vApp. The
vAppTemplate items inherit this setting from the base InstantiationParams element that appears before the
first SourcedItem is specified.
NOTE Virtual machines specified in Source elements must be powered off or this operation will fail. You
can use a query like this one to return a list of references to powered-off virtual machines that you have
access to.
https://vcloud.example.com/api/query?type=adminVM&format=references&filter=status==POWERED_OFF
See Chapter 9, “Using the Query Service,” on page 289.
Request:
POST https://vcloud.example.com/api/vdc/5/action/composeVApp
Content-Type: application/vnd.vmware.vcloud.composeVAppParams+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<ComposeVAppParams
name="Example Corp’s CRM Appliance"
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
<Description>Composed CRM Appliance</Description>
<InstantiationParams>
<NetworkConfigSection>
<ovf:Info>Configuration parameters for logical networks</ovf:Info>
<NetworkConfig
networkName="CRMApplianceNetwork">
<Configuration>
<ParentNetwork
href="https://vcloud.example.com/api/network/54" />
<FenceMode>natRouted</FenceMode>
</Configuration>
</NetworkConfig>
</NetworkConfigSection>
</InstantiationParams>
<SourcedItem>
<Source
href="https://vcloud.example.com/api/vApp/vm-4" />
<InstantiationParams>
<NetworkConnectionSection
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="https://vcloud.example.com/api/vApp/vm-4/networkConnectionSection/"
ovf:required="false">
<ovf:Info />
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection
network="CRMApplianceNetwork">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IsConnected>true</IsConnected>
<IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
</NetworkConnection>
vCloud API Programming Guide
102 VMware, Inc.