Skip to content

describe_db_capacity_reservations async

describe_db_capacity_reservations(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        DBCapacityReservationIdentifier
    ] = None,
    marker: Optional[String] = None,
    max_records: Optional[MaxRecords] = None,
    filters: Optional[FilterList] = None,
) -> DescribeDBCapacityReservationsResponse

Describes one or more DB capacity reservations. A DB capacity reservation reserves capacity for Amazon RDS DB instances in one or more Availability Zones.

If you don't specify a DBCapacityReservationIdentifier, this operation returns information about all DB capacity reservations for your Amazon Web Services account.

This operation supports pagination.

Parameters:

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

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

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

    An optional pagination token provided by a previous DescribeDBCapacityReservations request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords.

  • max_records (Optional[MaxRecords], default: None ) –

    The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that you can retrieve the remaining results.

    Default: 100

    Constraints:

    • Must be a minimum of 20.

    • Can't exceed 100.

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

    A filter that specifies which DB capacity reservations to describe.

    Supported filters:

    • db-capacity-reservation-name - Accepts DB capacity reservation names. The response includes only the reservations that these names identify. Use this filter to describe several reservations by name in one request.

    • state - Accepts reservation states. The response includes only the reservations in these states.

    • engine - Accepts database engine names. The response includes only the reservations that reserve capacity for these engines.

    • db-instance-class - Accepts DB instance classes. The response includes only the reservations that reserve capacity for these DB instance classes.

    • availability-zone - Accepts Availability Zone names. The response includes only the reservations that cover these Availability Zones.

    When you specify more than one value for a filter, the response includes the reservations that match any of those values. When you specify more than one filter, the response includes only the reservations that match every filter.

    Amazon RDS rejects the request when a filter name isn't in this list, or when a filter specifies no values.

    The state filter doesn't accept expired. To find an expired reservation, compare EndDate against the current date and time.

Raises:

Examples:

To describe a DB capacity reservation The following example retrieves the details of the specified DB capacity reservation. The response reports the reserved capacity and the available capacity for each Availability Zone of the reservation.

>>> await client.describe_db_capacity_reservations(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a')
To list DB capacity reservations one page at a time
The following example lists the active DB capacity reservations for the AWS account, 20 records at a time. The Marker value comes from the response of the previous DescribeDBCapacityReservations request. Omit Marker for the first request. A Marker is an opaque token. Pass it back without any change, and don't parse it or build one yourself. A Marker expires 24 hours after Amazon RDS issues it. The Marker values in this example are shortened for readability.
>>> await client.describe_db_capacity_reservations(filters=[{'Name': 'state', 'Values': ['active']}], max_records=20, marker='eyJ2ZXJzaW9uIjoxLCJ0b2tlbkRldGFpbCI6IkFRSUNBSGhWdjlWNG1RM3JLY0xwWjh0Mlh5RjdiTjB3UmpTNXVF...')
Source code in docs_src/capo_rds/_services/async_rds.py
async def describe_db_capacity_reservations(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_capacity_reservation_identifier: Optional[
        "capo_rds.types.db_capacity_reservation_identifier.DBCapacityReservationIdentifier"
    ] = None,
    marker: Optional["capo_rds.types.string.String"] = None,
    max_records: Optional["capo_rds.types.max_records.MaxRecords"] = None,
    filters: Optional["capo_rds.types.filter_list.FilterList"] = None,
) -> "capo_rds.types.describe_db_capacity_reservations_response.DescribeDBCapacityReservationsResponse":
    """<p>Describes one or more DB capacity reservations. A DB capacity reservation reserves capacity for Amazon RDS DB instances in one or more Availability Zones.</p> <p>If you don't specify a <code>DBCapacityReservationIdentifier</code>, this operation returns information about all DB capacity reservations for your Amazon Web Services account.</p> <p>This operation supports pagination.</p>

    Args:
        db_capacity_reservation_identifier: <p>The identifier or the name of the DB capacity reservation to describe. You can specify the identifier, which has the prefix <code>dbcr-</code>, or the reservation name.</p>
        marker: <p>An optional pagination token provided by a previous <code>DescribeDBCapacityReservations</code> request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <code>MaxRecords</code>.</p>
        max_records: <p>The maximum number of records to include in the response. If more records exist than the specified <code>MaxRecords</code> value, a pagination token called a marker is included in the response so that you can retrieve the remaining results.</p> <p>Default: 100</p> <p>Constraints:</p> <ul> <li> <p>Must be a minimum of 20.</p> </li> <li> <p>Can't exceed 100.</p> </li> </ul>
        filters: <p>A filter that specifies which DB capacity reservations to describe.</p> <p>Supported filters:</p> <ul> <li> <p> <code>db-capacity-reservation-name</code> - Accepts DB capacity reservation names. The response includes only the reservations that these names identify. Use this filter to describe several reservations by name in one request.</p> </li> <li> <p> <code>state</code> - Accepts reservation states. The response includes only the reservations in these states.</p> </li> <li> <p> <code>engine</code> - Accepts database engine names. The response includes only the reservations that reserve capacity for these engines.</p> </li> <li> <p> <code>db-instance-class</code> - Accepts DB instance classes. The response includes only the reservations that reserve capacity for these DB instance classes.</p> </li> <li> <p> <code>availability-zone</code> - Accepts Availability Zone names. The response includes only the reservations that cover these Availability Zones.</p> </li> </ul> <p>When you specify more than one value for a filter, the response includes the reservations that match any of those values. When you specify more than one filter, the response includes only the reservations that match every filter.</p> <p>Amazon RDS rejects the request when a filter name isn't in this list, or when a filter specifies no values.</p> <note> <p>The <code>state</code> filter doesn't accept <code>expired</code>. To find an expired reservation, compare <code>EndDate</code> against the current date and time.</p> </note>

    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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe a DB capacity reservation
        The following example retrieves the details of the specified DB capacity reservation. The response reports the reserved capacity and the available capacity for each Availability Zone of the reservation.

        >>> await client.describe_db_capacity_reservations(db_capacity_reservation_identifier='dbcr-7hqk2m9xv4t1bn6cz3ws8dj5fp0gyr2a')
        To list DB capacity reservations one page at a time
        The following example lists the active DB capacity reservations for the AWS account, 20 records at a time. The Marker value comes from the response of the previous DescribeDBCapacityReservations request. Omit Marker for the first request. A Marker is an opaque token. Pass it back without any change, and don't parse it or build one yourself. A Marker expires 24 hours after Amazon RDS issues it. The Marker values in this example are shortened for readability.

        >>> await client.describe_db_capacity_reservations(filters=[{'Name': 'state', 'Values': ['active']}], max_records=20, marker='eyJ2ZXJzaW9uIjoxLCJ0b2tlbkRldGFpbCI6IkFRSUNBSGhWdjlWNG1RM3JLY0xwWjh0Mlh5RjdiTjB3UmpTNXVF...')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.describe_db_capacity_reservations_request.DescribeDBCapacityReservationsRequest]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.describe_db_capacity_reservations_response.DescribeDBCapacityReservationsResponse"
    ]:
        import capo_rds._operations.amazon_rd_sv19.describe_db_capacity_reservations

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeDBCapacityReservations")
    )
    input_: capo_rds.types.describe_db_capacity_reservations_request.DescribeDBCapacityReservationsRequest = {}
    if db_capacity_reservation_identifier is not None:
        input_["db_capacity_reservation_identifier"] = (
            db_capacity_reservation_identifier
        )
    if marker is not None:
        input_["marker"] = marker
    if max_records is not None:
        input_["max_records"] = max_records
    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