Class: Fog::AWS::EC2::Snapshot

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/ec2/snapshot.rb

Instance Method Summary collapse

Methods inherited from Model

aliases, attribute, attributes, #attributes, #initialize, #inspect, #merge_attributes

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#deleteObject



13
14
15
16
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 13

def delete
  connection.delete_snapshot(@snapshot_id)
  true
end

#saveObject



18
19
20
21
22
23
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 18

def save
  data = connection.create_snapshot(@volume.volume_id).body
  new_attributes = data.reject {|key,value| key == 'requestId'}
  update_attributes(new_attributes)
  true
end

#snapshotsObject



25
26
27
28
29
30
31
32
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 25

def snapshots
  @snapshots ||= begin
    Fog::AWS::S3::Snapshots.new(
      :connection => connection,
      :volume     => self
    )
  end
end

#volumeObject



34
35
36
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 34

def volume
  @volume
end