Sha256: 5d9d48502045cadbcce92d1e9a55caf83a82d8340b4cce2856eb6243586ec190

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

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

          superclass.attributes.each { |attrib| attribute attrib }
          attribute :name
          attribute :description
          attribute :tenant_id, :aliases => 'os-vol-tenant-attr:tenant_id'

          def save
            requires :name, :size
            data = if id.nil?
                     service.create_volume(name, description, size, attributes)
                   else
                     service.update_volume(id, attributes.select { |key| %i(name description metadata).include?(key) })
                   end
            merge_attributes(data.body['volume'])
            true
          end

          def update(attr = nil)
            requires :id
            merge_attributes(
              service.update_volume(id, attr || attributes).body['volume']
            )
            self
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.3.10 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.1.30 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.1.29 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.3.9 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.1.28 lib/fog/volume/openstack/v2/models/volume.rb
fog-openstack-0.3.8 lib/fog/volume/openstack/v2/models/volume.rb