Class: Fog::Compute::AWS::Snapshots
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::AWS::Snapshots
- Defined in:
- lib/fog/aws/models/compute/snapshots.rb
Instance Method Summary collapse
- #all(filters = filters, options = {}) ⇒ Object
- #get(snapshot_id) ⇒ Object
-
#initialize(attributes) ⇒ Snapshots
constructor
A new instance of Snapshots.
- #new(attributes = {}) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Snapshots
Returns a new instance of Snapshots.
13 14 15 16 |
# File 'lib/fog/aws/models/compute/snapshots.rb', line 13 def initialize(attributes) self.filters ||= { 'RestorableBy' => 'self' } super end |
Instance Method Details
#all(filters = filters, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/aws/models/compute/snapshots.rb', line 18 def all(filters = filters, = {}) unless filters.is_a?(Hash) Fog::Logger.deprecation("all with #{filters.class} param is deprecated, use all('snapshot-id' => []) instead [light_black](#{caller.first})[/]") filters = {'snapshot-id' => [*filters]} end self.filters = filters data = service.describe_snapshots(filters.merge!()).body load(data['snapshotSet']) if volume self.replace(self.select {|snapshot| snapshot.volume_id == volume.id}) end self end |
#get(snapshot_id) ⇒ Object
32 33 34 35 36 |
# File 'lib/fog/aws/models/compute/snapshots.rb', line 32 def get(snapshot_id) if snapshot_id self.class.new(:service => service).all('snapshot-id' => snapshot_id).first end end |
#new(attributes = {}) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/fog/aws/models/compute/snapshots.rb', line 38 def new(attributes = {}) if volume super({ 'volumeId' => volume.id }.merge!(attributes)) else super end end |