Beispiel #1
0
 /**
  * Instantiate a vApp template with default settings.
  *
  * @param string $name          Name of the vApp to be created
  * @param VMware_VCloud_API_ReferenceType $sourceRef   Reference to the
  *                                                     source vApp template
  * @param boolean $deploy       A flag indicates deploy or not after
  *                              instantiation
  * @param boolean $powerOn      A flag indicates power on or not after
  *                              instantiation
  * @param string $description   Description of the vApp to be created
  * @return VMware_VCloud_API_VAppType
  * @since Version 1.0.0
  */
 public function instantiateVAppTemplateDefault($name, $sourceRef, $deploy = false, $powerOn = false, $description = null)
 {
     $instantiateVAppTemplateParams = new VMware_VCloud_API_InstantiateVAppTemplateParamsType();
     $instantiateVAppTemplateParams->set_name($name);
     $sourceRef->set_tagName('Source');
     $instantiateVAppTemplateParams->setSource($sourceRef);
     $instantiateVAppTemplateParams->set_deploy($deploy);
     $instantiateVAppTemplateParams->set_powerOn($powerOn);
     $instantiateVAppTemplateParams->setDescription($description);
     return $this->instantiateVAppTemplate($instantiateVAppTemplateParams);
 }
 /**
  * Unregister Vim Server and vShield manager.
  *
  * @param VMware_VCloud_API_ReferenceType $vimServerRef   Reference to the
  *                                                        vim server to be
  *                                                        unregistered
  * @param boolean $disable Indicates whether disable the vim server first.
  * @return VMware_VCloud_API_TaskType
  * @throws VMware_VCloud_SDK_Exception
  * @since Version 1.0.0
  */
 public function unregisterVimServer($vimServerRef, $disable = true)
 {
     $url = $vimServerRef->get_href() . '/action/unregister';
     if (true === $disable) {
         $sdkVimServer = $this->svc->createSDKObj($vimServerRef);
         try {
             $task = $sdkVimServer->disable();
             if ('VMware_VClous_API_TaskType' == get_class($task)) {
                 $this->svc->wait($task, get_status, array('success'), $iteration = 2, $interval = 10);
             }
         } catch (Exception $e) {
             throw $e;
         }
     }
     return $this->svc->post($url, 202);
 }
 /**
  * Construct a VMware_VCloud_API_ReferenceType data object.
  *
  * @param string $url      URL used as href attribute
  * @param string $tagName  Tag name used as the XML element tag
  * @param string $type     Content-type of the vCloud resource entity
  * @param string $name     Name of the entity, used as name attribute
  * @return VMware_VCloud_API_ReferenceType
  * @since Version 1.0.0
  */
 public static function createReferenceTypeObj($url, $tagName = null, $type = null, $name = null)
 {
     $ref = new VMware_VCloud_API_ReferenceType();
     $ref->set_href($url);
     if ($type) {
         $ref->set_type($type);
     }
     if ($name) {
         $ref->set_name($name);
     }
     if ($tagName) {
         $ref->set_tagName($tagName);
     }
     return $ref;
 }
/**
 * Update the storage Profile of the Disk.
 *
 * @param VMware_VCloud_API_ReferenceType $vdcStorageProfRef
 * @return VMware_VCloud_API_RasdItemsListType $virtualDisks
 * @since SDK Version 5.6.3
 */
function updateStorageProfile($vdcStorageProfRef)
{
    global $virtualDisks, $addedDiskName;
    $items = $virtualDisks->getItem();
    foreach ($items as $item) {
        $hostResource = $item->getHostResource();
        $element = $item->getElementName()->get_valueof();
        if (!empty($hostResource) && $element == $addedDiskName) {
            $anyAttributes = $hostResource[0]->get_anyAttributes();
            if (array_key_exists('storageProfileHref', $anyAttributes)) {
                $anyAttributes['storageProfileHref'] = $vdcStorageProfRef->get_href();
                $hostResource[0]->set_anyAttributes($anyAttributes);
                return $virtualDisks;
            }
        }
    }
    exit("\nNo host resource is found\n");
}