Sha256: 6c06841a95dce54188dfe154c8ac498f41f01c3f7b1897a57066d61a5f949097

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

module Fog
  module AWS
    class EC2

      class Snapshot < Fog::Model

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

        def destroy
          connection.delete_snapshot(@snapshot_id)
          true
        end

        def reload
          if new_snapshot = snapshots.get(@snapshot_id)
            merge_attributes(new_snapshot.attributes)
          end
        end

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

        def snapshots
          @snapshots
        end

        def volume
          connection.describe_volumes(@volume_id)
        end

        private

        def snapshots=(new_snapshots)
          @snapshots = new_snapshots
        end

        def volume=(new_volume)
          @volume_id = new_volume.volume_id
        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/snapshot.rb
fog-0.0.28 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.27 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.26 lib/fog/aws/models/ec2/snapshot.rb