Skip to content
This repository
Browse code

Add filtering option to describe_images

  • Loading branch information...
commit 640c8a45eabee757afe75861a6aa3f0e30701de4 1 parent 43c9295
Florian Gilcher authored grempe committed

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  lib/AWS/EC2/images.rb
10  lib/AWS/EC2/images.rb
@@ -130,16 +130,26 @@ def register_image( options = {} )
130 130
       #
131 131
       # Deregistered images will be included in the returned results for an unspecified interval subsequent to
132 132
       # deregistration.
  133
+      # 
  134
+      # The results can be filtered using the filter argument. The EC2 API reference for a full description of
  135
+      # filter types and arguments.
  136
+      # 
  137
+      # @example 
  138
+      #   @ec2.describe_images(:owner_id => ['self'], :filter => [{"tag:Role" => "App"}])
133 139
       #
134 140
       # @option options [Array] :image_id ([])
135 141
       # @option options [Array] :owner_id ([])
136 142
       # @option options [Array] :executable_by ([])
  143
+      # @option options [Array] :filter ([])
137 144
       #
138 145
       def describe_images( options = {} )
139 146
         options = { :image_id => [], :owner_id => [], :executable_by => [] }.merge(options)
140 147
         params = pathlist( "ImageId", options[:image_id] )
141 148
         params.merge!(pathlist( "Owner", options[:owner_id] ))
142 149
         params.merge!(pathlist( "ExecutableBy", options[:executable_by] ))
  150
+        if options[:filter]
  151
+          params.merge!(pathkvlist('Filter', options[:filter], 'Name', 'Value', {}))
  152
+        end
143 153
         return response_generator(:action => "DescribeImages", :params => params)
144 154
       end
145 155
 

0 notes on commit 640c8a4

Please sign in to comment.
Something went wrong with that request. Please try again.