updateFilter method

Future<UpdateFilterResponse> updateFilter({
  1. required String detectorId,
  2. required String filterName,
  3. FilterAction? action,
  4. String? description,
  5. FindingCriteria? findingCriteria,
  6. int? rank,
})

Updates the filter specified by the filter name.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter detectorId : The unique ID of the detector that specifies the GuardDuty service where you want to update a filter.

Parameter filterName : The name of the filter.

Parameter action : Specifies the action that is to be applied to the findings that match the filter.

Parameter description : The description of the filter.

Parameter findingCriteria : Represents the criteria to be used in the filter for querying findings.

Parameter rank : Specifies the position of the filter in the list of current filters. Also specifies the order in which this filter is applied to the findings.

Implementation

Future<UpdateFilterResponse> updateFilter({
  required String detectorId,
  required String filterName,
  FilterAction? action,
  String? description,
  FindingCriteria? findingCriteria,
  int? rank,
}) async {
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    300,
    isRequired: true,
  );
  ArgumentError.checkNotNull(filterName, 'filterName');
  _s.validateStringLength(
    'description',
    description,
    0,
    512,
  );
  _s.validateNumRange(
    'rank',
    rank,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    if (action != null) 'action': action.toValue(),
    if (description != null) 'description': description,
    if (findingCriteria != null) 'findingCriteria': findingCriteria,
    if (rank != null) 'rank': rank,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/detector/${Uri.encodeComponent(detectorId)}/filter/${Uri.encodeComponent(filterName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateFilterResponse.fromJson(response);
}