getDetectors method
Gets all detectors or a single detector if a detectorId
is
specified. This is a paginated API. If you provide a null
maxResults
, this action retrieves a maximum of 10 records per
page. If you provide a maxResults
, the value must be between
5 and 10. To get the next page results, provide the pagination token from
the GetDetectorsResponse
as part of your request. A null
pagination token fetches the records from the beginning.
May throw ValidationException. May throw ResourceNotFoundException. May throw InternalServerException. May throw ThrottlingException. May throw AccessDeniedException.
Parameter detectorId
:
The detector ID.
Parameter maxResults
:
The maximum number of objects to return for the request.
Parameter nextToken
:
The next token for the subsequent request.
Implementation
Future<GetDetectorsResult> getDetectors({
String? detectorId,
int? maxResults,
String? nextToken,
}) async {
_s.validateStringLength(
'detectorId',
detectorId,
1,
64,
);
_s.validateNumRange(
'maxResults',
maxResults,
5,
10,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSHawksNestServiceFacade.GetDetectors'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (detectorId != null) 'detectorId': detectorId,
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
},
);
return GetDetectorsResult.fromJson(jsonResponse.body);
}