describeAnomalyDetectors method

Future<DescribeAnomalyDetectorsOutput> describeAnomalyDetectors({
  1. List<AnomalyDetectorType>? anomalyDetectorTypes,
  2. List<Dimension>? dimensions,
  3. int? maxResults,
  4. String? metricName,
  5. String? namespace,
  6. String? nextToken,
})

Lists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding METRIC_MATH to the AnomalyDetectorTypes array. This will return all metric math anomaly detectors in your account.

May throw InternalServiceFault. May throw InvalidNextToken. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException.

Parameter anomalyDetectorTypes : The anomaly detector types to request when using DescribeAnomalyDetectorsInput. If empty, defaults to SINGLE_METRIC.

Parameter dimensions : Limits the results to only the anomaly detection models that are associated with the specified metric dimensions. If there are multiple metrics that have these dimensions and have anomaly detection models associated, they're all returned.

Parameter maxResults : The maximum number of results to return in one operation. The maximum value that you can specify is 100.

To retrieve the remaining results, make another call with the returned NextToken value.

Parameter metricName : Limits the results to only the anomaly detection models that are associated with the specified metric name. If there are multiple metrics with this name in different namespaces that have anomaly detection models, they're all returned.

Parameter namespace : Limits the results to only the anomaly detection models that are associated with the specified namespace.

Parameter nextToken : Use the token returned by the previous operation to request the next page of results.

Implementation

Future<DescribeAnomalyDetectorsOutput> describeAnomalyDetectors({
  List<AnomalyDetectorType>? anomalyDetectorTypes,
  List<Dimension>? dimensions,
  int? maxResults,
  String? metricName,
  String? namespace,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'GraniteServiceVersion20100801.DescribeAnomalyDetectors'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (anomalyDetectorTypes != null)
        'AnomalyDetectorTypes':
            anomalyDetectorTypes.map((e) => e.value).toList(),
      if (dimensions != null) 'Dimensions': dimensions,
      if (maxResults != null) 'MaxResults': maxResults,
      if (metricName != null) 'MetricName': metricName,
      if (namespace != null) 'Namespace': namespace,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return DescribeAnomalyDetectorsOutput.fromJson(jsonResponse.body);
}