Class

VMware_VCloud_SDK_Service

class VMware_VCloud_SDK_Service extends VMware_VCloud_SDK_Service_Abstract

Methods

null setHttpClient(VMware_VCloud_SDK_Http_Client $httpClient)

Set the HTTP client object to use for retrieving the feeds.

from VMware_VCloud_SDK_Service_Abstract
VMware_VCloud_SDK_Http_Client getHttpClient()

Gets the HTTP client object.

from VMware_VCloud_SDK_Service_Abstract
String getToken()

Gets the vcloud token

from VMware_VCloud_SDK_Service_Abstract
setToken(string $vcloudToken)

Sets the vcloud token

from VMware_VCloud_SDK_Service_Abstract
mixed get(string $url, string $type = '', boolean $reObj = true, string $return = null)

Sets HTTP configuration

from VMware_VCloud_SDK_Service_Abstract
mixed post(string $url, int $expect = null, string $type = null, mixed $data = null, string $return = null, string $auth = null)

Send an HTTP POST request.

from VMware_VCloud_SDK_Service_Abstract
mixed put(string $url, int $expect = null, string $type = null, mixed $data = null)

Send an HTTP PUT request.

from VMware_VCloud_SDK_Service_Abstract
VMware_VCloud_API_TaskType|null delete(string $url, int $expect = null)

Send an HTTP DELETE request.

from VMware_VCloud_SDK_Service_Abstract
mixed refetch(mixed $obj)

Refetch the given VMware vCloud data object from vCloud.

from VMware_VCloud_SDK_Service_Abstract
null download(string $url, string $dest, string $type = 'application/octet-stream')

Download a file and dump to specified location.

from VMware_VCloud_SDK_Service_Abstract
null upload(string $url, string $file, string $type = 'application/octet-stream', function $onProgress = false)

Upload a file.

from VMware_VCloud_SDK_Service_Abstract
static VMware_VCloud_SDK_Service getService(VMware_VCloud_SDK_Http_Client_Interface $client = null)

Get a VMwareVCloudSDK_Server object

null setLoginUrl(string $url)

Set login URL.

VMware_VCloud_API_OrgListType login(string $server, array $auth, array $config, string $apiVersion)

Login to VMware vCloud Director.

VMware_VCloud_API_SessionType SSOLogin(string $server, string $samlAssertionXML, string $org, array $config, string $apiVersion = '5.1')

Login to VMware vCloud Director using the SAML Assertion XML from vSphere SSO/SAML IDP's.

VMware_VCloud_API_SessionType HOKSSOLogin(string $server, string $samlAssertionXML, string $org, array $config, string $apiVersion, string $signature, string $signature_alg)

Login to VMware vCloud Director using the SAML Assertion XML from vSphere SSO/SAML IDP's.

SetVcloudToken(string $server, string $vcloudtoken, array $config, string $apiVersion)

Set vcloud token for login.

string getBaseUrl()

Get base URL of the VMware vCloud Director.

string getAdminUrl()

Get admin URL of the VMware vCloud Director.

string getAdminExtensionUrl()

Get administrative extension URL of the VMware vCloud Director.

mixed createSDKObj(mixed $obj)

A wrapper class to create a VMware vCloud SDK object.

VMware_VCloud_SDK_Admin createSDKAdminObj()

Create a VMwareVCloudSDK_Admin object.

VMware_VCloud_SDK_Extension createSDKExtensionObj()

Create a VMwareVCloudSDK_Extension object.

list getUserServiceRefs()

Get a list of user services.

VMware_VCloud_API_SupportedOperatingSystemsInfoType supportedSystemsInfo()

Get Supported OperatingSystems Info.

VMware_VCloud_API_ContainerType getFileDescriptor()

Retrieve a file descriptor.

xml getSchemaFileName($schemaFileName)

Retrieve the specified schema definition file from the server.

array getOrgRefs(string $name = null)

Get references of all organization data objects or an organization data object by its name in VMware vCloud Director.

array getOrgs(string $name = null)

Get all organization data objects or an organization data object by its name in VMware vCloud Director.

