Sha256: c23402e377858be44645e71d6a4a49831977df0d895be7846d22f9a3fd24b274
Contents?: true
Size: 1.5 KB
Versions: 8
Compression:
Stored size: 1.5 KB
Contents
module Fog module AWS class EC2 def volumes(attributes = {}) Fog::AWS::EC2::Volumes.new({ :connection => self }.merge!(attributes)) end class Volumes < Fog::Collection attribute :volume_id attribute :instance_id def initialize(attributes) @volume_id ||= [] super end def all(volume_id = []) data = connection.describe_volumes(volume_id).body volumes = Fog::AWS::EC2::Volumes.new({ :connection => connection, :volume_id => volume_id }.merge!(attributes)) data['volumeSet'].each do |volume| volumes << Fog::AWS::EC2::Volume.new({ :connection => connection, :volumes => self }.merge!(volume)) end if instance_id volumes = volumes.select {|volume| volume.instance_id == instance_id} end volumes end def create(attributes = {}) volume = new(attributes) volume.save volume end def get(volume_id) all(volume_id).first rescue Fog::Errors::BadRequest nil end def new(attributes = {}) Fog::AWS::EC2::Volume.new( attributes.merge!( :connection => connection, :volumes => self ) ) end def reload all(volume_id) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems