Class AlarmProps.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • metric

      @Stability(Stable) public AlarmProps.Builder metric(IMetric metric)
      Sets the value of AlarmProps.getMetric()
      Parameters:
      metric - The metric to add the alarm on. This parameter is required. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
      Returns:
      this
    • evaluationPeriods

      @Stability(Stable) public AlarmProps.Builder evaluationPeriods(Number evaluationPeriods)
      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 AlarmProps.Builder threshold(Number threshold)
      Parameters:
      threshold - The value against which the specified statistic is compared. This parameter is required.
      Returns:
      this
    • actionsEnabled

      @Stability(Stable) public AlarmProps.Builder actionsEnabled(Boolean actionsEnabled)
      Parameters:
      actionsEnabled - Whether the actions for this alarm are enabled.
      Returns:
      this
    • alarmDescription

      @Stability(Stable) public AlarmProps.Builder alarmDescription(String alarmDescription)
      Parameters:
      alarmDescription - Description for the alarm.
      Returns:
      this
    • alarmName

      @Stability(Stable) public AlarmProps.Builder alarmName(String alarmName)
      Parameters:
      alarmName - Name of the alarm.
      Returns:
      this
    • comparisonOperator

      @Stability(Stable) public AlarmProps.Builder comparisonOperator(ComparisonOperator comparisonOperator)
      Parameters:
      comparisonOperator - Comparison to use to check if metric is breaching.
      Returns:
      this
    • datapointsToAlarm

      @Stability(Stable) public AlarmProps.Builder datapointsToAlarm(Number datapointsToAlarm)
      Parameters:
      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.
      Returns:
      this
    • evaluateLowSampleCountPercentile

      @Stability(Stable) public AlarmProps.Builder evaluateLowSampleCountPercentile(String evaluateLowSampleCountPercentile)
      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. Used only for alarms that are based on percentiles.
      Returns:
      this
    • period

      @Stability(Deprecated) @Deprecated public AlarmProps.Builder period(Duration period)
      Deprecated.
      Use `metric.with({ period: ... })` to encode the period into the Metric object
      Parameters:
      period - The period over which the specified statistic is applied. Cannot be used with MathExpression objects.
      Returns:
      this
    • statistic

      @Stability(Deprecated) @Deprecated public AlarmProps.Builder statistic(String statistic)
      Deprecated.
      Use `metric.with({ statistic: ... })` to encode the period into the Metric object
      Parameters:
      statistic - What function to use for aggregating. Can be one of the following:

      • "Minimum" | "min"
      • "Maximum" | "max"
      • "Average" | "avg"
      • "Sum" | "sum"
      • "SampleCount | "n"
      • "pNN.NN"

      Cannot be used with MathExpression objects.

      Returns:
      this
    • treatMissingData

      @Stability(Stable) public AlarmProps.Builder treatMissingData(TreatMissingData treatMissingData)
      Parameters:
      treatMissingData - Sets how this alarm is to handle missing data points.
      Returns:
      this
    • build

      @Stability(Stable) public AlarmProps build()
      Builds the configured instance.
      Specified by:
      build in interface software.amazon.jsii.Builder<AlarmProps>
      Returns:
      a new instance of AlarmProps
      Throws:
      NullPointerException - if any required attribute was not provided