Class: CfnGuardian::Resource::Http

Inherits:
Base
  • Object
show all
Defined in:
lib/cfnguardian/resources/http.rb

Instance Method Summary collapse

Methods inherited from Base

#default_event_subscriptions, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #initialize, #resource_exists?

Methods included from Logging

colors, included, logger, #logger, logger=

Constructor Details

This class inherits a constructor from CfnGuardian::Resource::Base

Instance Method Details

#default_alarmsObject



6
7
8
9
10
11
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
# File 'lib/cfnguardian/resources/http.rb', line 6

def default_alarms    
  alarm = CfnGuardian::Models::HttpAlarm.new(@resource)
  alarm.name = 'EndpointAvailable'
  alarm.metric_name = 'Available'
  @alarms.push(alarm)
  
  alarm = CfnGuardian::Models::HttpAlarm.new(@resource)
  alarm.name = 'EndpointStatusCodeMatch'
  alarm.metric_name = 'StatusCodeMatch'
  @alarms.push(alarm)
        
  alarm = CfnGuardian::Models::HttpAlarm.new(@resource)
  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 @resource.has_key?('BodyRegex')
    alarm = CfnGuardian::Models::HttpAlarm.new(@resource)
    alarm.name = 'EndpointBodyRegexMatch'
    alarm.metric_name = 'ResponseBodyRegexMatch'
    @alarms.push(alarm)
  end
  
  if @resource.has_key?('Ssl') && @resource['Ssl']
    alarm = CfnGuardian::Models::SslAlarm.new(@resource)
    alarm.name = 'ExpiresInDaysCritical'
    alarm.metric_name = 'ExpiresInDays'
    alarm.threshold = 5
    alarm.treat_missing_data = 'notBreaching'
    @alarms.push(alarm)
    
    alarm = CfnGuardian::Models::SslAlarm.new(@resource)
    alarm.name = 'ExpiresInDaysTask'
    alarm.metric_name = 'ExpiresInDays'
    alarm.alarm_action = 'Task'
    alarm.threshold = 30
    alarm.treat_missing_data = 'notBreaching'
    @alarms.push(alarm)
  end
end

#default_checksObject



59
60
61
62
63
64
# File 'lib/cfnguardian/resources/http.rb', line 59

def default_checks()
  @checks.push(CfnGuardian::Models::HttpCheck.new(@resource))
  if @resource.has_key?('Ssl') && @resource['Ssl']
    @checks.push(CfnGuardian::Models::SslCheck.new(@resource))
  end
end

#default_eventsObject



52
53
54
55
56
57
# File 'lib/cfnguardian/resources/http.rb', line 52

def default_events()
  @events.push(CfnGuardian::Models::HttpEvent.new(@resource))
  if @resource.has_key?('Ssl') && @resource['Ssl']
    @events.push(CfnGuardian::Models::SslEvent.new(@resource))
  end
end