Class: CfnGuardian::Resource::Sql

Inherits:
Base
  • Object
show all
Defined in:
lib/cfnguardian/resources/sql.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, #resource_exists?

Methods included from Logging

colors, included, logger, #logger, logger=

Constructor Details

#initialize(resource, override_group = nil) ⇒ Sql

Returns a new instance of Sql.



7
8
9
10
11
# File 'lib/cfnguardian/resources/sql.rb', line 7

def initialize(resource, override_group = nil)
  super(resource, override_group)
  @resource_list = resource['Hosts']
  @environment = resource['Environment']
end

Instance Method Details

#default_alarmsObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/cfnguardian/resources/sql.rb', line 13

def default_alarms()
  @resource_list.each do |host|
    host['Queries'].each do |query|
      alarm = CfnGuardian::Models::SqlAlarm.new(host)
      alarm.name = query['MetricName']
      alarm.metric_name = query['MetricName']
      @alarms.push(alarm)
    end
  end
end

#default_checksObject



32
33
34
# File 'lib/cfnguardian/resources/sql.rb', line 32

def default_checks()
  @checks.push(CfnGuardian::Models::SqlCheck.new(@resource))
end

#default_eventsObject



24
25
26
27
28
29
30
# File 'lib/cfnguardian/resources/sql.rb', line 24

def default_events()
  @resource_list.each do |host|
    host['Queries'].each do |query|
      @events.push(CfnGuardian::Models::SqlEvent.new(host,query['Query'],@environment))
    end
  end
end