Skip to content

describe_tags

describe_tags(
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    filters: Optional[Filters] = None,
    include_managed_resources: Optional[IncludeManagedResources] = None,
    next_token: Optional[XmlString] = None,
    max_records: Optional[MaxRecords] = None,
) -> TagsType

Describes the specified tags.

You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.

You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.

For more information, see Tag Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.

Parameters:

  • filters (Optional[Filters], default: None ) –

    One or more filters to scope the tags to return. The maximum number of filters per filter type (for example, auto-scaling-group) is 1000.

  • include_managed_resources (Optional[IncludeManagedResources], default: None ) –

    Specifies whether to include tags for managed Auto Scaling groups in the response. When set to true (default), the response includes tags for managed Auto Scaling groups.

  • next_token (Optional[XmlString], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

  • max_records (Optional[MaxRecords], default: None ) –

    The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

    A response can contain fewer items than the value specified by MaxRecords, even when more items are available. To retrieve the additional items, use the NextToken value in a subsequent call rather than relying on the number of items in the response.

Raises:

  • InvalidNextToken –

    The NextToken value is not valid.

  • ResourceContentionFault –

    You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To describe tags This example describes the tags for the specified Auto Scaling group.

>>> client.describe_tags(filters=[{'Values': ['my-auto-scaling-group'], 'Name': 'auto-scaling-group'}])
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
def describe_tags(
    self,
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    filters: Optional["capo_auto_scaling.types.filters.Filters"] = None,
    include_managed_resources: Optional[
        "capo_auto_scaling.types.include_managed_resources.IncludeManagedResources"
    ] = None,
    next_token: Optional["capo_auto_scaling.types.xml_string.XmlString"] = None,
    max_records: Optional["capo_auto_scaling.types.max_records.MaxRecords"] = None,
) -> "capo_auto_scaling.types.tags_type.TagsType":
    """<p>Describes the specified tags.</p> <p>You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.</p> <p>You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html">Tag Auto Scaling groups and instances</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>

    Args:
        filters: <p>One or more filters to scope the tags to return. The maximum number of filters per filter type (for example, <code>auto-scaling-group</code>) is 1000.</p>
        include_managed_resources: <p> Specifies whether to include tags for managed Auto Scaling groups in the response. When set to <code>true</code> (default), the response includes tags for managed Auto Scaling groups. </p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        max_records: <p>The maximum number of items to return with this call. The default value is <code>50</code> and the maximum value is <code>100</code>.</p> <p>A response can contain fewer items than the value specified by <code>MaxRecords</code>, even when more items are available. To retrieve the additional items, use the <code>NextToken</code> value in a subsequent call rather than relying on the number of items in the response.</p>

    Raises:
        capo_auto_scaling.errors.invalid_next_token.InvalidNextToken: <p>The <code>NextToken</code> value is not valid.</p>
        capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
        capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe tags
        This example describes the tags for the specified Auto Scaling group.

        >>> client.describe_tags(filters=[{'Values': ['my-auto-scaling-group'], 'Name': 'auto-scaling-group'}])
    """

    def _handler(
        req: "OperationRequest[capo_auto_scaling.types.describe_tags_type.DescribeTagsType]",
    ) -> OperationResponse["capo_auto_scaling.types.tags_type.TagsType"]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_tags

        output, http_response = (
            capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_tags.describe_tags(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeTags")
    )
    input_: capo_auto_scaling.types.describe_tags_type.DescribeTagsType = {}
    if filters is not None:
        input_["filters"] = filters
    if include_managed_resources is not None:
        input_["include_managed_resources"] = include_managed_resources
    if next_token is not None:
        input_["next_token"] = next_token
    if max_records is not None:
        input_["max_records"] = max_records

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output