Sha256: ed55f3faf88d94c1f2fc9040881460c0086c033fd13198c792c2784a60d7cc8e

Contents?: true

Size: 861 Bytes

Versions: 7

Compression:

Stored size: 861 Bytes

Contents

module Fog
  module AWS
    class EC2

      class Snapshot < Fog::Model

        identity  :id, 'snapshotId'

        attribute :progress
        attribute :start_time,  'startTime'
        attribute :status
        attribute :volume_id,    'volumeId'

        def destroy
          requires :id

          connection.delete_snapshot(@id)
          true
        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

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.0.39 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.38 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.37 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.36 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.35 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.34 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.33 lib/fog/aws/models/ec2/snapshot.rb