Esempio n. 1
0
 /**
  * DeleteTags action
  *
  * Deletes a specific set of tags from a specific set of resources. This call is designed to follow a
  * DescribeTags call. You first determine what tags a resource has, and then you call DeleteTags with
  * the resource ID and the specific tags you want to delete.
  *
  * @param   ListDataType       $resourceIdList The ID of a resource to tag. For example, ami-1a2b3c4d.
  *                                             You can specify multiple resources to assign the tags to.
  * @param   ResourceTagSetList $tagList        The key/value pair list of the Tags.
  * @return  bool               Returns true on success or throws an exception otherwise
  * @throws  ClientException
  * @throws  Ec2Exception
  */
 public function deleteTags(ListDataType $resourceIdList, ResourceTagSetList $tagList)
 {
     $result = false;
     $options = array_merge($resourceIdList->getQueryArrayBare('ResourceId'), array_filter($tagList->getQueryArrayBare('Tag'), function ($val) {
         return $val !== null;
     }));
     $response = $this->client->call(ucfirst(__FUNCTION__), $options);
     if ($response->getError() === false) {
         //Success
         $sxml = simplexml_load_string($response->getRawContent());
         if ((string) $sxml->return != 'true') {
             throw new Ec2Exception(sprintf('Amazon Ec2 could not delete the Tags. It returned "%s"', $sxml->return));
         }
         $result = true;
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function testIssetMemberOfTheList()
 {
     $list = new ResourceTagSetList();
     $list->append(new ResourceTagSetData('key-0', 'value-0'));
     $this->assertFalse(isset($list[46]));
     $this->assertFalse(isset($list[1]->key));
     $this->assertTrue(isset($list[0]->value));
     $this->assertTrue(isset($list->get(0)->value));
     $this->assertTrue(empty($list->get(3)->value));
     //non-existent variable test
     $this->assertFalse(isset($foo[0]->missing[12]->none_xistent));
 }