Class: CfnGuardian::Resource::LogGroup

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

Instance Method Summary collapse

Methods inherited from Base

#default_checks, #default_event_subscriptions, #default_events, #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) ⇒ LogGroup

Returns a new instance of LogGroup.



4
5
6
7
# File 'lib/cfnguardian/resources/log_group.rb', line 4

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

Instance Method Details

#default_alarmsObject



9
10
11
12
13
14
15
16
# File 'lib/cfnguardian/resources/log_group.rb', line 9

def default_alarms()
  @resource_list.each do |filter|
    alarm = CfnGuardian::Models::LogGroupAlarm.new(@resource)
    alarm.name = filter['MetricName']
    alarm.metric_name = filter['MetricName']
    @alarms.push(alarm)
  end
end

#default_metric_filtersObject



18
19
20
21
22
23
# File 'lib/cfnguardian/resources/log_group.rb', line 18

def default_metric_filters()
  @resource_list.each do |filter|
    metric_filter = CfnGuardian::Models::MetricFilter.new(@resource['Id'],filter)
    @metric_filters.push(metric_filter)
  end
end