VMware_VCloud_API_VCloudType getAdmin()

Get a VMware vCloud Director administrative object.

VMware_VCloud_API_Extension_VMWExtensionType getAdminExtension()

Get an Extension object which contains various links to access extension API.

VMware_VCloud_API_SessionType getSession()

Get current session.

null deleteSession()

Delete current session.

null logout()

Log out to VMware vCloud Director.

VMware_VCloud_SDK_Query getQueryService()

Get a vCloud Director query service entry point.

array|null queryReferencesByName(string $type, string $name, array $filter = null)

Get a reference of the specified entity type by its name attribute.

array|null queryReferencesByType(string $type)

Get a reference of the specified entity type by its type attribute.

array|null queryRecordsByType(string $type)

Get a record of the specified entity type by its type attribute.

mixed wait(mixed $obj, string $method, array $cond, int $iteration = 200, int $interval = 20)

A helper function to wait for a vCloud resource entity (represented by a vCloud data object) to meet a specified condition in a waiting period.

VMware_VCloud_API_TaskType waitForTask(VMware_VCloud_API_TaskType $task, int $iteration = 200, int $interval = 20)

Wait for a task to finish.

Details

final public null setHttpClient(VMware_VCloud_SDK_Http_Client $httpClient)

Set the HTTP client object to use for retrieving the feeds.

If null, use the default client, the VMwareVCloudSDKHttpClient object.

Parameters

VMware_VCloud_SDK_Http_Client $httpClient

Return Value

null

final public VMware_VCloud_SDK_Http_Client getHttpClient()

Gets the HTTP client object.

final public String getToken()

Gets the vcloud token

Return Value

String

final public setToken(string $vcloudToken)

Sets the vcloud token

Parameters

string $vcloudToken

public mixed get(string $url, string $type = '', boolean $reObj = true, string $return = null)

Sets HTTP configuration

Parameters

string $url URL to send an HTTP request
string $type The HTTP request Content-type
boolean $reObj Indicates whether return a vCloud data object (true) or response body (false)
string $return Expected response data type name

Return Value

mixed VMware vCloud data object or response body

Exceptions

VMware_VCloud_SDK_Exception

public mixed post(string $url, int $expect = null, string $type = null, mixed $data = null, string $return = null, string $auth = null)

Send an HTTP POST request.

Parameters

string $url URL to send an HTTP request
int $expect Expected HTTP status code on a successful request
string $type HTTP request Content-Type
mixed $data A vCloud data object which has export() method defined, or an XML data which will be used as an HTTP request body
string $return Expected response data type name
string $auth Authorization token

Return Value

mixed A VMware vCloud data object

Exceptions

VMware_VCloud_SDK_Exception

public mixed put(string $url, int $expect = null, string $type = null, mixed $data = null)

Send an HTTP PUT request.

Parameters

string $url URL to send an HTTP request
int $expect Expected HTTP status code on a successful request
string $type HTTP request Content-Type
mixed $data A VMware vCloud data object, which has export() method defined, or an XML data which will be used as HTTP request body

Return Value

mixed A VMware vCloud data object

Exceptions

VMware_VCloud_SDK_Exception

public VMware_VCloud_API_TaskType|null delete(string $url, int $expect = null)

Send an HTTP DELETE request.

Parameters

string $url URL to send an HTTP request
int $expect Expected HTTP status code on a successful request

Return Value

VMware_VCloud_API_TaskType|null

Exceptions

VMware_VCloud_SDK_Exception

public mixed refetch(mixed $obj)

Refetch the given VMware vCloud data object from vCloud.

Parameters

mixed $obj A VMware vCloud data object to be refeched. The data object should have an href attribute.

Return Value

mixed A VMware vCloud data object

public null download(string $url, string $dest, string $type = 'application/octet-stream')

Download a file and dump to specified location.

Parameters

string $url Source of the file
string $dest Destination of the file to write to
string $type HTTP request Content-Type

Return Value

null

public null upload(string $url, string $file, string $type = 'application/octet-stream', function $onProgress = false)

