Class: AWSCDK::CloudWatch::CreateAlarmOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_watch/create_alarm_options.rb

Overview

Properties needed to make an alarm from a metric.

Direct Known Subclasses

AlarmProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(evaluation_periods:, threshold:, actions_enabled: nil, alarm_description: nil, alarm_name: nil, comparison_operator: nil, datapoints_to_alarm: nil, evaluate_low_sample_count_percentile: nil, treat_missing_data: nil) ⇒ CreateAlarmOptions

Returns a new instance of CreateAlarmOptions.

Parameters:

  • evaluation_periods (Numeric)

    The number of periods over which data is compared to the specified threshold.

  • threshold (Numeric)

    The value against which the specified statistic is compared.

  • actions_enabled (Boolean, nil) (defaults to: nil)

    Whether the actions for this alarm are enabled.

  • alarm_description (String, nil) (defaults to: nil)

    Description for the alarm.

  • alarm_name (String, nil) (defaults to: nil)

    Name of the alarm.

  • comparison_operator (AWSCDK::CloudWatch::ComparisonOperator, nil) (defaults to: nil)

    Comparison to use to check if metric is breaching.

  • datapoints_to_alarm (Numeric, nil) (defaults to: nil)

    The number of datapoints that must be breaching to trigger the alarm.

  • evaluate_low_sample_count_percentile (String, nil) (defaults to: nil)

    Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.

  • treat_missing_data (AWSCDK::CloudWatch::TreatMissingData, nil) (defaults to: nil)

    Sets how this alarm is to handle missing data points.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'cloud_watch/create_alarm_options.rb', line 16

def initialize(evaluation_periods:, threshold:, actions_enabled: nil, alarm_description: nil, alarm_name: nil, comparison_operator: nil, datapoints_to_alarm: nil, evaluate_low_sample_count_percentile: nil, treat_missing_data: nil)
  @evaluation_periods = evaluation_periods
  Jsii::Type.check_type(@evaluation_periods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "evaluationPeriods")
  @threshold = threshold
  Jsii::Type.check_type(@threshold, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "threshold")
  @actions_enabled = actions_enabled
  Jsii::Type.check_type(@actions_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "actionsEnabled") unless @actions_enabled.nil?
  @alarm_description = alarm_description
  Jsii::Type.check_type(@alarm_description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "alarmDescription") unless @alarm_description.nil?
  @alarm_name = alarm_name
  Jsii::Type.check_type(@alarm_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "alarmName") unless @alarm_name.nil?
  @comparison_operator = comparison_operator
  Jsii::Type.check_type(@comparison_operator, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5Db21wYXJpc29uT3BlcmF0b3IifQ==")), "comparisonOperator") unless @comparison_operator.nil?
  @datapoints_to_alarm = datapoints_to_alarm
  Jsii::Type.check_type(@datapoints_to_alarm, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "datapointsToAlarm") unless @datapoints_to_alarm.nil?
  @evaluate_low_sample_count_percentile = evaluate_low_sample_count_percentile
  Jsii::Type.check_type(@evaluate_low_sample_count_percentile, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "evaluateLowSampleCountPercentile") unless @evaluate_low_sample_count_percentile.nil?
  @treat_missing_data = treat_missing_data
  Jsii::Type.check_type(@treat_missing_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5UcmVhdE1pc3NpbmdEYXRhIn0=")), "treatMissingData") unless @treat_missing_data.nil?
end

Instance Attribute Details

#actions_enabledBoolean? (readonly)

Note:

Default: true

Whether the actions for this alarm are enabled.

Returns:

  • (Boolean, nil)


49
50
51
# File 'cloud_watch/create_alarm_options.rb', line 49

def actions_enabled
  @actions_enabled
end

#alarm_descriptionString? (readonly)

Note:

Default: No description

Description for the alarm.

Returns:

  • (String, nil)


54
55
56
# File 'cloud_watch/create_alarm_options.rb', line 54

def alarm_description
  @alarm_description
end

#alarm_nameString? (readonly)

Note:

Default: Automatically generated name

Name of the alarm.

Returns:

  • (String, nil)


59
60
61
# File 'cloud_watch/create_alarm_options.rb', line 59

def alarm_name
  @alarm_name
end

#comparison_operatorAWSCDK::CloudWatch::ComparisonOperator? (readonly)

Note:

Default: GreaterThanOrEqualToThreshold

Comparison to use to check if metric is breaching.



64
65
66
# File 'cloud_watch/create_alarm_options.rb', line 64

def comparison_operator
  @comparison_operator
end

#datapoints_to_alarmNumeric? (readonly)

Note:

Default: evaluationPeriods

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.



74
75
76
# File 'cloud_watch/create_alarm_options.rb', line 74

def datapoints_to_alarm
  @datapoints_to_alarm
end

#evaluate_low_sample_count_percentileString? (readonly)

Note:

Default: - Not configured.

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:

  • (String, nil)


81
82
83
# File 'cloud_watch/create_alarm_options.rb', line 81

def evaluate_low_sample_count_percentile
  @evaluate_low_sample_count_percentile
end

#evaluation_periodsNumeric (readonly)

The number of periods over which data is compared to the specified threshold.

Returns:

  • (Numeric)


40
41
42
# File 'cloud_watch/create_alarm_options.rb', line 40

def evaluation_periods
  @evaluation_periods
end

#thresholdNumeric (readonly)

The value against which the specified statistic is compared.

Returns:

  • (Numeric)


44
45
46
# File 'cloud_watch/create_alarm_options.rb', line 44

def threshold
  @threshold
end

#treat_missing_dataAWSCDK::CloudWatch::TreatMissingData? (readonly)

Note:

Default: TreatMissingData.Missing

Sets how this alarm is to handle missing data points.



86
87
88
# File 'cloud_watch/create_alarm_options.rb', line 86

def treat_missing_data
  @treat_missing_data
end

Class Method Details

.jsii_propertiesObject



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'cloud_watch/create_alarm_options.rb', line 88

def self.jsii_properties
  {
    :evaluation_periods => "evaluationPeriods",
    :threshold => "threshold",
    :actions_enabled => "actionsEnabled",
    :alarm_description => "alarmDescription",
    :alarm_name => "alarmName",
    :comparison_operator => "comparisonOperator",
    :datapoints_to_alarm => "datapointsToAlarm",
    :evaluate_low_sample_count_percentile => "evaluateLowSampleCountPercentile",
    :treat_missing_data => "treatMissingData",
  }
end

Instance Method Details

#to_jsiiObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'cloud_watch/create_alarm_options.rb', line 102

def to_jsii
  result = {}
  result.merge!({
    "evaluationPeriods" => @evaluation_periods,
    "threshold" => @threshold,
    "actionsEnabled" => @actions_enabled,
    "alarmDescription" => @alarm_description,
    "alarmName" => @alarm_name,
    "comparisonOperator" => @comparison_operator,
    "datapointsToAlarm" => @datapoints_to_alarm,
    "evaluateLowSampleCountPercentile" => @evaluate_low_sample_count_percentile,
    "treatMissingData" => @treat_missing_data,
  })
  result.compact
end