createFindingsFilter method

Future<CreateFindingsFilterResponse> createFindingsFilter({
  1. required FindingsFilterAction action,
  2. required FindingCriteria findingCriteria,
  3. required String name,
  4. String? clientToken,
  5. String? description,
  6. int? position,
  7. Map<String, String>? tags,
})

Creates and defines the criteria and other settings for a findings filter.

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

Parameter action : The action to perform on findings that match the filter criteria (findingCriteria). Valid values are: ARCHIVE, suppress (automatically archive) the findings; and, NOOP, don't perform any action on the findings.

Parameter findingCriteria : The criteria to use to filter findings.

Parameter name : A custom name for the filter. The name must contain at least 3 characters and can contain as many as 64 characters.

We strongly recommend that you avoid including any sensitive data in the name of a filter. Other users of your account might be able to see this name, depending on the actions that they're allowed to perform in Amazon Macie.

Parameter clientToken : A unique, case-sensitive token that you provide to ensure the idempotency of the request.

Parameter description : A custom description of the filter. The description can contain as many as 512 characters.

We strongly recommend that you avoid including any sensitive data in the description of a filter. Other users of your account might be able to see this description, depending on the actions that they're allowed to perform in Amazon Macie.

Parameter position : The position of the filter in the list of saved filters on the Amazon Macie console. This value also determines the order in which the filter is applied to findings, relative to other filters that are also applied to the findings.

Parameter tags : A map of key-value pairs that specifies the tags to associate with the filter.

A findings filter can have a maximum of 50 tags. Each tag consists of a tag key and an associated tag value. The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.

Implementation

Future<CreateFindingsFilterResponse> createFindingsFilter({
  required FindingsFilterAction action,
  required FindingCriteria findingCriteria,
  required String name,
  String? clientToken,
  String? description,
  int? position,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'action': action.value,
    'findingCriteria': findingCriteria,
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (position != null) 'position': position,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/findingsfilters',
    exceptionFnMap: _exceptionFns,
  );
  return CreateFindingsFilterResponse.fromJson(response);
}