Sha256: 4867a10de13252a9196234740daf3344f013568f7c374a8e676d7138b0a5d32f

Contents?: true

Size: 1.12 KB

Versions: 49

Compression:

Stored size: 1.12 KB

Contents

require 'fog/model'

module Fog
  module AWS
    module EC2

      class Snapshot < Fog::Model
        extend Fog::Deprecation
        deprecate(:status, :state)

        identity  :id, 'snapshotId'

        attribute :description
        attribute :progress
        attribute :created_at,  'startTime'
        attribute :owner_id,    'ownerId'
        attribute :state,       'status'
        attribute :volume_id,   'volumeId'
        attribute :volume_size, 'volumeSize'

        def destroy
          requires :id

          connection.delete_snapshot(@id)
          true
        end

        def ready?
          state == 'completed'
        end

        def save
          requires :volume_id

          data = connection.create_snapshot(@volume_id).body
          new_attributes = data.reject {|key,value| key == 'requestId'}
          merge_attributes(new_attributes)
          true
        end

        def volume
          requires :id

          connection.describe_volumes(@volume_id)
        end

        private

        def volume=(new_volume)
          @volume_id = new_volume.volume_id
        end

      end

    end
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
fog-0.2.27 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.26 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.25 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.24 lib/fog/aws/models/ec2/snapshot.rb
tecnh-fog-0.2.23.vpc lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.23 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.22 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.21 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.20 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.19 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.18 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.17 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.16 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.15 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.14 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.13 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.12 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.11 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.10 lib/fog/aws/models/ec2/snapshot.rb
fog-0.2.9 lib/fog/aws/models/ec2/snapshot.rb