Skip to content

cancel_capacity_reservation_fleets

cancel_capacity_reservation_fleets(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    capacity_reservation_fleet_ids: Optional[CapacityReservationFleetIdSet] = None,
) -> CancelCapacityReservationFleetsResult

Cancels one or more Capacity Reservation Fleets. When you cancel a Capacity Reservation Fleet, the following happens:

  • The Capacity Reservation Fleet's status changes to cancelled.

  • The individual Capacity Reservations in the Fleet are cancelled. Instances running in the Capacity Reservations at the time of cancelling the Fleet continue to run in shared capacity.

  • The Fleet stops creating new Capacity Reservations.

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.

  • capacity_reservation_fleet_ids (Optional[CapacityReservationFleetIdSet], default: None ) –

    The IDs of the Capacity Reservation Fleets to cancel.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def cancel_capacity_reservation_fleets(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    capacity_reservation_fleet_ids: Optional[
        "capo_ec2.types.capacity_reservation_fleet_id_set.CapacityReservationFleetIdSet"
    ] = None,
) -> "capo_ec2.types.cancel_capacity_reservation_fleets_result.CancelCapacityReservationFleetsResult":
    """<p>Cancels one or more Capacity Reservation Fleets. When you cancel a Capacity Reservation Fleet, the following happens:</p> <ul> <li> <p>The Capacity Reservation Fleet's status changes to <code>cancelled</code>.</p> </li> <li> <p>The individual Capacity Reservations in the Fleet are cancelled. Instances running in the Capacity Reservations at the time of cancelling the Fleet continue to run in shared capacity.</p> </li> <li> <p>The Fleet stops creating new Capacity Reservations.</p> </li> </ul>

    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>
        capacity_reservation_fleet_ids: <p>The IDs of the Capacity Reservation Fleets to cancel.</p>

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

    def _handler(
        req: "OperationRequest[capo_ec2.types.cancel_capacity_reservation_fleets_request.CancelCapacityReservationFleetsRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.cancel_capacity_reservation_fleets_result.CancelCapacityReservationFleetsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.cancel_capacity_reservation_fleets

        output, http_response = (
            capo_ec2._operations.amazon_ec2.cancel_capacity_reservation_fleets.cancel_capacity_reservation_fleets(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelCapacityReservationFleets")
    )
    input_: capo_ec2.types.cancel_capacity_reservation_fleets_request.CancelCapacityReservationFleetsRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if capacity_reservation_fleet_ids is not None:
        input_["capacity_reservation_fleet_ids"] = capacity_reservation_fleet_ids

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