Class Alarm.Builder

java.lang.Object
software.amazon.awscdk.services.cloudwatch.Alarm.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<Alarm>
Enclosing class:
Alarm

@Stability(Stable) public static final class Alarm.Builder extends Object implements software.amazon.jsii.Builder<Alarm>
A fluent builder for Alarm.
  • Method Details

    • create

      @Stability(Stable) public static Alarm.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of Alarm.Builder.
    • evaluationPeriods

      @Stability(Stable) public Alarm.Builder evaluationPeriods(Number evaluationPeriods)
      The number of periods over which data is compared to the specified threshold.

      Parameters:
      evaluationPeriods - The number of periods over which data is compared to the specified threshold. This parameter is required.
      Returns:
      this
    • threshold

      @Stability(Stable) public Alarm.Builder threshold(Number threshold)
      The value against which the specified statistic is compared.

      Parameters:
      threshold - The value against which the specified statistic is compared. This parameter is required.
      Returns:
      this
    • actionsEnabled

      @Stability(Stable) public Alarm.Builder actionsEnabled(Boolean actionsEnabled)
      Whether the actions for this alarm are enabled.

      Default: true

      Parameters:
      actionsEnabled - Whether the actions for this alarm are enabled. This parameter is required.
      Returns:
      this
    • alarmDescription

      @Stability(Stable) public Alarm.Builder alarmDescription(String alarmDescription)
      Description for the alarm.

      Default: No description

      Parameters:
      alarmDescription - Description for the alarm. This parameter is required.
      Returns:
      this
    • alarmName

      @Stability(Stable) public Alarm.Builder alarmName(String alarmName)
      Name of the alarm.

      Default: Automatically generated name

      Parameters:
      alarmName - Name of the alarm. This parameter is required.
      Returns:
      this
    • comparisonOperator

      @Stability(Stable) public Alarm.Builder comparisonOperator(ComparisonOperator comparisonOperator)
      Comparison to use to check if metric is breaching.

      Default: GreaterThanOrEqualToThreshold

      Parameters:
      comparisonOperator - Comparison to use to check if metric is breaching. This parameter is required.
      Returns:
      this
    • datapointsToAlarm

      @Stability(Stable) public Alarm.Builder datapointsToAlarm(Number datapointsToAlarm)
      The number of datapoints that must be breaching to trigger the alarm.

      This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.

      Default: ``evaluationPeriods``

      Parameters:
      datapointsToAlarm - The number of datapoints that must be breaching to trigger the alarm. This parameter is required.
      Returns:
      this
      See Also:
    • evaluateLowSampleCountPercentile

      @Stability(Stable) public Alarm.Builder evaluateLowSampleCountPercentile(String evaluateLowSampleCountPercentile)
      Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.

      Used only for alarms that are based on percentiles.

      Default: - Not configured.

      Parameters:
      evaluateLowSampleCountPercentile - Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. This parameter is required.
      Returns:
      this
    • treatMissingData

      @Stability(Stable) public Alarm.Builder treatMissingData(TreatMissingData treatMissingData)
      Sets how this alarm is to handle missing data points.

      Default: TreatMissingData.Missing

      Parameters:
      treatMissingData - Sets how this alarm is to handle missing data points. This parameter is required.
      Returns:
      this
    • metric

      @Stability(Stable) public Alarm.Builder metric(IMetric metric)
      The metric to add the alarm on.

      Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.

      Parameters:
      metric - The metric to add the alarm on. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public Alarm build()
      Specified by:
      build in interface software.amazon.jsii.Builder<Alarm>
      Returns:
      a newly built instance of Alarm.