Organizations / Client / list_tags_for_resource

list_tags_for_resource#

Organizations.Client.list_tags_for_resource(**kwargs)#

Lists tags that are attached to the specified resource.

You can attach tags to the following resources in Organizations.

  • Amazon Web Services account

  • Organization root

  • Organizational unit (OU)

  • Policy (any type)

This operation can be called only from the organization’s management account or by a member account that is a delegated administrator for an Amazon Web Services service.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    ResourceId='string',
    NextToken='string'
)
Parameters:
  • ResourceId (string) –

    [REQUIRED]

    The ID of the resource with the tags to list.

    You can specify any of the following taggable resources.

    • Amazon Web Services account – specify the account ID number.

    • Organizational unit – specify the OU ID that begins with ou- and looks similar to: ou-1a2b-34uvwxyz

    • Root – specify the root ID that begins with r- and looks similar to: r-1a2b

    • Policy – specify the policy ID that begins with p- andlooks similar to: p-12abcdefg3

  • NextToken (string) – The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value of the previous call’s NextToken response to indicate where the output should continue from.

Return type:

dict

Returns:

Response Syntax

{
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • Tags (list) –

      The tags that are assigned to the resource.

      • (dict) –

        A custom key-value pair associated with a resource within your organization.

        You can attach tags to any of the following organization resources.

        • Amazon Web Services account

        • Organizational unit (OU)

        • Organization root

        • Policy

        • Key (string) –

          The key identifier, or name, of the tag.

        • Value (string) –

          The string value that’s associated with the key of the tag. You can set the value of a tag to an empty string, but you can’t set the value of a tag to null.

    • NextToken (string) –

      If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null.

Exceptions

  • Organizations.Client.exceptions.AccessDeniedException

  • Organizations.Client.exceptions.AWSOrganizationsNotInUseException

  • Organizations.Client.exceptions.TargetNotFoundException

  • Organizations.Client.exceptions.InvalidInputException

  • Organizations.Client.exceptions.ServiceException

  • Organizations.Client.exceptions.TooManyRequestsException