Skip to content

/AWS1/CL_EC2=>DESCRIBETAGS()

About DescribeTags

Describes the specified tags for your EC2 resources.

For more information about tags, see Tag your Amazon EC2 resources in the Amazon Elastic Compute Cloud User Guide.

We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.

The order of the elements in the response, including those within nested structures, might vary. Applications should not assume the elements appear in a particular order.

Method Signature

IMPORTING

Optional arguments:

iv_dryrun TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

it_filters TYPE /AWS1/CL_EC2FILTER=>TT_FILTERLIST TT_FILTERLIST

The filters.

  • key - The tag key.

  • resource-id - The ID of the resource.

  • resource-type - The resource type. For a list of possible values, see TagSpecification.

  • tag: - The key/value combination of the tag. For example, specify "tag:Owner" for the filter name and "TeamA" for the filter value to find resources with the tag "Owner=TeamA".

  • value - The tag value.

iv_maxresults TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The maximum number of items to return for this request. This value can be between 5 and 1000. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

iv_nexttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2describetagsresult /AWS1/CL_EC2DESCRIBETAGSRESULT

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_ec2~describetags(
  it_filters = VALUE /aws1/cl_ec2filter=>tt_filterlist(
    (
      new /aws1/cl_ec2filter(
        it_values = VALUE /aws1/cl_ec2valuestringlist_w=>tt_valuestringlist(
          ( new /aws1/cl_ec2valuestringlist_w( |string| ) )
        )
        iv_name = |string|
      )
    )
  )
  iv_dryrun = ABAP_TRUE
  iv_maxresults = 123
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

lv_string = lo_result->get_nexttoken( ).
LOOP AT lo_result->get_tags( ) into lo_row.
  lv_string = lo_row_1->get_key( ).
  lv_string = lo_row_1->get_resourceid( ).
  lv_resourcetype = lo_row_1->get_resourcetype( ).
  lv_string = lo_row_1->get_value( ).
ENDLOOP.

To describe the tags for a single resource

This example describes the tags for the specified instance.

DATA(lo_result) = lo_client->/aws1/if_ec2~describetags(
  it_filters = VALUE /aws1/cl_ec2filter=>tt_filterlist(
    (
      new /aws1/cl_ec2filter(
        it_values = VALUE /aws1/cl_ec2valuestringlist_w=>tt_valuestringlist(
          ( new /aws1/cl_ec2valuestringlist_w( |i-1234567890abcdef8| ) )
        )
        iv_name = |resource-id|
      )
    )
  )
).