purchaseOffering method
Purchase an offering and create a reservation.
May throw BadGatewayException.
May throw BadRequestException.
May throw ConflictException.
May throw ForbiddenException.
May throw GatewayTimeoutException.
May throw InternalServerErrorException.
May throw NotFoundException.
May throw TooManyRequestsException.
Parameter count :
Number of resources
Parameter offeringId :
Offering to purchase, e.g. '87654321'
Parameter name :
Name for the new reservation
Parameter renewalSettings :
Renewal settings for the reservation
Parameter requestId :
Unique request ID to be specified. This is needed to prevent retries from
creating multiple resources.
Parameter start :
Requested reservation start time (UTC) in ISO-8601 format. The specified
time must be between the first day of the current month and one year from
now. If no value is given, the default is now.
Parameter tags :
A collection of key-value pairs
Implementation
Future<PurchaseOfferingResponse> purchaseOffering({
required int count,
required String offeringId,
String? name,
RenewalSettings? renewalSettings,
String? requestId,
String? start,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'count': count,
if (name != null) 'name': name,
if (renewalSettings != null) 'renewalSettings': renewalSettings,
'requestId': requestId ?? _s.generateIdempotencyToken(),
if (start != null) 'start': start,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/prod/offerings/${Uri.encodeComponent(offeringId)}/purchase',
exceptionFnMap: _exceptionFns,
);
return PurchaseOfferingResponse.fromJson(response);
}