purchaseReservedElasticsearchInstanceOffering method

Future<PurchaseReservedElasticsearchInstanceOfferingResponse> purchaseReservedElasticsearchInstanceOffering({
  1. required String reservationName,
  2. required String reservedElasticsearchInstanceOfferingId,
  3. int? instanceCount,
})

Allows you to purchase reserved Elasticsearch 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 reservedElasticsearchInstanceOfferingId : The ID of the reserved Elasticsearch instance offering to purchase.

Parameter instanceCount : The number of Elasticsearch instances to reserve.

Implementation

Future<PurchaseReservedElasticsearchInstanceOfferingResponse>
    purchaseReservedElasticsearchInstanceOffering({
  required String reservationName,
  required String reservedElasticsearchInstanceOfferingId,
  int? instanceCount,
}) async {
  ArgumentError.checkNotNull(reservationName, 'reservationName');
  _s.validateStringLength(
    'reservationName',
    reservationName,
    5,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(reservedElasticsearchInstanceOfferingId,
      'reservedElasticsearchInstanceOfferingId');
  _s.validateNumRange(
    'instanceCount',
    instanceCount,
    1,
    1152921504606846976,
  );
  final $payload = <String, dynamic>{
    'ReservationName': reservationName,
    'ReservedElasticsearchInstanceOfferingId':
        reservedElasticsearchInstanceOfferingId,
    if (instanceCount != null) 'InstanceCount': instanceCount,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2015-01-01/es/purchaseReservedInstanceOffering',
    exceptionFnMap: _exceptionFns,
  );
  return PurchaseReservedElasticsearchInstanceOfferingResponse.fromJson(
      response);
}