Class: EbsPruneSnapshot::Aws
- Inherits:
-
Object
- Object
- EbsPruneSnapshot::Aws
- Defined in:
- lib/ebs_prune_snapshot.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
- #connection ⇒ Object
- #delete(snapshot) ⇒ Object
-
#initialize(args = {}) ⇒ Aws
constructor
A new instance of Aws.
- #snapshots ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Aws
Returns a new instance of Aws.
59 60 61 62 63 |
# File 'lib/ebs_prune_snapshot.rb', line 59 def initialize(args={}) args ||= {} @access_key = args[:access_key] || ENV['AMAZON_ACCESS_KEY_ID'] @secret_key = args[:secret_key] || ENV['AMAZON_SECRET_ACCESS_KEY'] end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
57 58 59 |
# File 'lib/ebs_prune_snapshot.rb', line 57 def access_key @access_key end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
57 58 59 |
# File 'lib/ebs_prune_snapshot.rb', line 57 def secret_key @secret_key end |
Instance Method Details
#connection ⇒ Object
65 66 67 68 69 |
# File 'lib/ebs_prune_snapshot.rb', line 65 def connection @aws ||= ::AWS::EC2::Base.new( :access_key_id => access_key, :secret_access_key => secret_key ) end |
#delete(snapshot) ⇒ Object
76 77 78 |
# File 'lib/ebs_prune_snapshot.rb', line 76 def delete(snapshot) connection.delete_snapshot(:snapshot_id => snapshot.snapshot_id) end |
#snapshots ⇒ Object
71 72 73 74 |
# File 'lib/ebs_prune_snapshot.rb', line 71 def snapshots snapshots = connection.describe_snapshots(:owner => 'self')['snapshotSet'] snapshots ? snapshots["item"] : [] end |