Sha256: 6f936b6600469ae70f271566cb52ae97914b6be59f06d969adc074e1156ba811

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 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
          new_attributes = snapshots.get(@snapshot_id).attributes
          merge_attributes(new_attributes)
        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

16 entries across 16 versions & 1 rubygems

Version Path
fog-0.0.25 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.24 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.23 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.22 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.21 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.20 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.19 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.18 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.17 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.16 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.15 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.14 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.13 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.12 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.11 lib/fog/aws/models/ec2/snapshot.rb
fog-0.0.10 lib/fog/aws/models/ec2/snapshot.rb