Module: AWS::EC2::FilteredCollection

Included in:
Collection
Defined in:
lib/aws/ec2/filtered_collection.rb

Instance Method Summary collapse

Instance Method Details

#filter(filter_name, *values) ⇒ Object

Specify one or more criteria to filter elastic IP addresses by. A subsequent call to #each will limit the results returned by provided filters.

  • Chain multiple calls of #filter together to AND multiple conditions together.

  • Supply multiple values to a singler #filter call to OR those value conditions together.

  • ‘*’ matches one or more characters and ‘?’ matches any one character.



38
39
40
41
42
# File 'lib/aws/ec2/filtered_collection.rb', line 38

def filter filter_name, *values
  filters = @filters.dup
  filters << { :name => filter_name, :values => values.flatten }
  collection_with(:filters => filters)
end

#filtered_request(client_method, options = {}, &block) ⇒ Object



45
46
47
48
# File 'lib/aws/ec2/filtered_collection.rb', line 45

def filtered_request client_method, options = {}, &block
  options[:filters] = @filters unless @filters.empty?
  client.send(client_method, options)
end

#initialize(options = {}) ⇒ Object



20
21
22
23
# File 'lib/aws/ec2/filtered_collection.rb', line 20

def initialize options = {}
  @filters = options[:filters] || []
  super
end