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

#destroyObject



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

def destroy
  connection.delete_snapshot(@snapshot_id)
  true
end

#reloadObject



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

def reload
  new_attributes = snapshots.get(@snapshot_id).attributes
  merge_attributes(new_attributes)
end

#saveObject



23
24
25
26
27
28
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 23

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

#snapshotsObject



30
31
32
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 30

def snapshots
  @snapshots
end

#volumeObject



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

def volume
  connection.describe_volumes(@volume_id)
end