listCoverage method

Future<ListCoverageResponse> listCoverage({
  1. required String detectorId,
  2. CoverageFilterCriteria? filterCriteria,
  3. int? maxResults,
  4. String? nextToken,
  5. CoverageSortCriteria? sortCriteria,
})

Lists coverage details for your GuardDuty account. If you're a GuardDuty administrator, you can retrieve all resources associated with the active member accounts in your organization.

Make sure the accounts have Runtime Monitoring enabled and GuardDuty agent running on their resources.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter detectorId : The unique ID of the detector whose coverage details you want to retrieve.

To find the detectorId in the current Region, see the Settings page in the GuardDuty console, or run the ListDetectors API.

Parameter filterCriteria : Represents the criteria used to filter the coverage details.

Parameter maxResults : The maximum number of results to return in the response.

Parameter nextToken : A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request to a list action. For subsequent calls, use the NextToken value returned from the previous request to continue listing results after the first page.

Parameter sortCriteria : Represents the criteria used to sort the coverage details.

Implementation

Future<ListCoverageResponse> listCoverage({
  required String detectorId,
  CoverageFilterCriteria? filterCriteria,
  int? maxResults,
  String? nextToken,
  CoverageSortCriteria? sortCriteria,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final $payload = <String, dynamic>{
    if (filterCriteria != null) 'filterCriteria': filterCriteria,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
    if (sortCriteria != null) 'sortCriteria': sortCriteria,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/detector/${Uri.encodeComponent(detectorId)}/coverage',
    exceptionFnMap: _exceptionFns,
  );
  return ListCoverageResponse.fromJson(response);
}