Class: CfnGuardian::Resource::InternalHttp
- Defined in:
- lib/cfnguardian/resources/internal_http.rb
Instance Method Summary collapse
- #default_alarms ⇒ Object
- #default_checks ⇒ Object
- #default_events ⇒ Object
-
#initialize(resource, override_group = nil) ⇒ InternalHttp
constructor
A new instance of InternalHttp.
Methods inherited from Base
#default_event_subscriptions, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #resource_exists?
Methods included from Logging
colors, included, logger, #logger, logger=
Constructor Details
#initialize(resource, override_group = nil) ⇒ InternalHttp
Returns a new instance of InternalHttp.
6 7 8 9 10 |
# File 'lib/cfnguardian/resources/internal_http.rb', line 6 def initialize(resource, override_group = nil) super(resource, override_group) @resource_list = resource['Hosts'] @environment = resource['Environment'] end |
Instance Method Details
#default_alarms ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cfnguardian/resources/internal_http.rb', line 12 def default_alarms @resource_list.each do |host| alarm = CfnGuardian::Models::InternalHttpAlarm.new(host) alarm.name = 'EndpointAvailable' alarm.metric_name = 'Available' @alarms.push(alarm) alarm = CfnGuardian::Models::InternalHttpAlarm.new(host) alarm.name = 'EndpointStatusCodeMatch' alarm.metric_name = 'StatusCodeMatch' @alarms.push(alarm) alarm = CfnGuardian::Models::InternalHttpAlarm.new(host) alarm.name = 'EndpointTimeTaken' alarm.comparison_operator = 'GreaterThanThreshold' alarm.metric_name = 'TimeTaken' alarm.statistic = 'Minimum' alarm.threshold = 1000 alarm.period = 300 alarm.evaluation_periods = 1 @alarms.push(alarm) if host.has_key?('BodyRegex') alarm = CfnGuardian::Models::InternalHttpAlarm.new(host) alarm.name = 'EndpointBodyRegexMatch' alarm.metric_name = 'ResponseBodyRegexMatch' @alarms.push(alarm) end if host.has_key?('Ssl') && host['Ssl'] alarm = CfnGuardian::Models::InternalSslAlarm.new(host) alarm.name = 'ExpiresInDaysCritical' alarm.metric_name = 'ExpiresInDays' alarm.threshold = 5 @alarms.push(alarm) alarm = CfnGuardian::Models::InternalSslAlarm.new(host) alarm.name = 'ExpiresInDaysTask' alarm.metric_name = 'ExpiresInDays' alarm.threshold = 30 @alarms.push(alarm) end end end |
#default_checks ⇒ Object
66 67 68 69 70 71 |
# File 'lib/cfnguardian/resources/internal_http.rb', line 66 def default_checks() @checks.push(CfnGuardian::Models::InternalHttpCheck.new(@resource)) if @resource_list.any? {|host| host.has_key?('Ssl') && host['Ssl'] } @checks.push(CfnGuardian::Models::InternalSslCheck.new(@resource)) end end |
#default_events ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/cfnguardian/resources/internal_http.rb', line 57 def default_events() @resource_list.each do |host| @events.push(CfnGuardian::Models::InternalHttpEvent.new(host,@environment)) if host.has_key?('Ssl') && host['Ssl'] @events.push(CfnGuardian::Models::InternalSslEvent.new(host,@environment)) end end end |