updateAnomaly method

Future<void> updateAnomaly({
  1. required String anomalyDetectorArn,
  2. String? anomalyId,
  3. bool? baseline,
  4. String? patternId,
  5. SuppressionPeriod? suppressionPeriod,
  6. SuppressionType? suppressionType,
})

Use this operation to suppress anomaly detection for a specified anomaly or pattern. If you suppress an anomaly, CloudWatch Logs won't report new occurrences of that anomaly and won't update that anomaly with new data. If you suppress a pattern, CloudWatch Logs won't report any anomalies related to that pattern.

You must specify either anomalyId or patternId, but you can't specify both parameters in the same operation.

If you have previously used this operation to suppress detection of a pattern or anomaly, you can use it again to cause CloudWatch Logs to end the suppression. To do this, use this operation and specify the anomaly or pattern to stop suppressing, and omit the suppressionType and suppressionPeriod parameters.

May throw InvalidParameterException. May throw OperationAbortedException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

Parameter anomalyDetectorArn : The ARN of the anomaly detector that this operation is to act on.

Parameter anomalyId : If you are suppressing or unsuppressing an anomaly, specify its unique ID here. You can find anomaly IDs by using the ListAnomalies operation.

Parameter baseline : Set this to true to prevent CloudWatch Logs from displaying this behavior as an anomaly in the future. The behavior is then treated as baseline behavior. However, if similar but more severe occurrences of this behavior occur in the future, those will still be reported as anomalies.

The default is false

Parameter patternId : If you are suppressing or unsuppressing an pattern, specify its unique ID here. You can find pattern IDs by using the ListAnomalies operation.

Parameter suppressionPeriod : If you are temporarily suppressing an anomaly or pattern, use this structure to specify how long the suppression is to last.

Parameter suppressionType : Use this to specify whether the suppression to be temporary or infinite. If you specify LIMITED, you must also specify a suppressionPeriod. If you specify INFINITE, any value for suppressionPeriod is ignored.

Implementation

Future<void> updateAnomaly({
  required String anomalyDetectorArn,
  String? anomalyId,
  bool? baseline,
  String? patternId,
  SuppressionPeriod? suppressionPeriod,
  SuppressionType? suppressionType,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.UpdateAnomaly'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'anomalyDetectorArn': anomalyDetectorArn,
      if (anomalyId != null) 'anomalyId': anomalyId,
      if (baseline != null) 'baseline': baseline,
      if (patternId != null) 'patternId': patternId,
      if (suppressionPeriod != null) 'suppressionPeriod': suppressionPeriod,
      if (suppressionType != null) 'suppressionType': suppressionType.value,
    },
  );
}