delete_tags ( $resource_id, $opt )

Deletes tags from the specified Amazon EC2 resources.

Access

public

Parameters

Parameter

Type

Required

Description

$resource_id

string
array

Required

A list of one or more resource IDs. This could be the ID of an AMI, an instance, an EBS volume, or snapshot, etc. Pass a string for a single value, or an indexed array for multiple values.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • Tag - array - Optional - The tags to delete from the specified resources. Each tag item consists of a key-value pair. If a tag is specified without a value, the tag and all of its values are deleted.
    • x - array - Optional - This represents a simple array index.
      • Key - string - Optional - The tag’s key.
      • Value - string - Optional - The tag’s value.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Delete a tag.

$ec2 = new AmazonEC2();

$response = $ec2->delete_tags('aki-00006369', array(
	'Tag' => array(
		array('Key' => 'alpha', 'Value' => 'abc'),
		array('Key' => 'alpha', 'Value' => 'def'),
		array('Key' => 'beta', 'Value' => 'ghi'),
	)
));

var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/ec2.class.php | Toggle source view (20 lines) | View on GitHub

public function delete_tags($resource_id, $opt = null)
{
    if (!$opt) $opt = array();
            
    // Required list (non-map)
    $opt = array_merge($opt, CFComplexType::map(array(
        'ResourceId' => (is_array($resource_id) ? $resource_id : array($resource_id))
    )));

    // Optional list + map
    if (isset($opt['Tag']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'Tag' => $opt['Tag']
        )));
        unset($opt['Tag']);
    }

    return $this->authenticate('DeleteTags', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback