Sha256: 74e5ed91f9831c4f55a4681bd2ff198fb61f7987974bb810589ee04ab0a78b6d

Contents?: true

Size: 1.3 KB

Versions: 20

Compression:

Stored size: 1.3 KB

Contents

require 'fog/openstack/volume/models/snapshot'

module Fog
  module OpenStack
    class Volume
      class V1
        class Snapshot < Fog::OpenStack::Volume::Snapshot
          identity :id

          attribute :display_name
          attribute :status
          attribute :display_description
          attribute :metadata
          attribute :force
          attribute :size

          def save
            requires :display_name
            data = if id.nil?
                     service.create_snapshot(attributes[:volume_id], display_name, display_description, force)
                   else
                     service.update_snapshot(id, attributes.reject { |k, _v| k == :id })
                   end
            merge_attributes(data.body['snapshot'])
            true
          end

          def create
            requires :display_name

            # volume_id, name, description, force=false
            response = service.create_snapshot(attributes[:volume_id],
                                               attributes[:display_name],
                                               attributes[:display_description],
                                               attributes[:force])
            merge_attributes(response.body['snapshot'])

            self
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.1.2 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-fork-99 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.1.0 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.1.0.pre lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.11 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.10 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.9 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.8 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.7 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.6 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.5 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.4 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.3 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.2 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.1 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-1.0.0 lib/fog/openstack/volume/v1/models/snapshot.rb
fog-openstack-0.3.1 lib/fog/openstack/volume/v1/models/snapshot.rb