Class: Fog::AWS::EC2::Snapshots

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

Instance Method Summary collapse

Methods inherited from Collection

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

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#all(snapshot_id = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/aws/models/ec2/snapshots.rb', line 11

def all(snapshot_id = [])
  data = connection.describe_snapshots(snapshot_id)
  snapshots = Fog::AWS::EC2::Snapshots.new(:connection => connection)
  data['snapshotSet'].each do |volume|
    snapshots << Fog::AWS::EC2::Snapshot.new({
      :connection => connection
    }.merge!(snapshot))
  end
  snapshots
end

#create(attributes = {}) ⇒ Object



22
23
24
25
26
# File 'lib/fog/aws/models/ec2/snapshots.rb', line 22

def create(attributes = {})
  volume = new(attributes)
  volume.save
  volume
end

#new(attributes = {}) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/fog/aws/models/ec2/snapshots.rb', line 28

def new(attributes = {})
  Fog::AWS::S3::Snapshot.new({
    :connection => connection,
    :volume     => @volume,
    :snapshots  => self
  }.merge!(attributes))
end

#volumeObject



36
37
38
# File 'lib/fog/aws/models/ec2/snapshots.rb', line 36

def volume
  @volume
end