Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Filter snapshots and volumes #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/AWS/EC2/snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ class Base < AWS::Base
# The DescribeSnapshots operation describes the status of Amazon EBS snapshots.
#
# @option options [optional,Array] :snapshot_id ([]) The ID of the Amazon EBS snapshot.
# @option options [optional,Array] :filters ([]) Array of Hashes of filters.
# @option options [optional,String] :owner ('') Returns snapshots owned by the specified owner. Multiple owners can be specified. Valid values self | amazon | AWS Account ID
# @option options [optional,String] :restorable_by ('') Account ID of a user that can create volumes from the snapshot.
#
def describe_snapshots( options = {} )
params = {}
params.merge!(pathlist("SnapshotId", options[:snapshot_id] )) unless options[:snapshot_id].nil? || options[:snapshot_id] == []
params.merge!(pathkvlist("Filter", options[:filters], "Name", "Value", {} )) unless options[:filters].nil? || options[:filters] == []
params["RestorableBy"] = options[:restorable_by] unless options[:restorable_by].nil?
params["Owner"] = options[:owner] unless options[:owner].nil?
return response_generator(:action => "DescribeSnapshots", :params => params)
Expand Down
2 changes: 2 additions & 0 deletions lib/AWS/EC2/volumes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ class Base < AWS::Base
# The DescribeVolumes operation lists one or more Amazon EBS volumes that you own, If you do not specify any volumes, Amazon EBS returns all volumes that you own.
#
# @option options [optional, String] :volume_id ([])
# @option options [optional,Array] :filters ([]) Array of Hashes of filters.
#
def describe_volumes( options = {} )
options = { :volume_id => [] }.merge(options)
params = pathlist("VolumeId", options[:volume_id] )
params.merge!(pathkvlist("Filter", options[:filters], "Name", "Value", {} )) unless options[:filters].nil? || options[:filters] == []
return response_generator(:action => "DescribeVolumes", :params => params)
end

Expand Down