VMware, Inc. 27
Chapter 2 Hello vCloud: A Structured REST Workflow Example
BecausethedeploymentrequestspecifiedpowerOn="true",thevAppispoweredonandreadyforusewhen
thetaskcompletes.Theclientcanwaitforasuitableintervalandcheckthetaskstatus(see“RetrieveaTask”
onpage 89),orsimplybeginrequestingoperationsonthepowered‐onvAppandchecking
thetaskstatusif
thoserequestsfail.See“DeployingandControllingvAppsandVirtualMachines”onpage 80.
Getting Information About the vApp
Asotherexampleshaveshown,aclientcanalwaysuseanHTTPGETrequesttodiscoverthecurrentstateof
anyvCloudobject,includingavApp.TheresponseinExample 2‐8revealsseveralthings:
ThevAppisdeployed(itsdeployedattributeissettotrue)andpoweredon(status="4").
TheVminitsChildrencollectionisalsopoweredonanddeployed.TheVmisconnectedtothevApp
networkcreatedduringinstantiation(seeExample 2‐6).Propertiesofthisnetworkareincludedinthe
NetworkConfigSectionofthevApp,thoughmostarenotshownhere.
ActionlinksforalloperationsexceptpowerOnarepresentinboththevAppitselfanditschildVm.Because
thevAppisalreadypoweredon,thatoperationisinvalidforthevAppinitscurrentstate,sothelinkis
notpartoftheresponse.(Thelinkfordeployis
alwayspresent,eveninadeployedvApp,becausethe
deployactionisalwaysvalid.)TheVmelementalsoincludesseverallinksforactionsthatnotapplicable
toavApp:actionslikeacquiringascreenticketorthumbnail,andinsertingorremovingmedia,are
specifictoavirtualmachine.Otheractionslike
shutdownandreboot,canbeappliedtoeitherobject.See
“DeployingandControllingvAppsandVirtualMachines”onpage 80.
Muchadditionalinformationisavailable,thoughmostofitisnotshownhere.Theexampledoesshow
wheretofindtheIPaddressofthevApp,intheIpAddresselementoftheNetworkConnection.
Example 2-8. Get Information About the vApp
Request:
GET http://vcloud.example.com/api/v1.0/vApp/vapp-7
Response:
200 OK
Content-Type: application/vnd.vmware.vcloud.vApp+xml
...
<VApp status="4" name="Linux FTP server" type="application/vnd.vmware.vcloud.vApp+xml"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7" ... >
<Link rel="power:reboot"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/power/action/reboot"/>
<Link rel="power:powerOff"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/power/action/powerOff"/>
<Link rel="undeploy" href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/action/undeploy"/>
<Link rel="deploy" href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/action/deploy"/>
<Link rel="power:shutdown"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/power/action/shutdown"/>
<Link rel="power:reset"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/power/action/reset"/>
<Link rel="power:suspend"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/power/action/suspend"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7/action/controlAccess/"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
href="http://vcloud.example.com/api/v1.0/vdc/5"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml"
href="http://vcloud.example.com/api/v1.0/vApp/vapp-7"/>
<Description>Example FTP Server vApp</Description>
<LeaseSettingsSection ...>
...
</LeaseSettingsSection>
<ovf:StartupSection ... >
...