Skip to content

delete_anomaly_detector

delete_anomaly_detector(
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    anomaly_detector_id: Optional[AnomalyDetectorId] = None,
    namespace: Optional[Namespace] = None,
    metric_name: Optional[MetricName] = None,
    dimensions: Optional[Dimensions] = None,
    stat: Optional[AnomalyDetectorMetricStat] = None,
    single_metric_anomaly_detector: Optional[SingleMetricAnomalyDetector] = None,
    metric_math_anomaly_detector: Optional[MetricMathAnomalyDetector] = None,
) -> DeleteAnomalyDetectorOutput

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.

Parameters:

  • anomaly_detector_id (Optional[AnomalyDetectorId], default: None ) –

    Specifies the unique identifier of the anomaly detector to delete. If you specify this parameter, you do not need to specify a metric to identify the detector.

  • namespace (Optional[Namespace], default: None ) –

    The namespace associated with the anomaly detection model to delete.

  • metric_name (Optional[MetricName], default: None ) –

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

  • dimensions (Optional[Dimensions], default: None ) –

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

  • stat (Optional[AnomalyDetectorMetricStat], default: None ) –

    The statistic associated with the anomaly detection model to delete.

  • single_metric_anomaly_detector (Optional[SingleMetricAnomalyDetector], default: None ) –

    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.

  • metric_math_anomaly_detector (Optional[MetricMathAnomalyDetector], default: None ) –

    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.

Raises:

Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
def delete_anomaly_detector(
    self,
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    anomaly_detector_id: Optional[
        "capo_cloudwatch.types.anomaly_detector_id.AnomalyDetectorId"
    ] = None,
    namespace: Optional["capo_cloudwatch.types.namespace.Namespace"] = None,
    metric_name: Optional["capo_cloudwatch.types.metric_name.MetricName"] = None,
    dimensions: Optional["capo_cloudwatch.types.dimensions.Dimensions"] = None,
    stat: Optional[
        "capo_cloudwatch.types.anomaly_detector_metric_stat.AnomalyDetectorMetricStat"
    ] = None,
    single_metric_anomaly_detector: Optional[
        "capo_cloudwatch.types.single_metric_anomaly_detector.SingleMetricAnomalyDetector"
    ] = None,
    metric_math_anomaly_detector: Optional[
        "capo_cloudwatch.types.metric_math_anomaly_detector.MetricMathAnomalyDetector"
    ] = None,
) -> "capo_cloudwatch.types.delete_anomaly_detector_output.DeleteAnomalyDetectorOutput":
    """<p> Deletes the specified anomaly detection model from your account. For more information about how to delete an anomaly detection model, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Anomaly_Detection_Alarm.html#Delete_Anomaly_Detection_Model">Deleting an anomaly detection model</a> in the <i>CloudWatch User Guide</i>. </p>

    Args:
        anomaly_detector_id: <p>Specifies the unique identifier of the anomaly detector to delete. If you specify this parameter, you do not need to specify a metric to identify the detector.</p>
        namespace: <p>The namespace associated with the anomaly detection model to delete.</p>
        metric_name: <p>The metric name associated with the anomaly detection model to delete.</p>
        dimensions: <p>The metric dimensions associated with the anomaly detection model to delete.</p>
        stat: <p>The statistic associated with the anomaly detection model to delete.</p>
        single_metric_anomaly_detector: <p>A single metric anomaly detector to be deleted.</p> <p>When using <code>SingleMetricAnomalyDetector</code>, you cannot include the following parameters in the same operation:</p> <ul> <li> <p> <code>Dimensions</code>,</p> </li> <li> <p> <code>MetricName</code> </p> </li> <li> <p> <code>Namespace</code> </p> </li> <li> <p> <code>Stat</code> </p> </li> <li> <p>the <code>MetricMathAnomalyDetector</code> parameters of <code>DeleteAnomalyDetectorInput</code> </p> </li> </ul> <p>Instead, specify the single metric anomaly detector attributes as part of the <code>SingleMetricAnomalyDetector</code> property.</p>
        metric_math_anomaly_detector: <p>The metric math anomaly detector to be deleted.</p> <p>When using <code>MetricMathAnomalyDetector</code>, you cannot include following parameters in the same operation:</p> <ul> <li> <p> <code>Dimensions</code>,</p> </li> <li> <p> <code>MetricName</code> </p> </li> <li> <p> <code>Namespace</code> </p> </li> <li> <p> <code>Stat</code> </p> </li> <li> <p>the <code>SingleMetricAnomalyDetector</code> parameters of <code>DeleteAnomalyDetectorInput</code> </p> </li> </ul> <p>Instead, specify the metric math anomaly detector attributes as part of the <code>MetricMathAnomalyDetector</code> property.</p>

    Raises:
        capo_cloudwatch.errors.internal_service_fault.InternalServiceFault: <p>Request processing has failed due to some unknown error, exception, or failure.</p>
        capo_cloudwatch.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Parameters were used together that cannot be used together.</p>
        capo_cloudwatch.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of an input parameter is bad or out-of-range.</p>
        capo_cloudwatch.errors.missing_required_parameter_exception.MissingRequiredParameterException: <p>An input parameter that is required is missing.</p>
        capo_cloudwatch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The named resource does not exist.</p>
        capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch.types.delete_anomaly_detector_input.DeleteAnomalyDetectorInput]",
    ) -> OperationResponse[
        "capo_cloudwatch.types.delete_anomaly_detector_output.DeleteAnomalyDetectorOutput"
    ]:
        import capo_cloudwatch._operations.granite_service_version20100801.delete_anomaly_detector

        output, http_response = (
            capo_cloudwatch._operations.granite_service_version20100801.delete_anomaly_detector.delete_anomaly_detector(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAnomalyDetector")
    )
    input_: capo_cloudwatch.types.delete_anomaly_detector_input.DeleteAnomalyDetectorInput = {}
    if anomaly_detector_id is not None:
        input_["anomaly_detector_id"] = anomaly_detector_id
    if namespace is not None:
        input_["namespace"] = namespace
    if metric_name is not None:
        input_["metric_name"] = metric_name
    if dimensions is not None:
        input_["dimensions"] = dimensions
    if stat is not None:
        input_["stat"] = stat
    if single_metric_anomaly_detector is not None:
        input_["single_metric_anomaly_detector"] = single_metric_anomaly_detector
    if metric_math_anomaly_detector is not None:
        input_["metric_math_anomaly_detector"] = metric_math_anomaly_detector

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output