VMware, Inc.
17
Chapter 3 Hello vCloud: A Structured Java Workflow Example
List<JAXBElement<? extends SectionType>> sections = instantiationParamsType
.getSection();
sections.add(new ObjectFactory()
.createNetworkConfigSection(networkConfigSectionType));
//create the request body (InstantiateVAppTemplateParams)
InstantiateVAppTemplateParamsType instVappTemplParamsType = new
InstantiateVAppTemplateParamsType();
instVappTemplParamsType.setName("HellovCloudvAppp");
instVappTemplParamsType.setSource(vAppTemplateReference);
instVappTemplParamsType.setInstantiationParams(instantiationParamsType);
//make the request, and get an href to the vApp in return
Vapp vapp = vdc.instantiateVappTemplate(instVappTemplParamsType);
return vapp;
Operate the vApp
The
Vapp
class
includes
methods
that
perform
operations
on
the
vApp.
The
majority
of
these
operations
return
a
Task
object
that
tracks
the
progress
of
the
operation.
HellovCloud.java
uses
a
number
of
these
methods
to
cycle
the
vApp
through
the
following
states:
1
deploy:
deploy()
2
power
on:
powerOn()
3
suspend:
suspend()
4
power
off:
powerOff()
5
undeploy:
undeploy()
6
delete:
delete()