/** * Get download URL of an iso or floppy media. * * @param array VMware_VCloud_API_FileType object array $files * @return string an iso media URL * @access private * @since API Version 5.5.0 * @since SDK Version 5.5.0 */ private function getDownloadMediaUrl($files) { $refs = VMware_VCloud_SDK_Helper::getContainedLinks(null, 'download:default', $files[0]); if (1 == count($refs)) { return $refs[0]->get_href(); } }
} } if ($flag == true) { if (!isset($certPath)) { echo "\n\nIgnoring the Certificate Validation --Fake certificate - DO NOT DO THIS IN PRODUCTION.\n\n"; } // login $service = VMware_VCloud_SDK_Service::getService(); $service->login($server, array('username' => $user, 'password' => $pswd), $httpConfig, $sdkversion); if (true === $list) { $orgRefs = $service->getOrgRefs($orgName); if (0 == count($orgRefs)) { exit("No organization with {$orgName} is found\n"); } $org = $service->get($orgRefs[0]->get_href()); $links = VMware_VCloud_SDK_Helper::getContainedLinks('vdc', 'down', $org, $method = 'getLink'); if (0 < count($links)) { foreach ($links as $ref) { echo "href=" . $ref->get_href() . " type=" . $ref->get_type() . " name=" . $ref->get_name() . "\n"; } } exit(0); } // create an SDK Admin object $sdkAdmin = $service->createSDKAdminObj(); // get references to administrative organization entities $adminOrgRefs = $sdkAdmin->getAdminOrgRefs($orgName); if (0 == count($adminOrgRefs)) { exit("No organization with {$orgName} is found\n"); } $adminOrgRef = $adminOrgRefs[0];
function getEntityLink($rel, $obj, $method = 'getEntityLink') { $links = VMware_VCloud_SDK_Helper::getContainedLinks(null, $rel, $obj, $method); return 1 == count($links) ? $links[0] : null; }
/** * Get subset links of a VMware vCloud data object, filtered by 'type' * and/or 'rel' attributes. If a link with specified filter (using $ctype or * $rel or both) does not exist, this means the desired opertion is not * allowed on that resource entity. * * @param string $ctype The 'type' attribute of an XML element to filter * @param string $rel The 'rel' attribute of an XML element to filter * @return array|null VMware_VCloud_API_LinkType object array or null * @since Version 1.0.0 */ protected function getContainedLinks($ctype = null, $rel = null) { return VMware_VCloud_SDK_Helper::getContainedLinks($ctype, $rel, $this->getDataObj()); }