Sha256: 6bea728dc5057afa9d3612bedd84e79d349901c8beb17acd61cd174948612e3e
Contents?: true
Size: 1009 Bytes
Versions: 8
Compression:
Stored size: 1009 Bytes
Contents
require 'fog/collection' require 'fog/aws/models/compute/volume' module Fog module AWS class Compute class Volumes < Fog::Collection attribute :volume_id attribute :server model Fog::AWS::Compute::Volume def initialize(attributes) @volume_id ||= [] super end def all(volume_id = @volume_id) @volume_id = volume_id data = connection.describe_volumes(volume_id).body load(data['volumeSet']) if server self.replace(self.select {|volume| volume.server_id == server.id}) end self end def get(volume_id) if volume_id all(volume_id).first end rescue Fog::Errors::NotFound nil end def new(attributes = {}) if server super({ :server => server }.merge!(attributes)) else super end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems