Sha256: 5c122280d1212d3fec2bf93bfd6ad7bdb6e70d4535d457ca3f4f82b2062c5082

Contents?: true

Size: 1 KB

Versions: 12

Compression:

Stored size: 1 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 :progress
        attribute :created_at,  'startTime'
        attribute :state,       'status'
        attribute :volume_id,   'volumeId'

        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

12 entries across 12 versions & 1 rubygems

Version Path
fog-0.0.91 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.90 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.89 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.88 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.87 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.86 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.85 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.84 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.83 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.82 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.81 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.80 lib/fog/aws/models/ec2/snapshot.rb