User`s guide
Table 3-3. Summary of SDK Objects, Containers, and Methods (Continued)
SDK Object Container Method
Extension_ResourceClass Extension_Service getResourceClass()
Extension_ResourceClassAction Extension_Service getResourceClassAction()
Extension_AclRule Extension_Service getAclRule()
Extension_ServiceResource Extension_Service getServiceResources()
Create an SDK Object
To create an SDK object, retrieve an array of object references, and use the createSDKObj method to create an
object from a reference.
You can create an SDK object when you need to run a life cycle operation such as create or modify on a vCloud
API object. Most class constructors for SDK objects require two parameters:
n
A VMware_VCloud_SDK_Service object, which contains HTTP connection information.
n
A ReferenceType data object, which contains the request URL. For more information about request URLs,
see “vCloud API REST Requests,” on page 16.
For example, you can use code similar to the fragment shown in “Example: Creating an SDK Object,” on
page 24 to create a VMware_VCloud_SDK_Org object to use as an entry point for client operations. This procedure
uses the data in Table 3-3 as a guide to creating SDK objects.
Prerequisites
Familiarize yourself with the set of SDK objects, container objects, and constructor methods listed in
Table 3-3. Examples in this procedure refer to column names in that table.
Procedure
1 Retrieve an array of object references by specifying a container object and creation method.
$references
=
Container
->
Method
2 For any reference in the array, create an SDK object using the selected reference, as the following example
shows.
SDK_Object
=$service->createSDKObj(
$reference
)
Example: Creating an SDK Object
// get the list of all organizations in the vCloud
$orgRefs = $service->getOrgRefs($orgName);
// create an object that represents the first organization in the list
$sdkOrg = $service->createSDKObj($orgRefs[0]);
// create a task object
$sdkTask = $service->createSDKObj($task);
NOTE Several new SDK objects have specialized creation methods. The following example creates a
QueryService SDK object:
$sdkQuery= VMware_VCloud_SDK_Query::getInstance($service);
vCloud SDK for PHP Developer's Guide
24 VMware, Inc.