purchaseReservedInstanceOffering method
Allows you to purchase reserved OpenSearch instances.
May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw LimitExceededException. May throw DisabledOperationException. May throw ValidationException. May throw InternalException.
Parameter reservationName
:
A customer-specified identifier to track this reservation.
Parameter reservedInstanceOfferingId
:
The ID of the reserved OpenSearch instance offering to purchase.
Parameter instanceCount
:
The number of OpenSearch instances to reserve.
Implementation
Future<PurchaseReservedInstanceOfferingResponse>
purchaseReservedInstanceOffering({
required String reservationName,
required String reservedInstanceOfferingId,
int? instanceCount,
}) async {
ArgumentError.checkNotNull(reservationName, 'reservationName');
_s.validateStringLength(
'reservationName',
reservationName,
5,
64,
isRequired: true,
);
ArgumentError.checkNotNull(
reservedInstanceOfferingId, 'reservedInstanceOfferingId');
_s.validateStringLength(
'reservedInstanceOfferingId',
reservedInstanceOfferingId,
36,
36,
isRequired: true,
);
_s.validateNumRange(
'instanceCount',
instanceCount,
1,
1152921504606846976,
);
final $payload = <String, dynamic>{
'ReservationName': reservationName,
'ReservedInstanceOfferingId': reservedInstanceOfferingId,
if (instanceCount != null) 'InstanceCount': instanceCount,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2021-01-01/opensearch/purchaseReservedInstanceOffering',
exceptionFnMap: _exceptionFns,
);
return PurchaseReservedInstanceOfferingResponse.fromJson(response);
}