Skip to content

describe_fleets async

describe_fleets(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    max_results: Optional[Integer] = None,
    next_token: Optional[String] = None,
    fleet_ids: Optional[FleetIdSet] = None,
    filters: Optional[FilterList] = None,
) -> DescribeFleetsResult

Describes the specified EC2 Fleet or all of your EC2 Fleets.

If a fleet is of type instant, you must specify the fleet ID in the request, otherwise the fleet does not appear in the response.

For more information, see Describe your EC2 Fleet in the Amazon EC2 User Guide.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    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.

  • max_results (Optional[Integer], default: None ) –

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

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

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

  • fleet_ids (Optional[FleetIdSet], default: None ) –

    The IDs of the EC2 Fleets.

    If a fleet is of type instant, you must specify the fleet ID, otherwise it does not appear in the response.

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

    The filters.

    • activity-status - The progress of the EC2 Fleet ( error | pending-fulfillment | pending-termination | fulfilled).

    • excess-capacity-termination-policy - Indicates whether to terminate running instances if the target capacity is decreased below the current EC2 Fleet size (true | false).

    • fleet-state - The state of the EC2 Fleet (submitted | active | deleted | failed | deleted-running | deleted-terminating | modifying).

    • replace-unhealthy-instances - Indicates whether EC2 Fleet should replace unhealthy instances (true | false).

    • type - The type of request (instant | request | maintain).

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_fleets(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    max_results: Optional["capo_ec2.types.integer.Integer"] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    fleet_ids: Optional["capo_ec2.types.fleet_id_set.FleetIdSet"] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
) -> "capo_ec2.types.describe_fleets_result.DescribeFleetsResult":
    """<p>Describes the specified EC2 Fleet or all of your EC2 Fleets.</p> <important> <p>If a fleet is of type <code>instant</code>, you must specify the fleet ID in the request, otherwise the fleet does not appear in the response.</p> </important> <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-ec2-fleet.html#monitor-ec2-fleet">Describe your EC2 Fleet</a> in the <i>Amazon EC2 User Guide</i>.</p>

    Args:
        dry_run: <p>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 <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        next_token: <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>
        fleet_ids: <p>The IDs of the EC2 Fleets.</p> <note> <p>If a fleet is of type <code>instant</code>, you must specify the fleet ID, otherwise it does not appear in the response.</p> </note>
        filters: <p>The filters.</p> <ul> <li> <p> <code>activity-status</code> - The progress of the EC2 Fleet ( <code>error</code> | <code>pending-fulfillment</code> | <code>pending-termination</code> | <code>fulfilled</code>).</p> </li> <li> <p> <code>excess-capacity-termination-policy</code> - Indicates whether to terminate running instances if the target capacity is decreased below the current EC2 Fleet size (<code>true</code> | <code>false</code>).</p> </li> <li> <p> <code>fleet-state</code> - The state of the EC2 Fleet (<code>submitted</code> | <code>active</code> | <code>deleted</code> | <code>failed</code> | <code>deleted-running</code> | <code>deleted-terminating</code> | <code>modifying</code>).</p> </li> <li> <p> <code>replace-unhealthy-instances</code> - Indicates whether EC2 Fleet should replace unhealthy instances (<code>true</code> | <code>false</code>).</p> </li> <li> <p> <code>type</code> - The type of request (<code>instant</code> | <code>request</code> | <code>maintain</code>).</p> </li> </ul>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_fleets_request.DescribeFleetsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_fleets_result.DescribeFleetsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_fleets

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.describe_fleets.async_describe_fleets(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeFleets")
    )
    input_: capo_ec2.types.describe_fleets_request.DescribeFleetsRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if fleet_ids is not None:
        input_["fleet_ids"] = fleet_ids
    if filters is not None:
        input_["filters"] = filters

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