Skip to content

describe_traffic_sources

describe_traffic_sources(
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    traffic_source_type: Optional[XmlStringMaxLen255] = None,
    next_token: Optional[XmlString] = None,
    max_records: Optional[MaxRecords] = None,
) -> DescribeTrafficSourcesResponse

Gets information about the traffic sources for the specified Auto Scaling group.

You can optionally provide a traffic source type. If you provide a traffic source type, then the results only include that traffic source type.

If you do not provide a traffic source type, then the results include all the traffic sources for the specified Auto Scaling group.

Parameters:

  • auto_scaling_group_name (Optional[XmlStringMaxLen255], default: None ) –

    The name of the Auto Scaling group.

  • traffic_source_type (Optional[XmlStringMaxLen255], default: None ) –

    The traffic source type that you want to describe.

    The following lists the valid values:

    • elb if the traffic source is a Classic Load Balancer.

    • elbv2 if the traffic source is a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer.

    • vpc-lattice if the traffic source is VPC Lattice.

  • 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 maximum value is 50.

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 the target groups for an Auto Scaling group This example describes the target groups attached to the specified Auto Scaling group.

>>> client.describe_traffic_sources(auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
def describe_traffic_sources(
    self,
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    traffic_source_type: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = 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.describe_traffic_sources_response.DescribeTrafficSourcesResponse":
    """<p>Gets information about the traffic sources for the specified Auto Scaling group.</p> <p>You can optionally provide a traffic source type. If you provide a traffic source type, then the results only include that traffic source type.</p> <p>If you do not provide a traffic source type, then the results include all the traffic sources for the specified Auto Scaling group. </p>

    Args:
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        traffic_source_type: <p>The traffic source type that you want to describe.</p> <p>The following lists the valid values:</p> <ul> <li> <p> <code>elb</code> if the traffic source is a Classic Load Balancer.</p> </li> <li> <p> <code>elbv2</code> if the traffic source is a Application Load Balancer, Gateway Load Balancer, or Network Load Balancer.</p> </li> <li> <p> <code>vpc-lattice</code> if the traffic source is VPC Lattice.</p> </li> </ul>
        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 maximum value is <code>50</code>.</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 the target groups for an Auto Scaling group
        This example describes the target groups attached to the specified Auto Scaling group.

        >>> client.describe_traffic_sources(auto_scaling_group_name='my-auto-scaling-group')
    """

    def _handler(
        req: "OperationRequest[capo_auto_scaling.types.describe_traffic_sources_request.DescribeTrafficSourcesRequest]",
    ) -> OperationResponse[
        "capo_auto_scaling.types.describe_traffic_sources_response.DescribeTrafficSourcesResponse"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_traffic_sources

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeTrafficSources")
    )
    input_: capo_auto_scaling.types.describe_traffic_sources_request.DescribeTrafficSourcesRequest = {}
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if traffic_source_type is not None:
        input_["traffic_source_type"] = traffic_source_type
    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