Since: 26.12.2012
Author: Vitaliy Demidov (vitaliy@scalr.com)
Inheritance: extends Scalr\Service\Aws\AbstractService, implements Scalr\Service\Aws\ServiceInterface
Esempio n. 1
0
 /**
  * Loads RouteTableData from simple xml object
  *
  * @param   \SimpleXMLElement $v
  * @return  RouteTableData Returns RouteTableData
  */
 protected function _loadRouteTableData(\SimpleXMLElement $v)
 {
     $item = null;
     if ($this->exist($v)) {
         $routeTableId = (string) $v->routeTableId;
         $item = $this->ec2->getEntityManagerEnabled() ? $this->ec2->routeTable->get($routeTableId) : null;
         if ($item === null) {
             $item = new RouteTableData($routeTableId);
             $item->setEc2($this->ec2);
             $bAttach = true;
         } else {
             $item->resetObject();
             $item->routeTableId = $routeTableId;
             $bAttach = false;
         }
         $item->vpcId = (string) $v->vpcId;
         $item->setRouteSet($this->_loadRouteList($v->routeSet, $routeTableId));
         $item->setTagSet($this->_loadResourceTagSetList($v->tagSet));
         $item->setAssociationSet($this->_loadListByName('RouteTableAssociation', $v->associationSet));
         $item->setPropagatingVgwSet($this->_loadListByName('PropagatingVgw', $v->propagatingVgwSet));
         if ($bAttach && $this->ec2->getEntityManagerEnabled()) {
             $this->getEntityManager()->attach($item);
         }
     }
     return $item;
 }
Esempio n. 2
0
 /**
  * DeletePlacementGroup action
  *
  * Deletes a placement group from your account.You must terminate all instances in the placement group
  * before deleting it.
  *
  * @param   string       $groupName   The name of the placement group.
  * @return  bool         Returns true on success
  * @throws  ClientException
  * @throws  Ec2Exception
  */
 public function deletePlacementGroup($groupName)
 {
     $result = false;
     $options = array('GroupName' => (string) $groupName);
     $response = $this->client->call(ucfirst(__FUNCTION__), $options);
     if ($response->getError() === false) {
         $sxml = simplexml_load_string($response->getRawContent());
         if ((string) $sxml->return != 'true') {
             throw new Ec2Exception(sprintf('Amazon Ec2 could not delete placement group "%s". It returned "%s"', $options['GroupName'], $sxml->return));
         }
         $result = true;
         $entity = $this->ec2->getEntityManagerEnabled() ? $this->ec2->placementGroup->get($options['GroupName']) : null;
         if ($entity !== null) {
             $this->getEntityManager()->detach($entity);
         }
     }
     return $result;
 }