Class: CfnGuardian::Models::BaseAlarm

Inherits:
Object
  • Object
show all
Defined in:
lib/cfnguardian/models/alarm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ BaseAlarm



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/cfnguardian/models/alarm.rb', line 41

def initialize(resource)
  @type = 'Alarm'
  @group = nil
  @name = ''
  @metric_name = nil
  @namespace = nil
  @dimensions = nil
  @threshold = 0
  @threshold_overridden = false
  @period = 60
  @evaluation_periods = 1
  @comparison_operator = 'GreaterThanThreshold'
  @statistic = 'Maximum'
  @actions_enabled = true
  @ok_action_disabled = false
  @datapoints_to_alarm = nil
  @extended_statistic = nil
  @evaluate_low_sample_count_percentile = nil
  @unit = nil
  @enabled = true
  @resource_hash = Digest::MD5.hexdigest resource['Id']
  @resource_id = resource['Id']
  @resource_name = resource.fetch('Name', nil)
  @alarm_action = 'Critical'
  @treat_missing_data = nil
  @maintenance_groups = []
  @additional_notifiers = []
  @tags = {}
  @search_expression = nil
  @search_aggregation = nil
  @anomaly_detection = false
  @standard_deviation = nil
end

Instance Attribute Details

#actions_enabledObject

Returns the value of attribute actions_enabled.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def actions_enabled
  @actions_enabled
end

#additional_notifiersObject

Returns the value of attribute additional_notifiers.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def additional_notifiers
  @additional_notifiers
end

#alarm_actionObject

Returns the value of attribute alarm_action.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def alarm_action
  @alarm_action
end

#anomaly_detectionObject

Returns the value of attribute anomaly_detection.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def anomaly_detection
  @anomaly_detection
end

#comparison_operatorObject

Returns the value of attribute comparison_operator.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def comparison_operator
  @comparison_operator
end

#datapoints_to_alarmObject

Returns the value of attribute datapoints_to_alarm.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def datapoints_to_alarm
  @datapoints_to_alarm
end

#dimensionsObject

Returns the value of attribute dimensions.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def dimensions
  @dimensions
end

#enabledObject

Returns the value of attribute enabled.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def enabled
  @enabled
end

#evaluate_low_sample_count_percentileObject

Returns the value of attribute evaluate_low_sample_count_percentile.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def evaluate_low_sample_count_percentile
  @evaluate_low_sample_count_percentile
end

#evaluation_periodsObject

Returns the value of attribute evaluation_periods.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def evaluation_periods
  @evaluation_periods
end

#extended_statisticObject

Returns the value of attribute extended_statistic.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def extended_statistic
  @extended_statistic
end

#groupObject

Returns the value of attribute group.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def group
  @group
end

#maintenance_groupsObject

Returns the value of attribute maintenance_groups.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def maintenance_groups
  @maintenance_groups
end

#metric_nameObject

Returns the value of attribute metric_name.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def metric_name
  @metric_name
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def name
  @name
end

#namespaceObject

Returns the value of attribute namespace.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def namespace
  @namespace
end

#ok_action_disabledObject

Returns the value of attribute ok_action_disabled.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def ok_action_disabled
  @ok_action_disabled
end

#periodObject

Returns the value of attribute period.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def period
  @period
end

#resource_hashObject (readonly)

Returns the value of attribute resource_hash.



8
9
10
# File 'lib/cfnguardian/models/alarm.rb', line 8

def resource_hash
  @resource_hash
end

#resource_idObject

Returns the value of attribute resource_id.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def resource_id
  @resource_id
end

#resource_nameObject

Returns the value of attribute resource_name.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def resource_name
  @resource_name
end

#search_aggregationObject

Returns the value of attribute search_aggregation.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def search_aggregation
  @search_aggregation
end

#search_expressionObject

Returns the value of attribute search_expression.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def search_expression
  @search_expression
end

#standard_deviationObject

Returns the value of attribute standard_deviation.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def standard_deviation
  @standard_deviation
end

#statisticObject

Returns the value of attribute statistic.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def statistic
  @statistic
end

#tagsObject

Returns the value of attribute tags.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def tags
  @tags
end

#thresholdObject

Returns the value of attribute threshold.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def threshold
  @threshold
end

#threshold_overriddenObject (readonly)

Returns the value of attribute threshold_overridden.



8
9
10
# File 'lib/cfnguardian/models/alarm.rb', line 8

def threshold_overridden
  @threshold_overridden
end

#treat_missing_dataObject

Returns the value of attribute treat_missing_data.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def treat_missing_data
  @treat_missing_data
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/cfnguardian/models/alarm.rb', line 8

def type
  @type
end

#unitObject

Returns the value of attribute unit.



12
13
14
# File 'lib/cfnguardian/models/alarm.rb', line 12

def unit
  @unit
end

Instance Method Details

#mark_threshold_overridden!Object

Internal-only marker used to track that Threshold was explicitly set via a config override (as opposed to a resource group's own default_alarms definition). This is intentionally not exposed as a public writer so a YAML config cannot set ThresholdOverridden directly and bypass the "can't combine Threshold and AnomalyDetection" validation.



85
86
87
# File 'lib/cfnguardian/models/alarm.rb', line 85

def mark_threshold_overridden!
  @threshold_overridden = true
end