createUsageLimit method

Future<UsageLimit> createUsageLimit(
  1. {@required int amount,
  2. @required String clusterIdentifier,
  3. @required UsageLimitFeatureType featureType,
  4. @required UsageLimitLimitType limitType,
  5. UsageLimitBreachAction breachAction,
  6. UsageLimitPeriod period,
  7. List<Tag> tags}
)

Creates a usage limit for a specified Amazon Redshift feature on a cluster. The usage limit is identified by the returned usage limit identifier.

May throw ClusterNotFoundFault. May throw InvalidClusterStateFault. May throw LimitExceededFault. May throw UsageLimitAlreadyExistsFault. May throw InvalidUsageLimitFault. May throw TagLimitExceededFault. May throw UnsupportedOperationFault.

Parameter amount : The limit amount. If time-based, this amount is in minutes. If data-based, this amount is in terabytes (TB). The value must be a positive number.

Parameter clusterIdentifier : The identifier of the cluster that you want to limit usage.

Parameter featureType : The Amazon Redshift feature that you want to limit.

Parameter limitType : The type of limit. Depending on the feature type, this can be based on a time duration or data size. If FeatureType is spectrum, then LimitType must be data-scanned. If FeatureType is concurrency-scaling, then LimitType must be time.

Parameter breachAction : The action that Amazon Redshift takes when the limit is reached. The default is log. For more information about this parameter, see UsageLimit.

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

Parameter tags : A list of tag instances.

Implementation

Future<UsageLimit> createUsageLimit({
  @_s.required int amount,
  @_s.required String clusterIdentifier,
  @_s.required UsageLimitFeatureType featureType,
  @_s.required UsageLimitLimitType limitType,
  UsageLimitBreachAction breachAction,
  UsageLimitPeriod period,
  List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(amount, 'amount');
  ArgumentError.checkNotNull(clusterIdentifier, 'clusterIdentifier');
  _s.validateStringLength(
    'clusterIdentifier',
    clusterIdentifier,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(featureType, 'featureType');
  ArgumentError.checkNotNull(limitType, 'limitType');
  final $request = <String, dynamic>{};
  $request['Amount'] = amount;
  $request['ClusterIdentifier'] = clusterIdentifier;
  $request['FeatureType'] = featureType.toValue();
  $request['LimitType'] = limitType.toValue();
  breachAction?.also((arg) => $request['BreachAction'] = arg.toValue());
  period?.also((arg) => $request['Period'] = arg.toValue());
  tags?.also((arg) => $request['Tags'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CreateUsageLimit',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateUsageLimitMessage'],
    shapes: shapes,
    resultWrapper: 'CreateUsageLimitResult',
  );
  return UsageLimit.fromXml($result);
}