Class: Fog::AWS::EC2::Volumes

Inherits:
Collection show all
Defined in:
lib/fog/aws/models/ec2/volumes.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(volume_id = []) ⇒ Object



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

def all(volume_id = [])
  data = connection.describe_volumes(volume_id)
  volumes = Fog::AWS::EC2::Volumes.new(:connection => connection)
  data['volumeSet'].each do |volume|
    volumes << Fog::AWS::EC2::Volume.new({
      :connection => connection
    }.merge!(volume))
  end
  volumes
end

#create(attributes = {}) ⇒ Object



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

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

#new(attributes = {}) ⇒ Object



28
29
30
# File 'lib/fog/aws/models/ec2/volumes.rb', line 28

def new(attributes = {})
  Fog::AWS::EC2::Volume.new(attributes.merge!(:connection => connection))
end