Sha256: 83925c6267267215b99948741ed5091313150708c69a24db2c7096b2384dc0ff

Contents?: true

Size: 1.3 KB

Versions: 32

Compression:

Stored size: 1.3 KB

Contents

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

module Fog
  module Volume
    class OpenStack
      class V1
        class Snapshot < Fog::Volume::OpenStack::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

32 entries across 30 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.10 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.1.30 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.1.29 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.9 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.1.28 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.8 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.7 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.6 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.5 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.4 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.3 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.2 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.3.0 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.2.4 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.2.3 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.2.2 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.2.1 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-openstack-0.2.0 lib/fog/volume/openstack/v1/models/snapshot.rb
fog-zj-0.1.28 lib/fog/volume/openstack/v1/models/snapshot.rb