purchaseOffering method

Future<PurchaseOfferingResponse> purchaseOffering({
  1. required String offeringArn,
  2. required String reservationName,
  3. required String start,
})

Submits a request to purchase an offering. If you already have an active reservation, you can't purchase another offering.

May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException. May throw NotFoundException. May throw ServiceUnavailableException. May throw TooManyRequestsException.

Parameter offeringArn : The Amazon Resource Name (ARN) of the offering.

Parameter reservationName : The name that you want to use for the reservation.

Parameter start : The date and time that you want the reservation to begin, in Coordinated Universal Time (UTC). You can specify any date and time between 12:00am on the first day of the current month to the current time on today's date, inclusive. Specify the start in a 24-hour notation. Use the following format: YYYY-MM-DDTHH:mm:SSZ, where T and Z are literal characters. For example, to specify 11:30pm on March 5, 2020, enter 2020-03-05T23:30:00Z.

Implementation

Future<PurchaseOfferingResponse> purchaseOffering({
  required String offeringArn,
  required String reservationName,
  required String start,
}) async {
  ArgumentError.checkNotNull(offeringArn, 'offeringArn');
  ArgumentError.checkNotNull(reservationName, 'reservationName');
  ArgumentError.checkNotNull(start, 'start');
  final $payload = <String, dynamic>{
    'reservationName': reservationName,
    'start': start,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/offerings/${Uri.encodeComponent(offeringArn)}',
    exceptionFnMap: _exceptionFns,
  );
  return PurchaseOfferingResponse.fromJson(response);
}