createSpendingLimit method

Future<CreateSpendingLimitResponse> createSpendingLimit({
  1. required String deviceArn,
  2. required String spendingLimit,
  3. String? clientToken,
  4. Map<String, String>? tags,
  5. TimePeriod? timePeriod,
})

Creates a spending limit for a specified quantum device. Spending limits help you control costs by setting maximum amounts that can be spent on quantum computing tasks within a specified time period. Simulators do not support spending limits.

May throw AccessDeniedException. May throw DeviceRetiredException. May throw InternalServiceException. May throw ThrottlingException. May throw ValidationException.

Parameter deviceArn : The Amazon Resource Name (ARN) of the quantum device to apply the spending limit to.

Parameter spendingLimit : The maximum amount that can be spent on the specified device, in USD.

Parameter clientToken : A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, Amazon Braket ignores the request, but does not return an error.

Parameter tags : The tags to apply to the spending limit. Each tag consists of a key and an optional value.

Parameter timePeriod : The time period during which the spending limit is active, including start and end dates.

Implementation

Future<CreateSpendingLimitResponse> createSpendingLimit({
  required String deviceArn,
  required String spendingLimit,
  String? clientToken,
  Map<String, String>? tags,
  TimePeriod? timePeriod,
}) async {
  final $payload = <String, dynamic>{
    'deviceArn': deviceArn,
    'spendingLimit': spendingLimit,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
    if (timePeriod != null) 'timePeriod': timePeriod,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/spending-limit',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSpendingLimitResponse.fromJson(response);
}