Sha256: 2af0c3501771b3e41c6f272186700b5723173670fea91c43d416750ed2332893
Contents?: true
Size: 1.88 KB
Versions: 4
Compression:
Stored size: 1.88 KB
Contents
module Fog module AWS class EC2 class Volume < Fog::Model attribute :attach_time, 'attachTime' attribute :availability_zone, 'availabilityZone' attribute :create_time, 'createTime' attribute :device attribute :instance_id, 'instanceId' attribute :size attribute :snapshot_id, 'snapshotId' attribute :status attribute :volume_id, 'volumeId' def initialize(attributes = {}) if attributes['attachmentSet'] attributes.merge!(attributes.delete('attachmentSet').first || {}) end super end def destroy connection.delete_volume(@volume_id) true end def instance=(new_instance) if !@volume_id @instance = new_instance if new_instance @availability_zone = new_instance.availability_zone end elsif new_instance @instance = nil @instance_id = new_instance.instance_id connection.attach_volume(@instance_id, @volume_id, @device) end end def reload if new_volume = volumes.get(@volume_id) merge_attributes(new_volume.attributes) end end def save data = connection.create_volume(@availability_zone, @size, @snapshot_id).body new_attributes = data.reject {|key,value| key == 'requestId'} merge_attributes(new_attributes) if @instance self.instance = @instance end true end def snapshots connection.snapshots(:volume_id => volume_id) end def volumes @volumes end private def volumes=(new_volumes) @volumes = new_volumes end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fog-0.0.29 | lib/fog/aws/models/ec2/volume.rb |
fog-0.0.28 | lib/fog/aws/models/ec2/volume.rb |
fog-0.0.27 | lib/fog/aws/models/ec2/volume.rb |
fog-0.0.26 | lib/fog/aws/models/ec2/volume.rb |