Sha256: ea1c2b0a37bf485ef3205a13ad4ab4a7067eafbe4318c3a8785a1d22e58739e7

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

module Fog
  module AWS
    class EC2

      class Volume < Fog::Model

        attr_accessor :attachment_time,
                      :availability_zone,
                      :device,
                      :instance_id
                      :size,
                      :snapshot_id,
                      :status,
                      :volume_id
        
        def initialize(attributes = {})
          if attributes['attachmentSet']
            attributes.merge!(attributes.delete('attachmentSet'))
          end
          remap_attributes(attributes, {
            'attachmentTime'    => :attachment_time,
            'availabilityZone'  => :availability_zone,
            'createTime'        => :create_time,
            'instanceId'        => :instance_id,
            'snapshotId'        => :snapshot_id,
            'status'            => :status
            'volumeId'          => :volume_id
          })
          super
        end

        def delete
          connection.delete_volume(@volume_id)
        end

        def save
          data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
          new_attributes = data.reject {|key,value| key == 'requestId'}
          update_attributes(new_attributes)
          data
        end

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-0.0.4 lib/fog/aws/models/ec2/volume.rb
fog-0.0.3 lib/fog/aws/models/ec2/volume.rb