createArchiveRule method

Future<void> createArchiveRule({
  1. required String analyzerName,
  2. required Map<String, Criterion> filter,
  3. required String ruleName,
  4. String? clientToken,
})

Creates an archive rule for the specified analyzer. Archive rules automatically archive new findings that meet the criteria you define when you create the rule.

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

Parameter analyzerName : The name of the created analyzer.

Parameter filter : The criteria for the rule.

Parameter ruleName : The name of the rule to create.

Parameter clientToken : A client token.

Implementation

Future<void> createArchiveRule({
  required String analyzerName,
  required Map<String, Criterion> filter,
  required String ruleName,
  String? clientToken,
}) async {
  ArgumentError.checkNotNull(analyzerName, 'analyzerName');
  _s.validateStringLength(
    'analyzerName',
    analyzerName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(filter, 'filter');
  ArgumentError.checkNotNull(ruleName, 'ruleName');
  _s.validateStringLength(
    'ruleName',
    ruleName,
    1,
    255,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'filter': filter,
    'ruleName': ruleName,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/analyzer/${Uri.encodeComponent(analyzerName)}/archive-rule',
    exceptionFnMap: _exceptionFns,
  );
}