© 2009 VMware Inc. All rights reserved
VMware vCloud SDK for PHP
Kimberly Wang ([email protected])
Ecosystem Engineering, VMware, Inc.
09/2010
2
Agenda
� Introduction to VMware vCloud SDK for PHP
�Writing your first program using the SDK
Pre-requisite
� Familiarity with VMware vCloud API and the cloud resource model
� Familiarity with PHP, REST
3
Features
� Make the VMware vCloud REST API available in PHP
� Provides vCloud client library for vCloud resource entities access and
management
� Hide REST, XML processing to the user
� Straight forward SDK API allows user easily create a new or extend an
existing application with VMware vCloud Director
4
SDK Components
� VMware_VCloud_API packages
� Classes are generated from VMware vCloud REST API schema files.
� Each class maps to a complexType defined in the schema file.
� Contains all the types defined in vCloud API, vCloud administrative API and vCloud
administrative extension API.
� Objects of these classes are referred to as vCloud data objects.
� VMware_VCloud_SDK packages
� Classes map to vCloud resource entities, for the lifecycle (CURD) of the entities
� HTTP request/response classes
� Utility functions
� Objects of these classes are referred to as vCloud SDK objects.
VMware_VCloud_API Packages
VMware_VCloud_API Packages
VMware_VCloud_API Packages
� Packages are defined based on schema namespaces
� VMware_VCloud_API
� VMware_VCloud_API_OVF
� VMware_VCloud_API_Extension
� VMware_VCloud_API_Version
7
VMware_VCloud_API Classes
� Major classes support vCloud user API
� VMware_VCloud_API_OrgType
� VMware_VCloud_API_VdcType
� VMware_VCloud_API_VAppType
� VMware_VCloud_API_VmType
� VMware_VCloud_API_VAppTemplateType
� VMware_VCloud_API_CatalogType
� VMware_VCloud_API_CatalogItemType
� VMware_VCloud_API_MediaType
� VMware_VCloud_API_OrgNetworkType
� VMware_VCloud_API_TaskType
� VMware_VCloud_API_FileType
8
VMware_VCloud_API Classes (Continued)
� Major classes support vCloud administrative API
� VMware_VCloud_API_VCloudType
� VMware_VCloud_API_AdminOrgType
� VMware_VCloud_API_AdminVdcType
� VMware_VCloud_API_RoleType
� VMware_VCloud_API_RightType
� VMware_VCloud_API_UserType
� VMware_VCloud_API_GroupType
� VMware_VCloud_API_CatalogType
� VMware_VCloud_API_OrgNetworkType
VMware_VCloud_API Classes (Continued)
� Major classes support vCloud administrative extension API
� VMware_VCloud_API_Extension_HostType
� VMware_VCloud_API_Extension_VimServerType
� VMware_VCloud_API_Extension_ShieldManagerType
� VMware_VCloud_API_Extension_VMWProviderVdcType
� VMware_VCloud_API_Extension_VMWNetworkPoolType
� VMware_VCloud_API_Extension_VMWExternalNetworkType
� VMware_VCloud_API_Extension_VMWExtensionType
� VMware_VCloud_API_Extension_ResourcePoolType
� VMware_VCloud_API_Extension_PortGroupPoolType
� VMware_VCloud_API_Extension_FencePoolType
� VMware_VCloud_API_Extension_VlanPoolType
10
VMware_VCloud_API Classes (Continued)
� Other classes
� VMware_VCloud_API_ErrorType -- For error message in VMware vCloud Director
� VMware_VCloud_API_ReferenceType – For reference to a vCloud entity
� VMware_VCloud_API_ParamsType -- Base class used to specify parameters
� Examples of subclasses
• VMware_VCloud_API_VAppCreationParamsType
• VMware_VCloud_API_ComposeVAppParamsType.
� VMware_VCloud_API_OVF_Section_Type -- Base class for sections used in
VAppType, VAppTemplateType, etc.
� Examples of subclasses
• VMware_VCloud_API_OVF_OperatingSystemSection_Type
• VMware_VCloud_API_OVF_VirtualHardwareSection_Type
11
VMware_VCloud_API Class – Details (Continued)
� Each class contains a constructor method. Parameter list consists
of attributes of the class and its parent class, and all the way up to
its root class.
� Each class contains setter and getter methods for XML element
attributes and child elements accessing.
� naming convention (use setters as examples).
• set_<attribute>: for example, set_name($name).
• set<Child Element>: for example, setFullName($fullname).
� Each class contains export() and build() methods.
� export() – for exporting object to an XML string.
� build() – for parsing an XML string to vCloud data object. The SDK can parse the XML string automatically to a data object.
12
Creating a vCloud Data Object
� Two ways to create a data object
� Start with an constructor without parameters, then invoke the setter methods to set the parameters. For example,
• $ref = new VMware_VCloud_API_ReferenceType();
$ref->set_href($href);
$ref->set_type($type);
$ref->set_name($name);
� Invoke the constructor with parameters. For example,
• $ref = new VMware_VCloud_SDK_API_ReferenceType($href, $type, $name);
13
Creating a Data Object - Using the SDK API Documentation
� Using VMware_VCloud_API_AdminOrgType as an example,
describes how to create a data object with the help of the SDK API
documentation.
1. Select the VMware_VCloud_API from the “packages” drop down menu.
2. Select class VMware_VCloud_API_AdminOrgType in the left pane.
3. Go to the “Method Summary” section in the right pane, select and navigate to the constructor, __construct(), method link.
4. Look for “required” object attributes. $name, $FullName, $Settings are required for constructing a VMware_VCloud_API_AdminOrgType data object.
5. $name and $FullName contain string values, set them with set_name($name) and setFullName($fullname) methods respectively. $name and $fullname are given by the caller.
6. $Settings is a VMware_VCloud_API_OrgSettingsType data object. To get its parameters information, repeat with step 4, looking for the required object attributes. $IsEnabled, $CanPublishCatalogs and $OrgLdapMode are required for constructing the object.
14
Creating a Data Object - Using the SDK API Documentation (Cont.)
7. $IsEnabled and $CanPublishCatalogs contain boolean values, set with
setIsEnabled($enable) and setCanPublishCatalogs($publish) methods respectively.
$enable and $publish are decided by the caller.
8. $OrgLdapMode contains a string value. The “allowed values” restricts its value has to
be one of the following, ‘NONE’, ‘SYSTEM’, ‘CUSTOM’.
Creating a Data Object - Using the SDK API Documentation (Cont.)
� As a summary, here is the code to create a
VMware_VCloud_API_AdminOrgType data object.
$adminOrg = new VMware_VCloud_API_AdminOrgType();
$adminOrg->set_name(‘myOrg’);
$adminOrg->setFullName(‘my org fullname’);
$settings = new VMware_VCloud_API_OrgSettingsType();
$settings->setIsEnabled(true);
$settings->setCanPublishCatalogs(true);
$settings->setOrgLdapMode(‘NONE’);
$adminOrg->setSettings($settings);
VMware_VCloud_SDK Packages
VMware_VCloud_SDK Packages
VMware_VCloud_SDK Packages
� Three packages
� VMware_VCloud_SDK
� user and administrative operations
� VMware_VCloud_SDK_Extension
� admin extension operations
� VMware_VCloud_SDK_Http
� HTTP request/response
18
VMware_VCloud_SDK Classes
� Classes support vCloud user level operations
� VMware_VCloud_SDK_Org -- entry point for references to other resource entities
� VMware_VCloud_SDK_Vdc
� VMware_VCloud_SDK_VApp
� VMware_VCloud_SDK_Vm
� VMware_VCloud_SDK_VAppTemplate
� VMware_VCloud_SDK_Catalog
� VMware_VCloud_SDK_CatalogItem
� VMware_VCloud_SDK_Media
� VMware_VCloud_SDK_Network
19
VMware_VCloud_SDK Classes (Continued)
� Classes support vCloud administrative level operations
� VMware_VCloud_SDK_Admin -- admin entry point
� VMware_VCloud_SDK_AdminOrg
� VMware_VCloud_SDK_AdminVdc
� VMware_VCloud_SDK_Role
� VMware_VCloud_SDK_User
� VMware_VCloud_SDK_Group
� VMware_VCloud_SDK_AdminCatalog
� VMware_VCloud_SDK_AdminNetwork
� Other classes
� VMware_VCloud_SDK_Service -- SDK entry point, login/logout, etc.
� VMware_VCloud_SDK_Factory -- Handles SDK objects creation
� VMware_VCloud_SDK_Exception
20
VMware_VCloud_SDK_Extension Classes
� Classes support vCloud administrative extension level operations
� VMware_VCloud_SDK_Extension -- admin extension entry point
� VMware_VCloud_SDK_Extension_Host
� VMware_VCloud_SDK_Extension_VimServer
� VMware_VCloud_SDK_Extension_VMWExternalNetwork
� VMware_VCloud_SDK_Extension_VMWNetworkPool
� VMware_VCloud_SDK_Extension_VMWProviderVdc
21
VMware_VCloud_SDK_Http Classes
� Classes support HTTP request and response
� VMware_VCloud_SDK_Http_Client
� VMware_VCloud_SDK_Http_Exception
� Default client implementation uses PEAR HTTP_Request2 library
� Users can use their own choices by extending the following
interfaces.
� VMware_VCloud_SDK_Http_Client_Interface
� VMware_VCloud_SDK_Http_Response_Interface
22
Creating an SDK Object
� To create a user operation entry point, VMware_VCloud_SDK_Org
object
� $orgRefs = $service->getOrgRefs($orgName);
$sdkOrg = $service->createSDKObj($orgRefs[0]);
� To create an admin operation entry point,
VMware_VCloud_SDK_Admin object
� $sdkAdminObj = $service->createSDKAdminObj();
� To create an admin extension operation entry point,
VMware_VCloud_SDK_Extension object
� $sdkExtObj = $service->createSDKExtensionObj();
� To create other SDK objects
� $sdkObj = $service->createSDKObj($ref);
� $ref is a ReferenceType or LinkType data object or a resource entity URL string.
� For how to trace down to get a referenceType object, refer to the next slides.
23
Creating a VMware vCloud SDK Object (Continued)
The following table lists how to get a ReferenceType object to create
an SDK object. Note, the package name of the SDK object is
omitted. The formula is,
$reference = [column2 SDK obj] -> [column 3 SDK method];
[column 1 SDK obj] = $service->createSDKObj($reference);
SDK Object to Create
Container Object of the SDK Object to Create
Method to be Invoked on the SDK Container Object
Org Service getOrgRefs(), getSystemOrgRef(), getAdminSystemOrgRef()
Vdc Org getVdcRefs()
Catalog Org getCatalogRefs()
Network Org getOrgNetworkRefs()
VApp Vdc getVAppRefs()
VAppTemplate Vdc getVAppTemplateRefs()
Media Vdc getMediaRefs()
CatalogItem Catalog getCatalogItemRefs()
VApp VApp getContainedVAppRefs()
Vm VApp getContainedVmRefs()
24
Create a VMware vCloud SDK Object (Continued)
SDK Object to Create
Container Object of the SDK Object to Create
Method to be Invoked on the SDK Container Object
AdminOrg Admin getAdminOrgRefs()
ExternalNetwork Admin getExternalNetworkRefs()
Role Admin getRoleRefs()
<No SDK object> Admin getRightRefs()
<No SDK object> Admin getProviderVdcRefs()
AdminVdc AdminOrg getAdminVdcsRefs()
AdminCatalog AdminOrg getAdminCatalogRefs()
Group AdminOrg getGroupRefs()
User AdminOrg getUserRefs()
AdminNetwork AdminOrg getAdminNetworkRefs()
CatalogItem AdminCatalog getCatalogItemRefs()
25
Create a VMware vCloud SDK Object (Continued)
SDK Object to Create Container Object of the SDK Object to Create
Method to be Invoked on the SDK Container Object
Extension_VMWProviderVdc Extension getVMWProviderVdcRefs()
Extension_VMWExternalNetwork Extension getVMWExternalNetworkRefs()
Extension_VMWNetworkPool Extension getVMWNetworkPoolRefs()
Extension_VimServer Extension getVimServerRefs()
Extension_Host Extension getHostRefs()
<No SDK object> Extension_VMWProviderVdc getNetworkPoolRefs()
<No SDK object> Extension_VimServer getResourcePoolRefs()
26
VMware_VCloud_SDK Classes – Details (Continued)
� Methods are defined to retrieve, create, modify or delete vCloud
entities
� Methods for retrieving a vCloud entities are defined in the SDK mapped container class of the entity. For example, getVdcs() is defined in VMware_VCloud_SDK_Org class.
� For retrieving entities, usually each entity type has two methods,
• get<Entity>Refs() -- Get the references to the entities in an array. For example,
getVdcRefs()
• get<Entity>s() -- Get the entity data objects in an array. For example, getVdcs().
� Methods for creating a vCloud entities are defined in the SDK mapped container class. For example, to upload an OVF package to vCloud as a vAppTemplate, method uploadOVFAsVAppTemplate() is defined in VMware_VCloud_SDK_Vdc class.
� Methods for modifying or deleting a vCloud entity are defined in the SDK mapped class itself.
� For supported operations, please refer to the SDK API reference
documentation or VMware vCloud API Guide.
27
Use the SDK
� User can create SDK objects and use methods defined in the SDK
objects to create, retrieve, update, delete vCloud entities.
�When user needs to access attributes of vCloud entities, or to
construct a data object used for sending a request to vCloud, use
data objects directly. For example,
� To get the name of an organization, invoke get_name() method on a VMware_VCloud_API_OrgType data object.
� To construct a ParamType data object for a clone operation.
28
First Program using SDK – Login
� Log into a VMware vCloud service portal
� To get a service object
� $service = VMware_VCloud_SDK_Service::getService();
� Log in
• $service->login($server, $auth, $httpConfig)*;
* If proxy and/or SSL certificate are used, configure the $httpConfig array. For details, refer to
config.php under the samples directory in the SDK package and HTTP_Request2 documentation.
� Successful login returns a list of references to all the organizations
that the user has access to.
� $orgListObj = $service->login($server, $auth, $httpConfig);
29
Sample Code
� This example demonstrates how to get and power on a virtual
machine. For simplicity, it always pick the first element of an array.
<?php
require_once 'config.php'; // includes all needed libraries and parameters setting
$service = VMware_VCloud_SDK_Service::getService();
$service->login ($server, $auth, $httpConfig);
$orgRefs = $service->getOrgRefs(); //get references for vCloud organization entities
$sdkOrg = $service->createSDKObj($orgRefs[0]); // create an SDK Org object
$vdcRefs = $sdkOrg->getVdcRefs(); // get references to vCloud vDC entities
$sdkVdc = $service->createSDKObj($vdcRefs[0]); // create an SDK vDC object
$vAppRefs = $sdkVdc->getVAppRefs(); // get references to vCloud vApp entities
$sdkVApp = $service->createSDKObj($vAppRefs[0]); // create an SDK vApp object
$vmRefs = $sdkVApp->getContainedVmRefs(); // get contained Vms
$sdkVm = $service->createSDKObj($vmRefs[0]); // create an SDK Vm object
$sdkVm->powerOn(); // power on the Vm
?>
References
� VMware vCloud SDK for PHP operations and methods reference
Operation Since Description PHP SDK method(s) for the operation
GET .../api/versions v0.9 Retrieves the version information. $service->getAPIVersion();GET .../api/v1.0/schema/<schema_file_name> v0.9 Retrieves a schema file. No direct method, do through $service->get($url);
POST .../api/v1.0/login v0.9 Login with HTTP POST request. $service->login();
POST .../api/v1.0/logout v0.9 Logs out the user and invalidates the authentication token returned by login.
$service->logout();
GET .../api/v1.0/org v0.9 Retrieves a list of organizations. $service->getOrgRefs();GET .../api/v1.0/org/<org-id> v0.9 Retrieves an organization. $service->getOrgs();
GET .../api/v1.0/vdc/<vdc-id> v0.9 Retrieves a virtual data center. $sdkOrg->getVdcs();
$sdkVdc->instantiateVAppTemplateDefault(); Or$sdkVdc->instantiateVAppTemplate();
POST .../api/v1.0/vdc/<vdc-id>/action/captureVApp v0.9 Captures a vApp into vApp template. $sdkVdc->captureVApp();POST .../api/v1.0/vdc/<vdc-id>/action/cloneMedia v0.9 Clones a media. $sdkVdc->cloneMoveMedia();
POST .../api/v1.0/vdc/<vdc-id>/action/cloneVApp v0.9 Clones a vApp into new vApp. $sdkVdc->cloneMoveVApp();POST .../api/v1.0/vdc/<vdc-id>/action/cloneVAppTemplate v0.9 Clones a vApp template. $sdkVdc->cloneMoveVAppTemplate();
POST .../api/v1.0/vdc/<vdc-id>/action/composeVApp v0.9 Composes a new vApp using VMs from other vApps or vAppTemplates.
$sdkVdc->composeVApp();
POST .../api/v1.0/vdc/<vdc-id>/action/uploadVAppTemplate v0.9 Uploading vApp template to a vDC. $sdkVdc->uploadOVFAsVAppTemplate();
$sdkOrg->getCatalogs(); Or$catalogRefs = $sdkOrg->getCatalogRefs();$sdkCatalog = $service->createSDKObj($catalogRef);$sdkCatalog->getCatalog();
GET .../api/v1.0/org/<org-id>/catalog/<catalog-id>/controlAccess v0.9 Retrieves the catalog control access information.
$sdkCatalog->getControlAccess();
POST .../api/v1.0/org/<org-id>/catalog/<catalog-id>/action/controlAccess
v0.9 Modifies a catalog control access. $sdkCatalog->modifyControlAccess();
POST .../api/v1.0/catalog/<catalog-id>/catalogItems v0.9 Creates a catalog item in a catalog. $sdkCatalog->addCatalogItem();$sdkCatalog->getCatalogItems(); Or$catalogItemRefs = $sdkCatalog->getCatalogItemRefs();$sdkCatalogItem = $service->createSDKObj($catalogitemRef);$sdkCatalogItem->getCatalogItem();
PUT .../api/v1.0/catalogItem/<catalog-item-id> v0.9 Modifies a catalog item. $sdkCatalogItem->modify();DELETE .../api/v1.0/catalogItem/<catalog-item-id> v0.9 Deletes a catalog item. $sdkCatalogItem->delete();
$sdkVdc->uploadFloppyMedia();$sdkVdc->uploadIsoMedia()$sdkVdc->getMedias(); Or$mediaRefs = $sdkVdc->getMediaRefs();
$sdkMedia = $service->createSDKObj($mediaRef);
$sdkMedia->getMedia();
List of vCloud User API Operations
Retrieves a catalog item.v0.9GET .../api/v1.0/catalogItem/<catalog-item-id>
Creates a media (and present upload link for the floppy/iso file).
POST .../api/v1.0/vdc/<vdc-id>/media v0.9
Retrieves a media.v0.9GET .../api/v1.0/media/<media-id>
Instantiate a vApp template into a new vApp.
POST .../api/v1.0/vdc/<vdc-id>/action/instantiateVAppTemplate v0.9
Retrieves a catalog.v0.9GET .../api/v1.0/catalog/<catalog-id>
$sdkMedia->modifyName();
$sdkMedia->modifyDescription();DELETE .../api/v1.0/media/<media-id> v0.9 Deletes a media. $sdkMedia->delete();
GET .../api/v1.0/task/<task-id> v0.9 Retrieves a task. No direct method, do through $service->get($url);
GET .../api/v1.0/tasksList/<org-id> v0.9 Retrieves a list of tasks bound to an organization.
No direct method, do through $service->get($url)
$sdkVdc->getVApps(); Or$VAppRefs = $sdkVdc->getVAppRefs();
$sdkVApp = $service->createSDKObj($VAppRef);
$sdkVApp->getVApp();PUT .../api/v1.0/vApp/<vapp-id> v0.9 Modifies the name/description of a vApp. $sdkVApp->modify();
DELETE .../api/v1.0/vApp/<vapp-id> v0.9 Deletes a vApp. $sdkVApp->delete();
POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/powerOn v0.9 Powers on a vApp/VM. $sdkVApp->powerOn();/$sdkVm->powerOn();
POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/powerOff v0.9 Powers off a vApp/VM. $sdkVApp->powerOff();/$sdkVm->powerOff();POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/suspend v0.9 Suspends a vApp/VM. $sdkVApp->suspend();/$sdkVm->suspend();POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/reboot v0.9 Reboots a vApp/VM. $sdkVApp->reboot();/$sdkVm->reboot();POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/reset v0.9 Resets a vApp/VM. $sdkVApp->reset();/$sdkVm->reset();POST .../api/v1.0/vApp/<vapp/vm-id>/power/action/shutdown v0.9 Shutdowns a vApp/VM. $sdkVApp->shutdown();/$sdkVm->shutdown();
POST .../api/v1.0/vApp/<vapp/vm-id>/action/deploy v0.9 Deploy a vApp/VM. $sdkVApp->deploy();/$sdkVm->deploy();POST .../api/v1.0/vApp/<vapp/vm-id>/action/undeploy v0.9 Undeploy a vApp/VM. $sdkVApp->undeploy();/$sdkVm->undeploy();POST .../api/v1.0/vApp/<vapp/vm-id>/action/discardSuspendedState v0.9 Discard suspended state of a vApp/VM. $sdkVApp->discardSuspendedState(); /$sdkVm->
discardSuspendedState();POST .../api/v1.0/vApp/<vapp-id>/action/recomposeVApp v1.0 Recompose vApp. $sdkVApp->recompose();
POST .../api/v1.0/vApp/<vapp-id>/action/controlAccess v0.9 Modifies the control access of a vApp. $sdkVApp->modifyControlAccess();GET .../api/v1.0/vApp/<vapp-id>/controlAccess v0.9 Retrieves the control access information
for a vApp.$sdkVApp->getControlAccess();
GET .../api/v1.0/vApp/<vapp-id>/leaseSettingsSection v0.9 Retrieves the lease settings section of a vApp.
$sdkVApp->getLeaseSettings();
PUT .../api/v1.0/vApp/<vapp-id>/leaseSettingsSection v0.9 Modifies the lease settings section of a vApp.
$sdkVApp->modifyLeaseSettings();
DELETE .../api/v1.0/vApp/<vapp-id>/leaseSettingsSection v0.9 Deletes the lease settings section of a vApp.
$sdkVApp->deleteLeaseSettings();
GET .../api/v1.0/vApp/<vapp-id>/networkConfigSection v0.9 Retrieves the network config section of a vApp.
$sdkVApp->getNetworkConfigSettings();
PUT .../api/v1.0/vApp/<vapp-id>/networkConfigSection v0.9 Modifies the network config section of a vApp.
$sdkVApp->modifyNetworkConfigSettings();
Updates the name/description of a
media.
v0.9PUT .../api/v1.0/media/<media-id>
Retrieves a vApp.v0.9GET .../api/v1.0/vApp/<vapp-id>
GET .../api/v1.0/vApp/<vapp-id>/networkSection v0.9 Retrieves the network section of a vApp. $sdkVApp->getNetworkSettings();
GET .../api/v1.0/vApp/<vm-id>/operatingSystemSection v0.9 Retrieves the operating system section of a VM.
$sdkVm->getOperatingSystemSettings();
PUT .../api/v1.0/vApp/<vm-id>/operatingSystemSection v0.9 Modifies the operating system section of a VM.
$sdkVm->modifyOperatingSystemSettings();
GET .../api/v1.0/vApp/<vm-id>/screen v0.9 Retrieves the thumbnail of the screen of a VM.
$sdkVm->getScreenThumbnailImage();
$sdkVm->getScreenTicket() Or$sdkVm->getScreenTicketTokens();
POST .../api/v1.0/vApp/<vm-id>/action/ejectMedia v0.9 Ejects a media from a VM. $sdkVm->ejectMedia();
POST .../api/v1.0/vApp/<vm-id>/action/insertMedia v0.9 Inserts a media into a VM. $sdkVm->insertMedia();
GET .../api/v1.0/vApp/<vapp-id>/startupSection v0.9 Retrieves the startup section of a vApp. $sdkVApp->getStartupSettings();
PUT .../api/v1.0/vApp/<vapp-id>/startupSection v0.9 Modifies the startup section of a vApp. $sdkVApp->modifyStartupSettings();DELETE .../api/v1.0/vApp/<vapp-id>/startupSection v0.9 Deletes the startup section of a vApp. $sdkVApp->deleteStartupSettings();
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection v0.9 Retrieves the virtual hardware section of a VM.
$sdkVm->getVirtualHardwareSettings();
PUT .../api/v1.0/vApp/<vm-id>/virtualHardwareSection v0.9 Modifies the virtual hardware section of a VM.
$sdkVm->modifyVirtualHardwareSettings();
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/cpu v0.9 Retrieves the RASD item that contains CPU information from virtual hardware section of a VM.
$sdkVm->getVirtualHardwareCpu();
PUT .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/cpu v0.9 Modifies the CPU properties in virtual hardware section of a VM.
$sdkVm->modifyVirtualHardwareCpu();
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/memory v0.9 Retrieves the RASD item that contains memory information from virtual hardware section of a VM.
$sdkVm->getVirtualHardwareMemory();
PUT .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/memory v0.9 Modifies the memory properties in virtual hardware section of a VM.
$sdkVm->modifyVirtualHardwareMemory();
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/disks v0.9 Retrieves a list of RASD items for disks from virtual hardware section of a VM.
$sdkVm->getVirtualHardwareDisks();
PUT .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/disks v0.9 Modifies the disks list virtual hardware section of a VM.
$sdkVm->modifyVirtualHardwareDisk();
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/media v0.9 Retrieves the list of RASD items that represents the floppies and CD/DVD drives in a VM.
$sdkVm->getVirtualHardwareMedia();
Acquires the screen ticket for a VM.POST .../api/v1.0/vApp/<vm-id>/screen/action/acquireTicket v0.9
GET .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/networkCards v0.9 Retrieves a list of RASD items of
network cards from virtual hardware section of a VM.
$sdkVm->getVirtualHardwareNetworkCards();
PUT .../api/v1.0/vApp/<vm-id>/virtualHardwareSection/networkCards v0.9 Modifies the network cards list virtual hardware section of a VM.
$sdkVm->modifyVirtualHardwareNetworkCard()
GET .../api/v1.0/vApp/<vm-id>/guestCustomizationSection v1.0 Retrieves the guest customization
section of a VM.
$sdkVm->getGuestCustomizationSettings();
PUT .../api/v1.0/vApp/<vm-id>/guestCustomizationSection v1.0 Updates the guest customization options of a VM
$sdkVm->modifyGuestCustomizationSettings();
GET .../api/v1.0/vApp/<vm-id>/networkConnectionSection v0.9 Retrieves the network connection section
of a VM.
$sdkVm->getNetworkConnectionSettings();
PUT .../api/v1.0/vApp/<vm-id>/networkConnectionSection v0.9 Modifies the network connection section
of a VM.
$sdkVm->modifyNetworkConnectionSettings();
GET .../api/v1.0/vApp/<vm-id>/question v0.9 Retrieves pending question for a VM. $sdkVm->getPendingQuestion();
POST .../api/v1.0/vApp/<vm-id>/question/action/answer v0.9 Answer on a pending question. $sdkVm->answerPendingQuestion();
$sdkVdc->getVAppTemplates(); Or$vAppTemplateRefs = $sdkVdc->getVAppTemplateRefs();$sdkVAppTemplate = $service->createSDKObj($vAppTemplateRef);$sdkVAppTemplate->getVAppTemplate();
PUT .../api/v1.0/vAppTemplate/<vapp-template-id> v0.9 Modifies only the name/description of a vApp template.
$sdkVAppTemplate->modifyName();
$sdkVAppTemplate->modifyDescription();DELETE .../api/v1.0/vAppTemplate/<vapp-template-id> v0.9 Deletes a vApp template. $sdkVAppTemplate->delete();POST .../api/v1.0/vAppTemplate/<vapp-template-
id>/action/enableDownload
v0.9 Enables downloading of the ovf of a vApp template.
$sdkVAppTemplate->enableDownload();
POST .../api/v1.0/vAppTemplate/<vapp-template-id>/action/disableDownload
v0.9 Disables the download link to the ovf of a vApp template.
$sdkVAppTemplate->disableDownload();
GET .../api/v1.0/vAppTemplate/<vapp-template-id>/customizationSection
v1.0 Retrieves the customization section of a vApp template.
$sdkVAppTemplate->getCustomizationSettings();
PUT .../api/v1.0/vAppTemplate/<vapp-template-id>/customizationSection
v1.0 Updates the vAppTemplate customization information.
$sdkVAppTemplate->modifyCustomizationSettings();
GET .../api/v1.0/vAppTemplate/<vapp-template-id>/networkConfigSection
v0.9 Retrieves the network config section of a vApp template.
$sdkVAppTemplate->getNetworkConfigSettings();
GET .../api/v1.0/vAppTemplate/<vapp-template-id>/networkSection v0.9 Retrieves the network section of a vApp template.
$sdkVAppTemplate->getNetworkSettings();
GET .../api/v1.0/vAppTemplate/<vapp-template-id>/ovf v0.9 Retrieves an OVF descriptor of a vApp template.
$sdkVAppTemplate->downloadOVFFiles(); Or $service->get($url);
GET .../api/v1.0/network/<network-id> v0.9 Retrieves an organization network. $sdkVdc->getAvailableNetworks();
Retrieves a vApp template (can be used also to retrieve a VM from a vAppTemplate).
v0.9GET .../api/v1.0/vAppTemplate/<vapp-template-id>
Operation Since Description PHP SDK method(s) for the operation
$service->getAdmin(); Or$sdkAdmin = $service->createSDKAdminObj();
$sdkAdmin->getVCloud();GET .../api/v1.0/admin/providervdc/<provider-vdc-id> v0.9 Get the representation of the
Provider vDC.
$sdkAdmin->getProviderVdcs();
GET .../api/v1.0/admin/providervdc/<provider-vdc-id>/vdcReferences
v1.0 Retrieves all org vDCs for given provider vDC.
No direct method, do through $service->get($url);
POST .../api/v1.0/admin/orgs v0.9 Creates an organization. $sdkAdmin->createOrganization();
$sdkAdmin->getAdminOrgs(); Or$adminOrgRefs = $sdkAdmin->getAdminOrgRefs();$sdkAdminOrg = $service->createSDKObj($adminOrgRef);
$sdkAdminOrg->getAdminOrg();
PUT .../api/v1.0/admin/org/<org-id> v0.9 Modifies an admin organization. $sdkAdminOrg->modify();
DELETE .../api/v1.0/admin/org/<org-id> v0.9 Deletes an admin organization. $sdkAdminOrg->delete();
POST .../api/v1.0/admin/org/<org-id>/action/enable v1.0 Enables an admin organization. $sdkAdminOrg->enable();
POST .../api/v1.0/admin/org/<org-id>/action/disable v1.0 Disables an organization. $sdkAdminOrg->disable();
POST .../api/v1.0/admin/org/<org-id>/vdcs v0.9 Creates a virtual data center in an organization.
$sdkAdminOrg->createAdminVdc();
$sdkAdminOrg->getAdminVdcs(); Or$adminVdcRefs = $sdkAdminOrg->getAdminVdcRefs();$sdkAdminVdc = $service->createSDKObj($adminVdcRef);$sdkAdminVdc->getAdminVdc();
PUT .../api/v1.0/admin/vdc/<vdc-id> v0.9 Modifies a Virtual Data Center. $sdkAdminVdc->modify();
DELETE .../api/v1.0/admin/vdc/<vdc-id> v0.9 Deletes a Virtual Data Center. $sdkAdminVdc->delete();
POST .../api/v1.0/admin/vdc/<vdc-id>/action/enable v1.0 Enables a Virtual Data Center. $sdkAdminVdc->enable();POST .../api/v1.0/admin/vdc/<vdc-id>/action/disable v1.0 Disables a Virtual Data Center. $sdkAdminVdc->disable();
POST .../api/v1.0/admin/org/networks v0.9 Creates a network in an organization.
$sdkAdminOrg->addOrgNetwork();
$sdkAdminOrg->getAdminNetworks(); Or$adminNetworkRefs = $sdkAdminOrg->getAdminNetworkRefs();$sdkAdminNetwork = $service->createSDKObj($adminNetworkRef);$sdkAdminNetwork->getAdminNetwork();
PUT .../api/v1.0/admin/network/<network-id> v0.9 Modifies an org network. $sdkAdminNetwork->modify();DELETE .../api/v1.0/admin/network/ v0.9 Deletes a network. $sdkAdminNetwork->delete();
POST .../api/v1.0/admin/org/catalogs v0.9 Creates a catalog in an org. $sdkAdminOrg->createCatalog();$sdkAdminOrg->getCatalogs(); Or$catalogRefs = $sdkAdminOrg->getcatalogRefs();
$sdkAdminCatalog = $service->createSDKObj($catalogRef);
$sdkAdminCatalog->getCatalog();
Retrieves an admin view of virtual data center.
v0.9GET .../api/v1.0/admin/vdc/<vdc-id>
List of vCloud Admin API Operations
Retrieves an admin view of an organization.
GET .../api/v1.0/admin/org/<org-id> v0.9
Retrieves the top level entity for the Admin API.
v0.9GET .../api/v1.0/admin
Gets admin representation of organization network.
v0.9
Retrieves a catalog.v0.9GET .../api/v1.0/admin/catalog/<catalog-id>
GET .../api/v1.0/admin/network/<network-id>
PUT .../api/v1.0/admin/catalog/<catalog-id> v0.9 Modifies a catalog. $sdkAdminCatalog->modify();
DELETE .../api/v1.0/admin/catalog/<catalog-id> v0.9 Deletes a catalog. $sdkAdminCatalog->delete();POST .../api/v1.0/admin/catalog/<catalog-id>/action/publish v1.0 Publish a catalog. $sdkAdminCatalog->publish();
GET .../api/v1.0/admin/right/<right-id> v0.9 Retrieves a right. $sdkAdmin->getRights();
POST .../api/v1.0/admin/roles v0.9 Creates a role. $sdkAdmin->createRole();
$sdkAdmin->getRoles(); Or
$roleRefs = $sdkAdmin->getRoleRefs();$sdkRole = $service->createSDKObj($roleRef);
$sdkRole->getRole();
PUT .../api/v1.0/admin/role/<role-id> v0.9 Modifies a role. $sdkRole->modify();
DELETE .../api/v1.0/admin/role/<role-id> v0.9 Deletes a role. $sdkRole->delete();
POST .../api/v1.0/admin/org/users v0.9 Creates or imports a user in an
organization.
$sdkAdminOrg->createUser();
$sdkAdminOrg->getUsers(); Or
$userRefs = $sdkAdminOrg->getUserRefs();$sdkUser = $service->createSDKObj($userRef);$sdkUser->getUser();
PUT .../api/v1.0/admin/user/<user-id> v0.9 Modifies a user. $sdkUser->modify();DELETE .../api/v1.0/admin/user/<user-id> v0.9 Deletes a user. $sdkUser->delete();
Enable a user. $sdkUser->enable();Disable a user. $sdkUser->disable();
POST .../api/v1.0/admin/org/groups v0.9 Imports a group in an organization. $sdkAdminOrg->importGroup();
$sdkAdminOrg->getGroups(); Or$groupRefs = $sdkAdminOrg->getGroupRefs();$sdkGroup = $service->createSDKObj($groupRef);$sdkGroup->getGroup();
PUT .../api/v1.0/admin/group/<group-id> v0.9 Modifies a group. $sdkGroup->modify();DELETE .../api/v1.0/admin/group/<groupd-id> v0.9 Deletes a group. $sdkGroup->delete();
GET .../api/v1.0/admin/role/<role-id> Retrieves a role.v0.9
Retrieves a group.v0.9GET .../api/v1.0/admin/group/<group-id>
Retrieves a user.v0.9GET .../api/v1.0/admin/user/<user-id>
Operation Since Description PHP SDK method(s) for the operation
$service->getAdminExtension(); Or
$sdkExt = $service->createSDKExtensionObj();$ext = $sdkExt->getExtension();
GET .../api/v1.0/admin/extension/providerVdcReferences v1.0 Get list of provider vDC
references.
$vmwPvdcRefs = $sdkExt->getVMWProviderVdcRefs();
POST .../api/v1.0/admin/extension/providervdcs v0.9 Creates a provider vDC. $sdkExt->createVMWProviderVdc();
$sdkExt->getVMWProviderVdcs(); Or
$sdkExtVmwPvdc = $service->createSDKObj($vmwPvdcRef);
$sdkExtVmwPvdc->getVMWProviderVdc();
PUT .../api/v1.0/admin/extension/providervdc/<provider-vdc-id> v0.9 Modifies a provider vDC. $sdkExtVmwPvdc->modify();
DELETE .../api/v1.0/admin/extension/providervdc/<provider-vdc-id> v0.9 Deletes a provider vDC. $sdkExtVmwPvdc->delete();
POST .../api/v1.0/admin/extension/providervdc/<provider-vdc-id>/action/enable
v0.9 Enables a provider vDC. $sdkExtVmwPvdc->enable();
POST .../api/v1.0/admin/extension/providervdc/<provider-vdc-
id>/action/disable
v0.9 Disables a provider vDC. $sdkExtVmwPvdc->disable();
GET .../api/v1.0/admin/extension/externalNetworkReferences v1.0 Get list of external network references.
$externalNetworkRefs = $sdkExt->getVMWExternalNetworkRefs();
POST .../api/v1.0/admin/extension/externalnets v1.0 Creates an external network. $sdkExt->createVMWExternalNetwork();
$sdkExt->getVMWExternalNetworks(); Or$sdkExtExternalNetwork = $service->createSDKObj($externalNetworkRef);$sdkExtExternalNetwork->getExternalNetwork();
PUT .../api/v1.0/admin/extension/externalnet/<externalnet-id> v1.0 Modifies an external network. $sdkExtExternalNetwork->modify();
DELETE .../api/v1.0/admin/extension/externalnet/<externalnet-id> v1.0 Deletes an external network. $sdkExtExternalNetwork->delete();
GET .../api/v1.0/admin/extension/networkPoolReferences v1.0 Get list of network pool references.
$networkPoolRefs = $sdkExt->getVMWNetworkPoolRefs();
POST .../api/v1.0/admin/extension/networkPools v0.9 Creates a network pool. $sdkExt->createVMWNetworkPool();
$sdkExt->getVMWNetworkPools(); Or$sdkExtNetworkPool = $service->createSDKObj($networkPoolRef);$sdkExtNetworkPool->getVMWNetworkPool();
PUT .../api/v1.0/admin/extension/networkPool/<network-pool-id> v0.9 Modifies a network pool. $sdkExtNetworkPool->modify();DELETE .../api/v1.0/admin/extension/networkPool/<network-pool-id> v0.9 Deletes a network pool. $sdkExtNetworkPool->delete();
GET .../api/v1.0/admin/extension/vimServerReferences v1.0 Get list of vSphere server references.
$vimServerRefs = $sdkExt->getVimServerRefs();
POST .../api/v1.0/admin/extension/action/registervimserver v0.9 Register a vSphere server and shield manager.
$sdkExt->registerVimServer();
$sdkExt->getVimServers(); Or$sdkExtVimServer = $service->createSDKObj($vimServerRef);$sdkExtVimServer->getVimServer();
PUT .../api/v1.0/admin/extension/vimServer/<vim-server-id> v0.9 Modifies a vSphere server. $sdkExtVimServer->modify();
Gets an extension view of external network.
v1.0GET .../api/v1.0/admin/extension/externalnet/<externalnet-id>
Gets a network pool.GET .../api/v1.0/admin/extension/networkPool/<network-pool-id> v0.9
List of vCloud Admin Extension Operations
Gets a vSphere server.v0.9GET .../api/v1.0/admin/extension/vimServer/<vim-server-id>
GET .../api/v1.0/admin/extension/providervdc/<provider-vdc-id> v0.9 Gets an extension
representation of provider vDC.
GET .../api/v1.0/admin/extension v1.0 Get various links to access
extension API.
POST .../api/v1.0/admin/extension/vimServer/<vim-server-
id>/action/unregister
v0.9 Unregisters a vSphere server. $sdkExt->unregisterVimServer();
POST .../api/v1.0/admin/extension/vimServer/<vim-server-id>/importVmAsVApp
v1.0 Imports a vSphere server VM as vApp.
$sdkExtVimServer->importVmAsVApp();
POST .../api/v1.0/admin/extension/vimServer/<vim-server-id>/importVmAsVAppTemplate
v1.0 Imports a vSphere server VM as vApp template.
$sdkExtVimServer->importVmAsVAppTemplate();
POST .../api/v1.0/admin/extension/vimServer/<vim-server-id>/action/forcevimserverreconnect
v1.0 Forces a vSphere server to
reconnect.
$sdkExtVimServer->forceReconnect();
GET .../api/v1.0/admin/extension/vimServer/<vim-server-id>/vmsList?page=1&pageSize=100
v1.0 Lists available VMs for import from a vSphere server.
$sdkExtVimServer->getVmRefsListByPage();
GET .../api/v1.0/admin/extension/vimServer/<vim-server-id>/resourcePoolList
v1.0 Lists free resource pools in a vSphere server.
$sdkExtVimServer->getResourcePoolRefs();
$sdkExtVimServer->enable();$sdkExtVimServer->disable();
GET .../api/v1.0/admin/extension/hostReferences v1.0 Get list of host references. $hostRefs = $sdkExt->getHostRefs();
$sdkExt->getHosts(); Or$sdkExtHost = $service->createSDKObj($hostRef);$sdkExtHost->getHost();
POST .../api/v1.0/admin/extension/host/<host-id>/action/enable v0.9 Enables a host. $sdkExtHost->enable();POST .../api/v1.0/admin/extension/host/<host-id>/action/disable v0.9 Disables a host. $sdkExtHost->disable();POST .../api/v1.0/admin/extension/host/<host-id>/action/prepare v0.9 Prepares a host. $sdkExtHost->prepare();POST .../api/v1.0/admin/extension/host/<host-id>/action/unprepare v0.9 Unprepares a host. $sdkExtHost->unprepare();
POST .../api/v1.0/admin/extension/host/<host-id>/action/repair v1.0 Repairs a host. $sdkExtHost->repair();POST .../api/v1.0/admin/extension/host/<host-id>/action/upgrade v1.0 Upgrades the host agent. $sdkExtHost->upgrade();
GET .../api/v1.0/admin/extension/licensing/reports v1.0 Lists the licensing reports. No direct method, do through $service->get($url);GET .../api/v1.0/admin/extension/licensing/report/<report-id> v1.0 Gets a licensing report. No direct method, do through $service->get($url);
Gets a host.v1.0GET .../api/v1.0/admin/extension/host/<host-id>