VMware, Inc.
15
3
This
chapter
presents
an
example
of
using
the
vCloud
SDK
for
PHP
to
implement
a
structured
workflow
through
the
lifecycle
of
a
vApp.
The
helloVCloud.php
example,
included
in
the
samples
folder
of
the
SDK,
demonstrates
these
operations
supported
by
the
vCloud
SDK
for
PHP:
Logging
in
to
a
vCloud
organization
Browsing
the
organization
to
find
a
vDC
and
a
catalog
Instantiating
a
vApp
template
from
the
catalog
to
create
a
vApp
Operating
the
vApp
Logging
out
Like
all
example
the
programs,
helloVCloud.php
is
liberally
commented.
Read
the
comments
for
more
information
about
how
this
example
uses
the
features
of
the
vCloud
SDK
for
PHP.
Unlike
the
other
example
programs,
helloVCloud.php
does
not
read
its
runtime
options
from
the
file
config.php
.
You
must
supply
runtime
options
on
the
command
line.
To
see
a
summary
of
helloVCloud.php
options,
use
the
following
command:
php helloVCloud.php --help
To
run
the
helloVCloud.php
example,
use
the
following
command:
php helloVCloud.php -s
server
-u
user@vcloudOrganization
-p
password
-c
config
-o
=orgName
-d
=vdcName
-g
=catalogName
-i
=item
-a
=vAppName
The
following
options
are
required:
server
is
the
hostname
or
IP
address
of
a
vCloud
Director
server.
username
is
the
name
of
a
vCloud
Director
user,
in
the
form
user
@
vcloudOrganization
,
who
has
rights
to
create
and
operate
vApps.
password
is
the
user’s
password.
The
following
options
are
optional:
config
is
a
set
of
HTTP
connection
parameters
in
the
form
of
a
PHP
array.
If
you
omit
this
option,
helloVCloud.php
accepts
any
server
certificate.
The
following
specification
of
config
enables
certificate
validation,
using
a
certificate
stored
in
/tmp/cert.crt
:
-c='ssl_verify_peer=>true, ssl_verify_host=>true, ssl_cafile=>/tmp/cert.crt'
orgName
is
the
name
of
the
organization
to
which
the
user
is
authenticating.
vdcName
is
the
name
of
a
vDC
in
that
organization
where
the
user
can
instantiate
and
deploy
the
vApp.
catalogName
is
the
name
of
a
catalog
in
the
user’s
organization.
Hello vCloud: A Structured Workflow
Example
3