PHP code example of purple-dbu / vcloud-sdk-helpers
1. Go to this page and download the library: Download purple-dbu/vcloud-sdk-helpers library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
purple-dbu / vcloud-sdk-helpers example snippets
$service = \VMware_VCloud_SDK_Service::getService();
$service->login(...);
\VCloud\Helpers\Right::create($service)->isCurrentUserOrganizationAdmin();
// => true|false depending on currently logged user rights
$service = \VMware_VCloud_SDK_Service::getService();
$service->login(...);
\VCloud\Helpers\Query::create($service)->queryRecord(
\VMware_VCloud_SDK_Query_Types::ADMIN_VAPP,
'id==c47ddf20-05de-44f5-b79e-c463992ffd3f'
);
// => \VMware_VCloud_API_QueryResultAdminVAppRecordType
// OR null if no vApp exist with such id
...
catch(\VMware_VCloud_SDK_Exception $e) {
\VCloud\Helpers\Exception::create($e)->getMessage($e);
// => (string) The message contained in the error XML
}
...
catch(\VMware_VCloud_SDK_Exception $e) {
\VCloud\Helpers\Exception::create($e)->getMajorErrorCode($e);
// => (int) The major error code contained in the error XML
}
$service = \VMware_VCloud_SDK_Service::getService();
$service->login(...);
\VCloud\Helpers\Metadata::create($service)->getObjects(
\VMware_VCloud_SDK_Query_Types::ADMIN_VAPP_TEMPLATE,
'myMetadata'
);
// => array(
// \VMware_VCloud_SDK_VAppTemplate,
// ...
// )
// The result array contains all the vApp Templates that hold a metadata named
// "myMetadata"
$service = \VMware_VCloud_SDK_Service::getService();
$service->login(...);
\VCloud\Helpers\Metadata::create($service)->getObject(
\VMware_VCloud_SDK_Query_Types::ADMIN_VAPP_TEMPLATE,
'someId',
'23d6deb1-1778-4325-8289-2f150d122675'
);
// => \VMware_VCloud_SDK_VAppTemplate
//
// The result vApp Template is the first vApp Template that holds a metadata
// named "someId" with the value "23d6deb1-1778-4325-8289-2f150d122675"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.