listDetectors method

Future<ListDetectorsResponse> listDetectors({
  1. required String detectorModelName,
  2. int? maxResults,
  3. String? nextToken,
  4. String? stateName,
})

Lists detectors (the instances of a detector model).

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalFailureException. May throw ServiceUnavailableException.

Parameter detectorModelName : The name of the detector model whose detectors (instances) are listed.

Parameter maxResults : The maximum number of results to return at one time.

Parameter nextToken : The token for the next set of results.

Parameter stateName : A filter that limits results to those detectors (instances) in the given state.

Implementation

Future<ListDetectorsResponse> listDetectors({
  required String detectorModelName,
  int? maxResults,
  String? nextToken,
  String? stateName,
}) async {
  ArgumentError.checkNotNull(detectorModelName, 'detectorModelName');
  _s.validateStringLength(
    'detectorModelName',
    detectorModelName,
    1,
    128,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  _s.validateStringLength(
    'stateName',
    stateName,
    1,
    128,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (stateName != null) 'stateName': [stateName],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/detectors/${Uri.encodeComponent(detectorModelName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListDetectorsResponse.fromJson(response);
}