Sha256: 70e968cd691712f2b1f81cdf6c3ec216c373df7512e939c025f719ce0d1790f4

Contents?: true

Size: 898 Bytes

Versions: 12

Compression:

Stored size: 898 Bytes

Contents

require 'fog/openstack/models/model'
require 'fog/openstack/models/compute/metadata'

module Fog
  module Compute
    class OpenStack
      class Snapshot < Fog::OpenStack::Model
        identity :id

        attribute :name,                :aliases => 'displayName'
        attribute :description,         :aliases => 'displayDescription'
        attribute :volume_id,           :aliases => 'volumeId'
        attribute :status
        attribute :size
        attribute :created_at,          :aliases => 'createdAt'

        def save(force=false)
          requires :volume_id, :name, :description
          data = service.create_volume_snapshot(volume_id, name, description, force)
          merge_attributes(data.body['snapshot'])
          true
        end

        def destroy
          requires :id
          service.delete_snapshot(id)
          true
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
fog-openstack-0.1.5 lib/fog/openstack/models/compute/snapshot.rb
fog-openstack-0.1.4 lib/fog/openstack/models/compute/snapshot.rb
fog-openstack-0.1.3 lib/fog/openstack/models/compute/snapshot.rb
fog-openstack-0.1.2 lib/fog/openstack/models/compute/snapshot.rb
fog-openstack-0.1.1 lib/fog/openstack/models/compute/snapshot.rb
fog-openstack-0.1.0 lib/fog/openstack/models/compute/snapshot.rb
fog-1.37.0 lib/fog/openstack/models/compute/snapshot.rb
fog-1.36.0 lib/fog/openstack/models/compute/snapshot.rb
fog-1.35.0 lib/fog/openstack/models/compute/snapshot.rb
fog-2.0.0.pre.0 lib/fog/openstack/models/compute/snapshot.rb
fog-1.34.0 lib/fog/openstack/models/compute/snapshot.rb
fog-1.33.0 lib/fog/openstack/models/compute/snapshot.rb