Skip to content

create_reservation async

create_reservation(
    capacity: Capacity,
    offering_id: OfferingId,
    *,
    config_overrides: Optional[AsyncRedshiftServerlessClientConfig] = None,
    client_token: Optional[str] = None,
) -> CreateReservationResponse

Creates an Amazon Redshift Serverless reservation, which gives you the option to commit to a specified number of Redshift Processing Units (RPUs) for a year at a discount from Serverless on-demand (OD) rates.

Parameters:

  • capacity (Capacity) –

    The number of Redshift Processing Units (RPUs) to reserve.

  • offering_id (OfferingId) –

    The ID of the offering associated with the reservation. The offering determines the payment schedule for the reservation.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. This token must be a valid UUIDv4 value. For more information about idempotency, see Making retries safe with idempotent APIs .

Raises:

Source code in docs_src/capo_redshift_serverless/_services/async_redshift_serverless.py
async def create_reservation(
    self,
    capacity: "capo_redshift_serverless.types.capacity.Capacity",
    offering_id: "capo_redshift_serverless.types.offering_id.OfferingId",
    *,
    config_overrides: Optional[AsyncRedshiftServerlessClientConfig] = None,
    client_token: Optional[str] = None,
) -> "capo_redshift_serverless.types.create_reservation_response.CreateReservationResponse":
    """<p>Creates an Amazon Redshift Serverless reservation, which gives you the option to commit to a specified number of Redshift Processing Units (RPUs) for a year at a discount from Serverless on-demand (OD) rates.</p>

    Args:
        capacity: <p>The number of Redshift Processing Units (RPUs) to reserve.</p>
        offering_id: <p>The ID of the offering associated with the reservation. The offering determines the payment schedule for the reservation.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. This token must be a valid UUIDv4 value. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/"> Making retries safe with idempotent APIs </a>.</p>

    Raises:
        capo_redshift_serverless.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service limit was exceeded.</p>
        capo_redshift_serverless.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_redshift_serverless.errors.too_many_tags_exception.TooManyTagsException: <p>The request exceeded the number of tags allowed for a resource.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift_serverless.types.create_reservation_request.CreateReservationRequest]",
    ) -> AsyncOperationResponse[
        "capo_redshift_serverless.types.create_reservation_response.CreateReservationResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.create_reservation

        (
            output,
            http_response,
        ) = await capo_redshift_serverless._operations.redshift_serverless.create_reservation.async_create_reservation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateReservation")
    )
    input_: capo_redshift_serverless.types.create_reservation_request.CreateReservationRequest = {
        "capacity": capacity,
        "offering_id": offering_id,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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