Class CfnAnomalyDetector

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:58.469Z") @Stability(Stable) public class CfnAnomalyDetector extends CfnResource implements IInspectable
The AWS::CloudWatch::AnomalyDetector type specifies an anomaly detection band for a certain metric and statistic.

The band represents the expected "normal" range for the metric values. Anomaly detection bands can be used for visualization of a metric's expected values, and for alarms.

For more information see Using CloudWatch anomaly detection. .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.cloudwatch.*;
 CfnAnomalyDetector cfnAnomalyDetector = CfnAnomalyDetector.Builder.create(this, "MyCfnAnomalyDetector")
         .configuration(ConfigurationProperty.builder()
                 .excludedTimeRanges(List.of(RangeProperty.builder()
                         .endTime("endTime")
                         .startTime("startTime")
                         .build()))
                 .metricTimeZone("metricTimeZone")
                 .build())
         .dimensions(List.of(DimensionProperty.builder()
                 .name("name")
                 .value("value")
                 .build()))
         .metricCharacteristics(MetricCharacteristicsProperty.builder()
                 .periodicSpikes(false)
                 .build())
         .metricMathAnomalyDetector(MetricMathAnomalyDetectorProperty.builder()
                 .metricDataQueries(List.of(MetricDataQueryProperty.builder()
                         .id("id")
                         // the properties below are optional
                         .accountId("accountId")
                         .expression("expression")
                         .label("label")
                         .metricStat(MetricStatProperty.builder()
                                 .metric(MetricProperty.builder()
                                         .metricName("metricName")
                                         .namespace("namespace")
                                         // the properties below are optional
                                         .dimensions(List.of(DimensionProperty.builder()
                                                 .name("name")
                                                 .value("value")
                                                 .build()))
                                         .build())
                                 .period(123)
                                 .stat("stat")
                                 // the properties below are optional
                                 .unit("unit")
                                 .build())
                         .period(123)
                         .returnData(false)
                         .build()))
                 .build())
         .metricName("metricName")
         .namespace("namespace")
         .singleMetricAnomalyDetector(SingleMetricAnomalyDetectorProperty.builder()
                 .accountId("accountId")
                 .dimensions(List.of(DimensionProperty.builder()
                         .name("name")
                         .value("value")
                         .build()))
                 .metricName("metricName")
                 .namespace("namespace")
                 .stat("stat")
                 .build())
         .stat("stat")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnAnomalyDetector

      protected CfnAnomalyDetector(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnAnomalyDetector

      protected CfnAnomalyDetector(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnAnomalyDetector

      @Stability(Stable) public CfnAnomalyDetector(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnAnomalyDetectorProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnAnomalyDetector

      @Stability(Stable) public CfnAnomalyDetector(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getConfiguration

      @Stability(Stable) @Nullable public Object getConfiguration()
      Specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model.
    • setConfiguration

      @Stability(Stable) public void setConfiguration(@Nullable IResolvable value)
      Specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model.
    • setConfiguration

      @Stability(Stable) public void setConfiguration(@Nullable CfnAnomalyDetector.ConfigurationProperty value)
      Specifies details about how the anomaly detection model is to be trained, including time ranges to exclude when training and updating the model.
    • getDimensions

      @Stability(Stable) @Nullable public Object getDimensions()
      The dimensions of the metric associated with the anomaly detection band.
    • setDimensions

      @Stability(Stable) public void setDimensions(@Nullable IResolvable value)
      The dimensions of the metric associated with the anomaly detection band.
    • setDimensions

      @Stability(Stable) public void setDimensions(@Nullable List<Object> value)
      The dimensions of the metric associated with the anomaly detection band.
    • getMetricCharacteristics

      @Stability(Stable) @Nullable public Object getMetricCharacteristics()
      Use this object to include parameters to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models.
    • setMetricCharacteristics

      @Stability(Stable) public void setMetricCharacteristics(@Nullable IResolvable value)
      Use this object to include parameters to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models.
    • setMetricCharacteristics

      @Stability(Stable) public void setMetricCharacteristics(@Nullable CfnAnomalyDetector.MetricCharacteristicsProperty value)
      Use this object to include parameters to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models.
    • getMetricMathAnomalyDetector

      @Stability(Stable) @Nullable public Object getMetricMathAnomalyDetector()
      The CloudWatch metric math expression for this anomaly detector.
    • setMetricMathAnomalyDetector

      @Stability(Stable) public void setMetricMathAnomalyDetector(@Nullable IResolvable value)
      The CloudWatch metric math expression for this anomaly detector.
    • setMetricMathAnomalyDetector

      @Stability(Stable) public void setMetricMathAnomalyDetector(@Nullable CfnAnomalyDetector.MetricMathAnomalyDetectorProperty value)
      The CloudWatch metric math expression for this anomaly detector.
    • getMetricName

      @Stability(Stable) @Nullable public String getMetricName()
      The name of the metric associated with the anomaly detection band.
    • setMetricName

      @Stability(Stable) public void setMetricName(@Nullable String value)
      The name of the metric associated with the anomaly detection band.
    • getNamespace

      @Stability(Stable) @Nullable public String getNamespace()
      The namespace of the metric associated with the anomaly detection band.
    • setNamespace

      @Stability(Stable) public void setNamespace(@Nullable String value)
      The namespace of the metric associated with the anomaly detection band.
    • getSingleMetricAnomalyDetector

      @Stability(Stable) @Nullable public Object getSingleMetricAnomalyDetector()
      The CloudWatch metric and statistic for this anomaly detector.
    • setSingleMetricAnomalyDetector

      @Stability(Stable) public void setSingleMetricAnomalyDetector(@Nullable IResolvable value)
      The CloudWatch metric and statistic for this anomaly detector.
    • setSingleMetricAnomalyDetector

      @Stability(Stable) public void setSingleMetricAnomalyDetector(@Nullable CfnAnomalyDetector.SingleMetricAnomalyDetectorProperty value)
      The CloudWatch metric and statistic for this anomaly detector.
    • getStat

      @Stability(Stable) @Nullable public String getStat()
      The statistic of the metric associated with the anomaly detection band.
    • setStat

      @Stability(Stable) public void setStat(@Nullable String value)
      The statistic of the metric associated with the anomaly detection band.