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, #collection, identity, #identity, #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
22
# File 'lib/fog/aws/models/ec2/snapshot.rb', line 18

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

#saveObject



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

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

#snapshotsObject



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

def snapshots
  @snapshots
end

#volumeObject



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

def volume
  connection.describe_volumes(@volume_id)
end