Sha256: 5d6853ff965e219af21c8eb7a012b31699b18c079295ee87811e7c39f2cfa61e
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
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}'." all.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 module_function def self.filters [ { name: 'tag', description: 'Filter instances tagged with the given tag name and value.', args: 'TAG_NAME:VALUE"' } ] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outliers-0.2.0 | lib/outliers/filters/aws/ec2/tags.rb |