createReservation method

Future<CreateReservationResponse> createReservation({
  1. required int capacity,
  2. required String offeringId,
  3. String? clientToken,
})

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.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw TooManyTagsException. May throw ValidationException.

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

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

Parameter clientToken : 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 .

Implementation

Future<CreateReservationResponse> createReservation({
  required int capacity,
  required String offeringId,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.CreateReservation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'capacity': capacity,
      'offeringId': offeringId,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateReservationResponse.fromJson(jsonResponse.body);
}