AWS Resource Groups Tagging API 2017-01-26

This page describes the parameters and results for the operations of the
AWS Resource Groups Tagging API (2017-01-26), and shows how to use the Aws\ResourceGroupsTaggingAPI\ResourceGroupsTaggingAPIClient
object to call the described operations. This documentation is specific to the
2017-01-26 API version of the service.

Operation Summary

Each of the following operations can be created from a client using
$client->getCommand('CommandName'), where "CommandName" is the
name of one of the following operations. Note: a command is a value that
encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods
available on a client object: $client->commandName(/* parameters */).
You can send the command asynchronously (returning a promise) by appending the
word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

Paginators

Paginators handle automatically iterating over paginated API results. Paginators
are associated with specific API operations, and they accept the parameters
that the corresponding API operation accepts. You can get a paginator from a
client class using
getPaginator($paginatorName, $operationParameters). This client supports
the following paginators:

Operations

GetResources

Returns all the tagged or previously tagged resources that are located in the specified region for the AWS account. You can optionally specify filters (tags and resource types) in your request, depending on what information you want returned. The response includes all tags that are associated with the requested resources.

You can check the PaginationToken response parameter to determine if a query completed. Queries can occasionally return fewer results on a page than allowed. The PaginationToken response parameter value is nullonly when there are no more results to display.

Parameter Details

Members

PaginationToken

Type: string

A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

ResourceTypeFilters

Type: Array of strings

The constraints on the resources that you want returned. The format of each resource type is service[:resourceType]. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.

The string for each service name and resource type is the same as that embedded in a resource's Amazon Resource Name (ARN). Consult the AWS General Reference for the following:

A list of TagFilters (keys and values). Each TagFilter specified must contain a key with values as optional. A request can include up to 50 keys, and each key can include up to 20 values.

Note the following when deciding how to use TagFilters:

If you do specify a TagFilter, the response returns only those resources that are currently associated with the specified tag.

If you don't specify a TagFilter, the response includes all resources that were ever associated with tags. Resources that currently don't have associated tags are shown with an empty tag set, like this: "Tags": [].

If you specify more than one filter in a single request, the response returns only those resources that satisfy all specified filters.

If you specify a filter that contains more than one value for a key, the response returns resources that match any of the specified values for that key.

If you don't specify any values for a key, the response returns resources that are tagged with that key irrespective of the value.

GetResources( {filter3} ) returns resources tagged with any tag containing key3 as its tag key, irrespective of its value

GetResources( {filter1,filter2,filter3} ) returns resources tagged with ( key1=value1) and ( key2=value2 or key2=value3 or key2=value4) and (key3, irrespective of the value)

TagsPerPage

Type: int

A limit that restricts the number of tags (key and value pairs) returned by GetResources in paginated output. A resource with no tags is counted as having one tag (one key and value pair).

GetResources does not split a resource and its associated tags across pages. If the specified TagsPerPage would cause such a break, a PaginationToken is returned in place of the affected resource and its tags. Use that token in another request to get the remaining data. For example, if you specify a TagsPerPage of 100 and the account has 22 resources with 10 tags each (meaning that each resource has 10 key and value pairs), the output will consist of 3 pages, with the first page displaying the first 10 resources, each with its 10 tags, the second page displaying the next 10 resources each with its 10 tags, and the third page displaying the remaining 2 resources, each with its 10 tags.

You can set TagsPerPage to a minimum of 100 items and the maximum of 500 items.

Result Syntax

Result Details

Members

PaginationToken

Type: string

A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

GetTagKeys

Parameter Syntax

$result = $client->getTagKeys([
'PaginationToken' => '<string>',
]);

Parameter Details

Members

PaginationToken

Type: string

A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

Result Syntax

[
'PaginationToken' => '<string>',
'TagKeys' => ['<string>', ...],
]

Result Details

Members

PaginationToken

Type: string

A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

Parameter Syntax

Parameter Details

Members

Key

Required: Yes

Type: string

The key for which you want to list all existing values in the specified region for the AWS account.

PaginationToken

Type: string

A string that indicates that additional data is available. Leave this value empty for your initial request. If the response includes a PaginationToken, use that string for this value to request an additional page of data.

Result Syntax

Result Details

Members

PaginationToken

Type: string

A string that indicates that the response contains more data than can be returned in a single response. To receive additional data, specify this string for the PaginationToken value in a subsequent request.

TagResources

Applies one or more tags to the specified resources. Note the following:

Not all resources can have tags. For a list of resources that support tagging, see Supported Resources in the AWS Resource Groups User Guide.

Each resource can have up to 50 tags. For other limits, see Tag Restrictions in the Amazon EC2 User Guide for Linux Instances.

You can only tag resources that are located in the specified region for the AWS account.

To add tags to a resource, you need the necessary permissions for the service that the resource belongs to as well as permissions for adding tags. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups User Guide.

Parameter Syntax

Parameter Details

Members

ResourceARNList

Required: Yes

Type: Array of strings

A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. You can specify a minimum of 1 and a maximum of 20 ARNs (resources) to tag. An ARN can be set to a maximum of 1600 characters. For more information, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Tags

Required: Yes

Type: Associative array of custom strings keys (TagKey) to strings

The tags that you want to add to the specified resources. A tag consists of a key and a value that you define.

UntagResources

Removes the specified tags from the specified resources. When you specify a tag key, the action removes both that key and its associated value. The operation succeeds even if you attempt to remove tags from a resource that were already removed. Note the following:

To remove tags from a resource, you need the necessary permissions for the service that the resource belongs to as well as permissions for removing tags. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups User Guide.

You can only tag resources that are located in the specified region for the AWS account.

Parameter Syntax

Parameter Details

Members

ResourceARNList

Required: Yes

Type: Array of strings

A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. You can specify a minimum of 1 and a maximum of 20 ARNs (resources) to untag. An ARN can be set to a maximum of 1600 characters. For more information, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

TagKeys

Required: Yes

Type: Array of strings

A list of the tag keys that you want to remove from the specified resources.

The request processing failed because of an unknown error, exception, or failure. You can retry the request.

Shapes

FailureInfo

Description

Details of the common errors that all actions return.

Members

ErrorCode

Type: string

The code of the common error. Valid values include InternalServiceException, InvalidParameterException, and any valid error code returned by the AWS service that hosts the resource that you want to tag.

ErrorMessage

Type: string

The message of the common error.

StatusCode

Type: int

The HTTP status code of the common error.

InternalServiceException

Description

The request processing failed because of an unknown error, exception, or failure. You can retry the request.

Members

Message

Type: string

InvalidParameterException

Description

A parameter is missing or a malformed string or invalid or out-of-range value was supplied for the request parameter.

Members

Message

Type: string

PaginationTokenExpiredException

Description

A PaginationToken is valid for a maximum of 15 minutes. Your request was denied because the specified PaginationToken has expired.

Members

Message

Type: string

ResourceTagMapping

Description

A list of resource ARNs and the tags (keys and values) that are associated with each.

Members

Tag

Description

The metadata that you apply to AWS resources to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. For more information, see Tag Basics in the Amazon EC2 User Guide for Linux Instances.

Members

Key

Required: Yes

Type: string

One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

Value

Required: Yes

Type: string

The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

TagFilter

Description

A list of tags (keys and values) that are used to specify the associated resources.

Members

Key

Type: string

One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

Values

Type: Array of strings

The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).