Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support filtering in describe instances #66

Open
wants to merge 2 commits into from

1 participant

@rkyrychuk

Added support for filtering in describe instances.
You can review and add this functionality, to the gem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2012
  1. @rkyrychuk
  2. @rkyrychuk

    Ruby style keys in filter

    rkyrychuk authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/AWS/EC2/instances.rb
View
11 lib/AWS/EC2/instances.rb
@@ -82,14 +82,20 @@ def run_instances( options = {} )
# instance is specified that does not exist a fault is returned. If an instance is specified that exists but is not
# owned by the user making the request, then that instance will not be included in the returned results.
#
+ # An optional filter can be provided to to request information for instances that corresponds this filter only
+ #
# Recently terminated instances will be included in the returned results for a small interval subsequent to
# their termination. This interval is typically of the order of one hour
#
# @option options [Array] :instance_id ([])
+ # @option options [Hash] :filter ({})
#
def describe_instances( options = {} )
- options = { :instance_id => [] }.merge(options)
- params = pathlist("InstanceId", options[:instance_id])
+ options = { :instance_id => [], :filter => {} }.merge(options)
+ params = {}
+ params.merge!(pathlist("InstanceId", options[:instance_id]))
+ params.merge!(pathhashlist("Filter", options[:filter].map{|k,v| {:name => k.is_a?(Symbol) ? k.to_s.gsub("_", "-") : k, :value => v}}, {:name => 'Name', :value => 'Value'}))
+
return response_generator(:action => "DescribeInstances", :params => params)
end
@@ -296,4 +302,3 @@ def self.local_instance_meta_data
end
end
-
Something went wrong with that request. Please try again.