Sha256: bfd3e3e92187ee8b4689363db65fe56c1dabd82ac85bb42ba9cb18a033150268

Contents?: true

Size: 1.3 KB

Versions: 39

Compression:

Stored size: 1.3 KB

Contents

module Fog
  module Compute
    class AWS
      class Snapshot < Fog::Model
        identity  :id,          :aliases => 'snapshotId'

        attribute :description
        attribute :encrypted
        attribute :progress
        attribute :created_at,  :aliases => 'startTime'
        attribute :owner_id,    :aliases => 'ownerId'
        attribute :state,       :aliases => 'status'
        attribute :tags,        :aliases => 'tagSet'
        attribute :volume_id,   :aliases => 'volumeId'
        attribute :volume_size, :aliases => 'volumeSize'

        def destroy
          requires :id

          service.delete_snapshot(id)
          true
        end

        def ready?
          state == 'completed'
        end

        def save
          raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
          requires :volume_id

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

        def volume
          requires :id
          service.describe_volumes(volume_id)
        end

        private

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

Version data entries

39 entries across 37 versions & 3 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/models/compute/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/snapshot.rb
fog-aws-3.0.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-2.0.1 lib/fog/aws/models/compute/snapshot.rb
fog-aws-2.0.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.4.1 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.4.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.3.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.2.1 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.2.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.1.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-1.0.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.13.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.12.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.11.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.10.0 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.9.4 lib/fog/aws/models/compute/snapshot.rb
fog-aws-0.9.3 lib/fog/aws/models/compute/snapshot.rb