Class: AWSCDK::Lightsail::CfnAlarmProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lightsail/cfn_alarm_props.rb

Overview

Properties for defining a CfnAlarm.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alarm_name:, comparison_operator:, evaluation_periods:, metric_name:, monitored_resource_name:, threshold:, contact_protocols: nil, datapoints_to_alarm: nil, notification_enabled: nil, notification_triggers: nil, treat_missing_data: nil) ⇒ CfnAlarmProps

Returns a new instance of CfnAlarmProps.

Parameters:

  • alarm_name (String)

    The name of the alarm.

  • comparison_operator (String)

    The arithmetic operation to use when comparing the specified statistic and threshold.

  • evaluation_periods (Numeric)

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

  • metric_name (String)

    The name of the metric associated with the alarm.

  • monitored_resource_name (String)

    The name of the Lightsail resource that the alarm monitors.

  • threshold (Numeric)

    The value against which the specified statistic is compared.

  • contact_protocols (Array<String>, nil) (defaults to: nil)

    The contact protocols for the alarm, such as Email , SMS (text messaging), or both.

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

    The number of data points within the evaluation periods that must be breaching to cause the alarm to go to the ALARM state.

  • notification_enabled (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    A Boolean value indicating whether the alarm is enabled.

  • notification_triggers (Array<String>, nil) (defaults to: nil)

    The alarm states that trigger a notification.

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

    Specifies how the alarm handles missing data points.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lightsail/cfn_alarm_props.rb', line 20

def initialize(alarm_name:, comparison_operator:, evaluation_periods:, metric_name:, monitored_resource_name:, threshold:, contact_protocols: nil, datapoints_to_alarm: nil, notification_enabled: nil, notification_triggers: nil, treat_missing_data: nil)
  @alarm_name = alarm_name
  Jsii::Type.check_type(@alarm_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "alarmName")
  @comparison_operator = comparison_operator
  Jsii::Type.check_type(@comparison_operator, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comparisonOperator")
  @evaluation_periods = evaluation_periods
  Jsii::Type.check_type(@evaluation_periods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "evaluationPeriods")
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @monitored_resource_name = monitored_resource_name
  Jsii::Type.check_type(@monitored_resource_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "monitoredResourceName")
  @threshold = threshold
  Jsii::Type.check_type(@threshold, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "threshold")
  @contact_protocols = contact_protocols
  Jsii::Type.check_type(@contact_protocols, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "contactProtocols") unless @contact_protocols.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?
  @notification_enabled = notification_enabled
  Jsii::Type.check_type(@notification_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "notificationEnabled") unless @notification_enabled.nil?
  @notification_triggers = notification_triggers
  Jsii::Type.check_type(@notification_triggers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notificationTriggers") unless @notification_triggers.nil?
  @treat_missing_data = treat_missing_data
  Jsii::Type.check_type(@treat_missing_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "treatMissingData") unless @treat_missing_data.nil?
end

Instance Attribute Details

#alarm_nameString (readonly)

The name of the alarm.



49
50
51
# File 'lightsail/cfn_alarm_props.rb', line 49

def alarm_name
  @alarm_name
end

#comparison_operatorString (readonly)

The arithmetic operation to use when comparing the specified statistic and threshold.



54
55
56
# File 'lightsail/cfn_alarm_props.rb', line 54

def comparison_operator
  @comparison_operator
end

#contact_protocolsArray<String>? (readonly)

The contact protocols for the alarm, such as Email , SMS (text messaging), or both.

Allowed Values : Email | SMS



81
82
83
# File 'lightsail/cfn_alarm_props.rb', line 81

def contact_protocols
  @contact_protocols
end

#datapoints_to_alarmNumeric? (readonly)

The number of data points within the evaluation periods that must be breaching to cause the alarm to go to the ALARM state.



86
87
88
# File 'lightsail/cfn_alarm_props.rb', line 86

def datapoints_to_alarm
  @datapoints_to_alarm
end

#evaluation_periodsNumeric (readonly)

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



59
60
61
# File 'lightsail/cfn_alarm_props.rb', line 59

def evaluation_periods
  @evaluation_periods
end

#metric_nameString (readonly)

The name of the metric associated with the alarm.



64
65
66
# File 'lightsail/cfn_alarm_props.rb', line 64

def metric_name
  @metric_name
end

#monitored_resource_nameString (readonly)

The name of the Lightsail resource that the alarm monitors.



69
70
71
# File 'lightsail/cfn_alarm_props.rb', line 69

def monitored_resource_name
  @monitored_resource_name
end

#notification_enabledBoolean, ... (readonly)

A Boolean value indicating whether the alarm is enabled.



91
92
93
# File 'lightsail/cfn_alarm_props.rb', line 91

def notification_enabled
  @notification_enabled
end

#notification_triggersArray<String>? (readonly)

The alarm states that trigger a notification.

To specify the OK and INSUFFICIENT_DATA values, you must also specify ContactProtocols values. Otherwise, the OK and INSUFFICIENT_DATA values will not take effect and the stack will drift.

Allowed Values : OK | ALARM | INSUFFICIENT_DATA



100
101
102
# File 'lightsail/cfn_alarm_props.rb', line 100

def notification_triggers
  @notification_triggers
end

#thresholdNumeric (readonly)

The value against which the specified statistic is compared.



74
75
76
# File 'lightsail/cfn_alarm_props.rb', line 74

def threshold
  @threshold
end

#treat_missing_dataString? (readonly)

Specifies how the alarm handles missing data points.

An alarm can treat missing data in the following ways:

  • breaching - Assumes the missing data is not within the threshold. Missing data counts towards the number of times that the metric is not within the threshold.
  • not_breaching - Assumes the missing data is within the threshold. Missing data does not count towards the number of times that the metric is not within the threshold.
  • ignore - Ignores the missing data. Maintains the current alarm state.
  • missing - Missing data is treated as missing.


112
113
114
# File 'lightsail/cfn_alarm_props.rb', line 112

def treat_missing_data
  @treat_missing_data
end

Class Method Details

.jsii_propertiesObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lightsail/cfn_alarm_props.rb', line 114

def self.jsii_properties
  {
    :alarm_name => "alarmName",
    :comparison_operator => "comparisonOperator",
    :evaluation_periods => "evaluationPeriods",
    :metric_name => "metricName",
    :monitored_resource_name => "monitoredResourceName",
    :threshold => "threshold",
    :contact_protocols => "contactProtocols",
    :datapoints_to_alarm => "datapointsToAlarm",
    :notification_enabled => "notificationEnabled",
    :notification_triggers => "notificationTriggers",
    :treat_missing_data => "treatMissingData",
  }
end

Instance Method Details

#to_jsiiObject



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lightsail/cfn_alarm_props.rb', line 130

def to_jsii
  result = {}
  result.merge!({
    "alarmName" => @alarm_name,
    "comparisonOperator" => @comparison_operator,
    "evaluationPeriods" => @evaluation_periods,
    "metricName" => @metric_name,
    "monitoredResourceName" => @monitored_resource_name,
    "threshold" => @threshold,
    "contactProtocols" => @contact_protocols,
    "datapointsToAlarm" => @datapoints_to_alarm,
    "notificationEnabled" => @notification_enabled,
    "notificationTriggers" => @notification_triggers,
    "treatMissingData" => @treat_missing_data,
  })
  result.compact
end