Sha256: 309ebbae188ed1dac398f140ddd5e9603c6b5312ed0b614c115e6bae823df424

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 Bytes

Contents

module Outliers
  module Filters
    module Aws
      module Ec2
        module Tags

          def filter_tag(value)
            tag_name  = value.split(':').first
            tag_value = value.split(':').last
            logger.info "Filtering by tag '#{tag_name}' equals '#{tag_value}'."
            list.select do |r|
              if r.tags.has_key? tag_name
                value = r.tags[tag_name]
                result = value == tag_value
                logger.debug "'#{r.id}' has tag with value '#{value}'. #{result ? 'Matches' : 'Does not match'} filter."
                result
              else
                logger.debug "'#{r.id}' does not have tag '#{tag_name}'"
                false
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
outliers-0.3.3 lib/outliers/filters/aws/ec2/tags.rb
outliers-0.3.2 lib/outliers/filters/aws/ec2/tags.rb
outliers-0.3.1 lib/outliers/filters/aws/ec2/tags.rb