vCloud SDK for PHP Developer’s Guide
12
VMware, Inc.
Creating Top-Level Objects
The
vCloud
SDK
for
PHP
provides
methods
that
you
can
use
to
create
a
reference
to
a
top
level
vCloud
API
object
such
as
VCloud
and
VMWExtension
.
These
objects
do
not
have
containers,
so
you
cannot
use
the
more
common
method
shown
in
Example 1
‐
3
.
Instead,
use
one
of
the
following:
To
create
a
VMware_VCloud_SDK_Service
object
to
use
as
an
entrypoint
for
user
API
operations:
$service = VMware_VCloud_SDK_Service::getService();
To
create
a
VMware_VCloud_SDK_Admin
object
to
use
as
an
entrypoint
for
administrative
operations:
$sdkAdminObj = $service->createSDKAdminObj();
To
create
a
VMware_VCloud_SDK_Extension
object
to
use
as
an
entrypoint
for
vSphere
Platform
Extensions
operations:
$sdkExtObj = $service->createSDKExtensionObj();
Using a Different HTTP Library
Example
programs
included
in
the
vCloud
SDK
for
PHP
require
the
PEAR HTTP_Request2
package.
To
use
a
different
HTTP
library,
create
an
HTTP
client
object
that
implements
the
VMware_VCloud_SDK_Http_Client_Interface
interface,
and
then
can
call
the
VMware_VCloud_SDK_Service::getService()
method
specifying
that
client.
$service = VMware_VCloud_SDK_Service::getService($myHTTPClient);
Using the HTML Reference Material
The
reference
documentation
in
the
in
the
docs
folder
of
the
vCloud
SDK
for
PHP
download
provides
detailed
information
on
classes
and
functions.
To use the HTML documentation
1
Open
the
docs
folder
in
the
download
and
open
the
file
index.html
in
a
browser.
2
Select
VMware_VCloud_API
from
the
Packages
drop
‐
down
menu.
3
Select
a
class
(for
example,
VMware_VCloud_API_AdminOrgType
)
in
the
left
‐
hand
pane.
4
Go
to
the
Method
Summary
section
in
the
right
‐
hand
pane
and
click
the
link
for
the
__construct()
method.
The
method
summary
lists
the
constructors
for
required
and
optional
attributes
and
elements
of
the
class,
sorted
by
type.
You
can
click
the
name
of
any
element,
then
go
to
its
method
summary
to
get
information
about
its
constructors.
For
example,
VMware_VCloud_API_AdminOrgType
requires
a
VMware_VCloud_API_OrgSettingsType
element.
You
can
click
the
element
name
to
see
its
method
summary,
and
click
its
__construct()
method
to
see
the
details
of
how
to
construct
it.