Skip to content

cancel_db_capacity_reservation async

cancel_db_capacity_reservation(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        DBCapacityReservationIdentifier
    ] = None,
) -> CancelDBCapacityReservationResponse

Cancels a DB capacity reservation. Amazon RDS changes the state of the reservation to cancelled and stops reporting available capacity for it. Amazon RDS then releases the reserved capacity.

A DB instance that uses the reservation keeps running. It continues on unreserved capacity, and Amazon RDS doesn't stop it or modify it. However, Amazon RDS no longer reserves capacity for the DB instance. If Amazon RDS later moves the DB instance to different hardware, for example during hardware maintenance, that move can fail when the Amazon Web Services Region has insufficient capacity for the DB instance class.

You can't cancel a reservation in the active state during a capacity commitment. The response of DescribeDBCapacityReservations reports the end of the commitment in CommitmentInfo.

Constraints:

  • The reservation must be in the active, assessing, or delayed state.

  • The reservation must not be past its end date.

Parameters:

  • db_capacity_reservation_identifier (Optional[DBCapacityReservationIdentifier], default: None ) –

    The identifier or the name of the DB capacity reservation to cancel. You can specify the identifier, which has the prefix dbcr-, or the reservation name.

Raises:

Examples:

To cancel a DB capacity reservation The following example cancels the specified DB capacity reservation. Amazon RDS releases the reserved capacity. A DB instance that uses the reservation keeps running on unreserved capacity.

>>> await client.cancel_db_capacity_reservation(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a')
Source code in docs_src/capo_rds/_services/async_rds.py
async def cancel_db_capacity_reservation(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        "capo_rds.types.db_capacity_reservation_identifier.DBCapacityReservationIdentifier"
    ] = None,
) -> "capo_rds.types.cancel_db_capacity_reservation_response.CancelDBCapacityReservationResponse":
    """<p>Cancels a DB capacity reservation. Amazon RDS changes the state of the reservation to <code>cancelled</code> and stops reporting available capacity for it. Amazon RDS then releases the reserved capacity.</p> <p>A DB instance that uses the reservation keeps running. It continues on unreserved capacity, and Amazon RDS doesn't stop it or modify it. However, Amazon RDS no longer reserves capacity for the DB instance. If Amazon RDS later moves the DB instance to different hardware, for example during hardware maintenance, that move can fail when the Amazon Web Services Region has insufficient capacity for the DB instance class.</p> <p>You can't cancel a reservation in the <code>active</code> state during a capacity commitment. The response of <code>DescribeDBCapacityReservations</code> reports the end of the commitment in <code>CommitmentInfo</code>.</p> <p>Constraints:</p> <ul> <li> <p>The reservation must be in the <code>active</code>, <code>assessing</code>, or <code>delayed</code> state.</p> </li> <li> <p>The reservation must not be past its end date.</p> </li> </ul>

    Args:
        db_capacity_reservation_identifier: <p>The identifier or the name of the DB capacity reservation to cancel. You can specify the identifier, which has the prefix <code>dbcr-</code>, or the reservation name.</p>

    Raises:
        capo_rds.errors.db_capacity_reservation_not_found_fault.DBCapacityReservationNotFoundFault: <p> <code>DBCapacityReservationIdentifier</code> doesn't refer to an existing DB capacity reservation.</p>
        capo_rds.errors.invalid_db_capacity_reservation_state_fault.InvalidDBCapacityReservationStateFault: <p>The DB capacity reservation isn't in a valid state.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To cancel a DB capacity reservation
        The following example cancels the specified DB capacity reservation. Amazon RDS releases the reserved capacity. A DB instance that uses the reservation keeps running on unreserved capacity.

        >>> await client.cancel_db_capacity_reservation(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.cancel_db_capacity_reservation_request.CancelDBCapacityReservationRequest]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.cancel_db_capacity_reservation_response.CancelDBCapacityReservationResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.cancel_db_capacity_reservation

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.cancel_db_capacity_reservation.async_cancel_db_capacity_reservation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelDBCapacityReservation")
    )
    input_: capo_rds.types.cancel_db_capacity_reservation_request.CancelDBCapacityReservationRequest = {}
    if db_capacity_reservation_identifier is not None:
        input_["db_capacity_reservation_identifier"] = (
            db_capacity_reservation_identifier
        )

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