/** * Get contained VMs in the vApp template. * * @param $name * @return array|null VMware_VCloud_API_VmType objects array or null * @since Version 1.5.0 */ public function getContainedVms($name = null) { $temp = $this->getVAppTemplate(); $c = $temp->getChildren(); return isset($c) ? VMware_VCloud_SDK_Helper::getObjsByName($c->getVm(), $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. * * @param string $name Name of the organization. If null, returns all. * @return array VMware_VCloud_API_ReferenceType object array * @since Version 1.0.0 */ public function getOrgRefs($name = null) { $url = $this->baseUrl . '/org/'; $refs = $this->get($url)->getOrg(); return VMware_VCloud_SDK_Helper::getObjsByName($refs, $name); }
/** * Retrieves all organization vDCs for the given provider vDC. * * @return array|null An array of VMware_VCloud_API_ReferenceType or null. * @since Version 1.5.0 */ public function getVdcRefs($name = null) { $url = $this->url . '/vdcReferences'; $refs = $this->svc->get($url); return VMware_VCloud_SDK_Helper::getObjsByName($refs->getVdcReference(), $name); }
/** * Get all references or subset of references of a VMware vCloud data object, * filtered by 'type' and/or 'name' attribute. * * @param string $ctype The value of the 'type' attribute to filter * @param string $name The value of the 'name' attribute to filter * @param string $method Name of the class method to get the references or * links of the data object * @param mixed $obj A VMware vCloud container data object which has * reference or link element * @return array|null VMware_VCloud_API_ReferenceType or * VMware_VCloud_API_LinkType object array or null * @since Version 1.0.0 */ protected function getContainedRefs($ctype = null, $name = null, $method = 'getLink', $obj = null) { if (!$obj) { $obj = $this->getDataObj(); } if (!method_exists($obj, $method)) { return null; } $refs = $obj->{$method}(); if (!$refs) { return null; } if (!isset($ctype)) { return VMware_VCloud_SDK_Helper::getObjsByName($refs, $name); } $out = array(); foreach ($refs as $ref) { if (0 < strpos($ref->get_type(), $ctype . '+xml')) { array_push($out, $ref); } } return VMware_VCloud_SDK_Helper::getObjsByName($out, $name); }