Upload a file.

Parameters

string $url Target to upload the file
string $file Full path of a file to be uploaded
string $type HTTP request Content-Type
function $onProgress @yconan

Return Value

null

Exceptions

VMware_VCloud_SDK_Exception

at line 35
static public VMware_VCloud_SDK_Service getService(VMware_VCloud_SDK_Http_Client_Interface $client = null)

Get a VMwareVCloudSDK_Server object

Parameters

VMware_VCloud_SDK_Http_Client_Interface $client An object implements VMwareVCloudSDKHttpClientInterface. If it is null, use the default implementation, VMwareVCloudSDKHttp_Client

Return Value

VMware_VCloud_SDK_Service

at line 51
public null setLoginUrl(string $url)

Set login URL.

Parameters

string $url Login URL

Return Value

null

at line 68
public VMware_VCloud_API_OrgListType login(string $server, array $auth, array $config, string $apiVersion)

Login to VMware vCloud Director.

Parameters

string $server Server IP or host name and port
array $auth In array('username'=>, 'password'=>) format
array $config An HTTP configuration array
string $apiVersion An API Version

Return Value

VMware_VCloud_API_OrgListType

at line 101
public VMware_VCloud_API_SessionType SSOLogin(string $server, string $samlAssertionXML, string $org, array $config, string $apiVersion = '5.1')

Login to VMware vCloud Director using the SAML Assertion XML from vSphere SSO/SAML IDP's.

This method can be used in performing: SSO login with Bearer/HOK tokens in both Org/System scope. No signature verification is done when using this method.

Parameters

string $server Server IP or host name and port
string $samlAssertionXML SSO Token.
string $org Organization name.
array $config An HTTP configuration array
string $apiVersion An API Version

Return Value

VMware_VCloud_API_SessionType

at line 150
public VMware_VCloud_API_SessionType HOKSSOLogin(string $server, string $samlAssertionXML, string $org, array $config, string $apiVersion, string $signature, string $signature_alg)

Login to VMware vCloud Director using the SAML Assertion XML from vSphere SSO/SAML IDP's.

This method can be used in performing: SSO login with HOK tokens and the signature attributes in Org/System scope. vCD also does the signature verification of the provided HOK token. Note: For Bearer tokens there is no signature verification done.

Parameters

string $server Server IP or host name and port as https://:
string $samlAssertionXML SSO HOK Token.
string $org The name of your vCloud Director organization.
array $config An HTTP configuration array
string $apiVersion An API Version
string $signature Base64 encoded signaure of the token XML generated using client's protected key
string $signature_alg Standard signature algorithm name

Return Value

VMware_VCloud_API_SessionType

at line 193
public SetVcloudToken(string $server, string $vcloudtoken, array $config, string $apiVersion)

Set vcloud token for login.

Parameters

string $server Server IP or host name and port
string $vcloudtoken Vcloud Token
array $config An HTTP configuration array
string $apiVersion An API Version

at line 215
public string getBaseUrl()

Get base URL of the VMware vCloud Director.

Return Value

string Base URL

at line 226
public string getAdminUrl()

Get admin URL of the VMware vCloud Director.

Return Value

string Admin URL of the VMware vCloud Director.

at line 237
public string getAdminExtensionUrl()

Get administrative extension URL of the VMware vCloud Director.

Return Value

string Administrative extension URL of the VMware vCloud Director.

at line 251
public mixed createSDKObj(mixed $obj)

A wrapper class to create a VMware vCloud SDK object.

Parameters

mixed $obj A data object represents or references a vCloud entity or the URL of a vCloud entity. $ref If a string is given, it should be in the URI format.

Return Value

mixed A VMware vCloud SDK object.

at line 262
public VMware_VCloud_SDK_Admin createSDKAdminObj()

Create a VMwareVCloudSDK_Admin object.

at line 273
public VMware_VCloud_SDK_Extension createSDKExtensionObj()

Create a VMwareVCloudSDK_Extension object.

at line 285
public list getUserServiceRefs()

Get a list of user services.

Return Value

list of all the user services.

