User`s guide

Logging In and Getting an Organization List
Most vCloud API requests must be authenticated by a login request that supplies user credentials in the form
that Basic HTTP authentication requires. This form is MIME Base64 encoding of a string having the form
user@vcloud-organization:password. The VMware_VCloud_SDK_Service class implements a login method that takes
the following parameters:
userName
Supplied in the form user@vcloud-organization.
password
The user’s password.
hellovcloud.php encapsulates this authentication protocol in its login() method, which returns a list of
organizations to which the specified user has access. In the typical case, this list has a single member, the
organization that was supplied in the userName parameter.
Getting References to the vDC and Catalog
To instantiate a vApp template and operate the resulting vApp, you need the object references (the href values)
for the catalog in which the vApp template will be entered and the vDC in which the vApp will be deployed.
The VMware_VCloud_SDK_Org class implements getVdcRefs() and getCatalogRefs() methods that return
references to vDCs and catalogs.
Creating a vApp Template in the Catalog by Uploading an OVF Package
The hellovcloud.php command requires you to supply the name of an OVF descriptor file. This information
is used in the uploadOVFAsVappTemplate method to upload the OVF descriptor file and create a vApp template.
Creating a vApp by Instantiating the vApp Template
After the template is added to a catalog, you can create a vApp by instantiating the template.
hellovcloud.php implements an instantiateVAppTemplateDefault() that constructs a simple
InstantiateVAppTemplateParams request body, makes the request to the action/instantiateVAppTemplate
URL of the vDC, and returns a helper object that contains a reference to the vApp.
Operating the vApp
The VMware_VCloud_SDK_VApp class includes methods that perform operations on the vApp. Most of these
operations return a Task object that tracks the progress of the operation. hellovcloud.php uses these methods
to cycle the vApp through the following states:
1 $sdkVApp->deploy(), which deploys and powers on the vApp
2 $sdkVApp->undeploy(), which powers off and undeploys the vApp
3 $sdkVApp->delete(), which deletes the vApp
Run the Other Example Programs
The example programs included with the SDK display a usage message when you run them with no
parameters.
Each of the example programs in the samples folder requires that you specify parameters on the command
line. Common parameters, such as the credentials that the examples use for logging in, are read from a file
named config.php. Running an example program with no command-line parameters causes the program to
display a usage summary. You can use the summary to help construct a command line that runs the example
with parameters that are appropriate for your installation.
vCloud SDK for PHP Developer's Guide
30 VMware, Inc.