getFindingsStatistics method

Future<GetFindingsStatisticsResponse> getFindingsStatistics({
  1. required String detectorId,
  2. required List<FindingStatisticType> findingStatisticTypes,
  3. FindingCriteria? findingCriteria,
})

Lists Amazon GuardDuty findings statistics for the specified detector ID.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter detectorId : The ID of the detector that specifies the GuardDuty service whose findings' statistics you want to retrieve.

Parameter findingStatisticTypes : The types of finding statistics to retrieve.

Parameter findingCriteria : Represents the criteria that is used for querying findings.

Implementation

Future<GetFindingsStatisticsResponse> getFindingsStatistics({
  required String detectorId,
  required List<FindingStatisticType> findingStatisticTypes,
  FindingCriteria? findingCriteria,
}) async {
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    300,
    isRequired: true,
  );
  ArgumentError.checkNotNull(findingStatisticTypes, 'findingStatisticTypes');
  final $payload = <String, dynamic>{
    'findingStatisticTypes':
        findingStatisticTypes.map((e) => e.toValue()).toList(),
    if (findingCriteria != null) 'findingCriteria': findingCriteria,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/detector/${Uri.encodeComponent(detectorId)}/findings/statistics',
    exceptionFnMap: _exceptionFns,
  );
  return GetFindingsStatisticsResponse.fromJson(response);
}