at line 297
public VMware_VCloud_API_SupportedOperatingSystemsInfoType supportedSystemsInfo()

Get Supported OperatingSystems Info.

at line 309
public VMware_VCloud_API_ContainerType getFileDescriptor()

Retrieve a file descriptor.

at line 321
public xml getSchemaFileName($schemaFileName)

Retrieve the specified schema definition file from the server.

Parameters

$schemaFileName

Return Value

xml schema represented as String.

at line 337
public array getOrgRefs(string $name = null)

Get references of all organization data objects or an organization data object by its name in VMware vCloud Director.

This function retrieves organization references from server. User can also use the response of the login() function call to get a list of the organization references.

Parameters

string $name Name of the organization. If null, returns all.

Return Value

array VMwareVCloudAPI_ReferenceType object array

at line 352
public array getOrgs(string $name = null)

Get all organization data objects or an organization data object by its name in VMware vCloud Director.

Parameters

string $name Name of the organization. If null, returns all

Return Value

array VMwareVCloudAPI_OrgType object array

at line 373
public VMware_VCloud_API_VCloudType getAdmin()

Get a VMware vCloud Director administrative object.

at line 385
public VMware_VCloud_API_Extension_VMWExtensionType getAdminExtension()

Get an Extension object which contains various links to access extension API.

at line 396
public VMware_VCloud_API_SessionType getSession()

Get current session.

at line 410
public null deleteSession()

Delete current session.

Return Value

null

at line 424
public null logout()

Log out to VMware vCloud Director.

Return Value

null

at line 435
public VMware_VCloud_SDK_Query getQueryService()

Get a vCloud Director query service entry point.

at line 458
public array|null queryReferencesByName(string $type, string $name, array $filter = null)

Get a reference of the specified entity type by its name attribute.

It uses query service of vCloud Director, filters the query results in reference format by the name attribute.

Parameters

string $type Supported query reference type, the entity in this type should have the 'name' attribute.
string $name
array $filter Additional filters in FIQL format. The attribute(s) used for filtering can be attribute(s) of a query record which may not be the attribute(s) of a query reference result. Use this additional filter to make a unique entity reference when needed.

Return Value

array|null VMwareVCloudAPI_ReferenceType object array or null

See also

VMware_VCloud_SDK_Query_Types
VMware_VCloud_SDK_Query_Params setFilter()

at line 484
public array|null queryReferencesByType(string $type)

Get a reference of the specified entity type by its type attribute.

It uses query service of vCloud Director, filters the query results in reference format by the type attribute.

Parameters

string $type Supported query reference type.

Return Value

array|null VMwareVCloudAPI_ReferenceType object array or null

See also

VMware_VCloud_SDK_Query_Types

at line 505
public array|null queryRecordsByType(string $type)

Get a record of the specified entity type by its type attribute.

It uses query service of vCloud Director, filters the query results in record format by the type attribute.

Parameters

string $type Supported query record type.

Return Value

array|null VMwareVCloudAPI_QueryResultRecordsType object array or null

See also

VMware_VCloud_SDK_Query_Types

at line 532
public mixed wait(mixed $obj, string $method, array $cond, int $iteration = 200, int $interval = 20)

A helper function to wait for a vCloud resource entity (represented by a vCloud data object) to meet a specified condition in a waiting period.

Parameters

mixed $obj A VMware vCloud data object, which should have an href property
string $method Method name on the VMware vCloud data object that will be invoked to get a value, and be compared with the specified condition
array $cond Values will be used as boolean equal condition
int $iteration Maximum loops to check the condition
int $interval Wait interval in seconds

Return Value

mixed Refetched object represented by $obj

Exceptions

VMware_VCloud_SDK_Exception

at line 556
public VMware_VCloud_API_TaskType waitForTask(VMware_VCloud_API_TaskType $task, int $iteration = 200, int $interval = 20)

Wait for a task to finish.

Parameters

VMware_VCloud_API_TaskType $task
int $iteration Wait loops
int $interval Wait interval in seconds

Return Value

VMware_VCloud_API_TaskType