Sha256: 71f30bc3ed46cd5724e95bbbcf3dba195b1b9095680a7b1a35cc5ec31e190826

Contents?: true

Size: 1.23 KB

Versions: 32

Compression:

Stored size: 1.23 KB

Contents

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

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

          attribute :name
          attribute :status
          attribute :description
          attribute :metadata
          attribute :force
          attribute :size

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

          def create
            requires :name

            # volume_id, name, description, force=false
            response = service.create_snapshot(attributes[:volume_id],
                                               attributes[:name],
                                               attributes[: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.27 lib/fog/volume/openstack/v2/models/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-openstack-0.1.26/lib/fog/volume/openstack/v2/models/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-openstack-0.1.26/lib/fog/volume/openstack/v2/models/snapshot.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-openstack-0.1.26/lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.26 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.25 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.24 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.23 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.22 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.21 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.20 lib/fog/volume/openstack/v2/models/snapshot.rb
fog-openstack-0.1.19 lib/fog/volume/openstack/v2/models/snapshot.rb