2009-08-14 12:19:40 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
def volumes
|
|
|
|
Fog::AWS::EC2::Volumes.new(:connection => self)
|
|
|
|
end
|
|
|
|
|
|
|
|
class Volumes < Fog::Collection
|
|
|
|
|
2009-08-19 12:11:26 -04:00
|
|
|
def all(volume_id = [])
|
|
|
|
data = connection.describe_volumes(volume_id)
|
2009-09-05 23:50:40 -04:00
|
|
|
volumes = Fog::AWS::EC2::Volumes.new(:connection => connection)
|
2009-08-14 12:19:40 -04:00
|
|
|
data['volumeSet'].each do |volume|
|
|
|
|
volumes << Fog::AWS::EC2::Volume.new({
|
|
|
|
:connection => connection
|
|
|
|
}.merge!(volume))
|
|
|
|
end
|
|
|
|
volumes
|
|
|
|
end
|
|
|
|
|
|
|
|
def create(attributes = {})
|
|
|
|
volume = new(attributes)
|
|
|
|
volume.save
|
|
|
|
volume
|
|
|
|
end
|
|
|
|
|
|
|
|
def new(attributes = {})
|
|
|
|
Fog::AWS::EC2::Volume.new(attributes.merge!(:connection => connection))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|