Skip to content

describe_policies async

describe_policies(
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    policy_names: Optional[PolicyNames] = None,
    policy_types: Optional[PolicyTypes] = None,
    next_token: Optional[XmlString] = None,
    max_records: Optional[MaxRecords] = None,
) -> PoliciesType

Gets information about the scaling policies in the account and Region.

Parameters:

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

    The name of the Auto Scaling group.

  • policy_names (Optional[PolicyNames], default: None ) –

    The names of one or more policies. If you omit this property, all policies are described. If a group name is provided, the results are limited to that group. If you specify an unknown policy name, it is ignored with no error.

    Array Members: Maximum number of 50 items.

  • policy_types (Optional[PolicyTypes], default: None ) –

    One or more policy types. The valid values are SimpleScaling, StepScaling, TargetTrackingScaling, and PredictiveScaling.

  • 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 be returned with each call. The default value is 50 and the maximum value is 100.

Raises:

Examples:

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

>>> await client.describe_policies(auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
async def describe_policies(
    self,
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    policy_names: Optional[
        "capo_auto_scaling.types.policy_names.PolicyNames"
    ] = None,
    policy_types: Optional[
        "capo_auto_scaling.types.policy_types.PolicyTypes"
    ] = 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.policies_type.PoliciesType":
    """<p>Gets information about the scaling policies in the account and Region.</p>

    Args:
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        policy_names: <p>The names of one or more policies. If you omit this property, all policies are described. If a group name is provided, the results are limited to that group. If you specify an unknown policy name, it is ignored with no error.</p> <p>Array Members: Maximum number of 50 items.</p>
        policy_types: <p>One or more policy types. The valid values are <code>SimpleScaling</code>, <code>StepScaling</code>, <code>TargetTrackingScaling</code>, and <code>PredictiveScaling</code>.</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 be returned with each call. The default value is <code>50</code> and the maximum value is <code>100</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.service_linked_role_failure.ServiceLinkedRoleFailure: <p>The service-linked role is not yet ready for use.</p>
        capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.

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

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

    async def _handler(
        req: "AsyncOperationRequest[capo_auto_scaling.types.describe_policies_type.DescribePoliciesType]",
    ) -> AsyncOperationResponse[
        "capo_auto_scaling.types.policies_type.PoliciesType"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_policies

        (
            output,
            http_response,
        ) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_policies.async_describe_policies(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribePolicies")
    )
    input_: capo_auto_scaling.types.describe_policies_type.DescribePoliciesType = {}
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if policy_names is not None:
        input_["policy_names"] = policy_names
    if policy_types is not None:
        input_["policy_types"] = policy_types
    if next_token is not None:
        input_["next_token"] = next_token
    if max_records is not None:
        input_["max_records"] = max_records

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output