createUsageLimit method

Future<CreateUsageLimitResponse> createUsageLimit({
  1. required int amount,
  2. required String resourceArn,
  3. required UsageLimitUsageType usageType,
  4. UsageLimitBreachAction? breachAction,
  5. UsageLimitPeriod? period,
})

Creates a usage limit for a specified Amazon Redshift Serverless usage type. The usage limit is identified by the returned usage limit identifier.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter amount : The limit amount. If time-based, this amount is in Redshift Processing Units (RPU) consumed per hour. If data-based, this amount is in terabytes (TB) of data transferred between Regions in cross-account sharing. The value must be a positive number.

Parameter resourceArn : The Amazon Resource Name (ARN) of the Amazon Redshift Serverless resource to create the usage limit for.

Parameter usageType : The type of Amazon Redshift Serverless usage to create a usage limit for.

Parameter breachAction : The action that Amazon Redshift Serverless takes when the limit is reached. The default is log.

Parameter period : The time period that the amount applies to. A weekly period begins on Sunday. The default is monthly.

Implementation

Future<CreateUsageLimitResponse> createUsageLimit({
  required int amount,
  required String resourceArn,
  required UsageLimitUsageType usageType,
  UsageLimitBreachAction? breachAction,
  UsageLimitPeriod? period,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.CreateUsageLimit'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'amount': amount,
      'resourceArn': resourceArn,
      'usageType': usageType.value,
      if (breachAction != null) 'breachAction': breachAction.value,
      if (period != null) 'period': period.value,
    },
  );

  return CreateUsageLimitResponse.fromJson(jsonResponse.body);
}