Class: Meteorlog::Wrapper::MetricFilterCollection
- Inherits:
-
Object
- Object
- Meteorlog::Wrapper::MetricFilterCollection
- Extended by:
- Forwardable
- Includes:
- Logger::Helper
- Defined in:
- lib/meteorlog/wrapper/metric_filter_collection.rb
Instance Method Summary collapse
- #create(name, opts = {}) ⇒ Object
- #each ⇒ Object
-
#initialize(cloud_watch_logs, metric_filters, log_group, options = {}) ⇒ MetricFilterCollection
constructor
A new instance of MetricFilterCollection.
Methods included from Logger::Helper
Constructor Details
#initialize(cloud_watch_logs, metric_filters, log_group, options = {}) ⇒ MetricFilterCollection
Returns a new instance of MetricFilterCollection.
7 8 9 10 11 12 |
# File 'lib/meteorlog/wrapper/metric_filter_collection.rb', line 7 def initialize(cloud_watch_logs, metric_filters, log_group, = {}) @cloud_watch_logs = cloud_watch_logs @metric_filters = metric_filters @log_group = log_group = end |
Instance Method Details
#create(name, opts = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/meteorlog/wrapper/metric_filter_collection.rb', line 21 def create(name, opts = {}) log(:info, 'Create MetricFilter', :cyan, "#{self.log_group_name} > #{name}") unless [:dry_run] @cloud_watch_logs.put_metric_filter( :log_group_name => self.log_group_name, :filter_name => name, :filter_pattern => opts[:filter_pattern] || '', :metric_transformations => opts[:metric_transformations]) [:modified] = true end metric_filter = OpenStruct.new( :filter_name => name, :filter_pattern => opts[:filter_pattern], :metric_transformations => opts[:metric_transformations]) Meteorlog::Wrapper::MetricFilter.new(metric_filter, @log_group, ) end |
#each ⇒ Object
14 15 16 17 18 19 |
# File 'lib/meteorlog/wrapper/metric_filter_collection.rb', line 14 def each @metric_filters.each do |metric_filter| yield(Meteorlog::Wrapper::MetricFilter.new( @cloud_watch_logs, metric_filter, @log_group, )) end end |