putAnomalyDetector method

Future<void> putAnomalyDetector({
  1. required String metricName,
  2. required String namespace,
  3. required String stat,
  4. AnomalyDetectorConfiguration? configuration,
  5. List<Dimension>? dimensions,
})

Creates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed.

For more information, see CloudWatch Anomaly Detection.

May throw LimitExceededException. May throw InternalServiceFault. May throw InvalidParameterValueException. May throw MissingRequiredParameterException.

Parameter metricName : The name of the metric to create the anomaly detection model for.

Parameter namespace : The namespace of the metric to create the anomaly detection model for.

Parameter stat : The statistic to use for the metric and the anomaly detection model.

Parameter configuration : The configuration specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model. You can specify as many as 10 time ranges.

The configuration can also include the time zone to use for the metric.

Parameter dimensions : The metric dimensions to create the anomaly detection model for.

Implementation

Future<void> putAnomalyDetector({
  required String metricName,
  required String namespace,
  required String stat,
  AnomalyDetectorConfiguration? configuration,
  List<Dimension>? dimensions,
}) async {
  ArgumentError.checkNotNull(metricName, 'metricName');
  _s.validateStringLength(
    'metricName',
    metricName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(namespace, 'namespace');
  _s.validateStringLength(
    'namespace',
    namespace,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(stat, 'stat');
  final $request = <String, dynamic>{};
  $request['MetricName'] = metricName;
  $request['Namespace'] = namespace;
  $request['Stat'] = stat;
  configuration?.also((arg) => $request['Configuration'] = arg);
  dimensions?.also((arg) => $request['Dimensions'] = arg);
  await _protocol.send(
    $request,
    action: 'PutAnomalyDetector',
    version: '2010-08-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['PutAnomalyDetectorInput'],
    shapes: shapes,
    resultWrapper: 'PutAnomalyDetectorResult',
  );
}