DeleteAnomalyDetectorCommand

Deletes the specified anomaly detection model from your account. For more information about how to delete an anomaly detection model, see Deleting an anomaly detection model  in the CloudWatch User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CloudWatchClient, DeleteAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
// const { CloudWatchClient, DeleteAnomalyDetectorCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient(config);
const input = { // DeleteAnomalyDetectorInput
  Namespace: "STRING_VALUE",
  MetricName: "STRING_VALUE",
  Dimensions: [ // Dimensions
    { // Dimension
      Name: "STRING_VALUE", // required
      Value: "STRING_VALUE", // required
    },
  ],
  Stat: "STRING_VALUE",
  SingleMetricAnomalyDetector: { // SingleMetricAnomalyDetector
    AccountId: "STRING_VALUE",
    Namespace: "STRING_VALUE",
    MetricName: "STRING_VALUE",
    Dimensions: [
      {
        Name: "STRING_VALUE", // required
        Value: "STRING_VALUE", // required
      },
    ],
    Stat: "STRING_VALUE",
  },
  MetricMathAnomalyDetector: { // MetricMathAnomalyDetector
    MetricDataQueries: [ // MetricDataQueries
      { // MetricDataQuery
        Id: "STRING_VALUE", // required
        MetricStat: { // MetricStat
          Metric: { // Metric
            Namespace: "STRING_VALUE",
            MetricName: "STRING_VALUE",
            Dimensions: "<Dimensions>",
          },
          Period: Number("int"), // required
          Stat: "STRING_VALUE", // required
          Unit: "Seconds" || "Microseconds" || "Milliseconds" || "Bytes" || "Kilobytes" || "Megabytes" || "Gigabytes" || "Terabytes" || "Bits" || "Kilobits" || "Megabits" || "Gigabits" || "Terabits" || "Percent" || "Count" || "Bytes/Second" || "Kilobytes/Second" || "Megabytes/Second" || "Gigabytes/Second" || "Terabytes/Second" || "Bits/Second" || "Kilobits/Second" || "Megabits/Second" || "Gigabits/Second" || "Terabits/Second" || "Count/Second" || "None",
        },
        Expression: "STRING_VALUE",
        Label: "STRING_VALUE",
        ReturnData: true || false,
        Period: Number("int"),
        AccountId: "STRING_VALUE",
      },
    ],
  },
};
const command = new DeleteAnomalyDetectorCommand(input);
const response = await client.send(command);
// {};

DeleteAnomalyDetectorCommand Input

Parameter
Type
Description
Dimensions
Dimension[] | undefined

The metric dimensions associated with the anomaly detection model to delete.

MetricMathAnomalyDetector
MetricMathAnomalyDetector | undefined

The metric math anomaly detector to be deleted.

When using MetricMathAnomalyDetector, you cannot include following parameters in the same operation:

  • Dimensions,

  • MetricName

  • Namespace

  • Stat

  • the SingleMetricAnomalyDetector parameters of DeleteAnomalyDetectorInput

Instead, specify the metric math anomaly detector attributes as part of the MetricMathAnomalyDetector property.

MetricName
string | undefined

The metric name associated with the anomaly detection model to delete.

Namespace
string | undefined

The namespace associated with the anomaly detection model to delete.

SingleMetricAnomalyDetector
SingleMetricAnomalyDetector | undefined

A single metric anomaly detector to be deleted.

When using SingleMetricAnomalyDetector, you cannot include the following parameters in the same operation:

  • Dimensions,

  • MetricName

  • Namespace

  • Stat

  • the MetricMathAnomalyDetector parameters of DeleteAnomalyDetectorInput

Instead, specify the single metric anomaly detector attributes as part of the SingleMetricAnomalyDetector property.

Stat
string | undefined

The statistic associated with the anomaly detection model to delete.

DeleteAnomalyDetectorCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
InternalServiceFault
server

Request processing has failed due to some unknown error, exception, or failure.

InvalidParameterCombinationException
client

Parameters were used together that cannot be used together.

InvalidParameterValueException
client

The value of an input parameter is bad or out-of-range.

MissingRequiredParameterException
client

An input parameter that is required is missing.

ResourceNotFoundException
client

The named resource does not exist.

CloudWatchServiceException
Base exception class for all service exceptions from CloudWatch service.