Sha256: a3140c54f3bf43122f3924d464b4a64daedfab1418f1ff0e9e131b869e3a7547

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

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

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

          superclass.attributes.each { |attrib| attribute attrib }
          attribute :display_name, :aliases => 'displayName'
          attribute :display_description, :aliases => 'displayDescription'
          attribute :tenant_id, :aliases => 'os-vol-tenant-attr:tenant_id'

          def save
            requires :display_name, :size
            data = if id.nil?
                     service.create_volume(display_name, display_description, size, attributes)
                   else
                     attrib = attributes.select { |key| %i(display_name display_description metadata).include?(key) }
                     service.update_volume(id, attrib)
                   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/v1/models/volume.rb
fog-openstack-0.3.10 lib/fog/volume/openstack/v1/models/volume.rb
fog-openstack-0.1.30 lib/fog/volume/openstack/v1/models/volume.rb
fog-openstack-0.1.29 lib/fog/volume/openstack/v1/models/volume.rb
fog-openstack-0.3.9 lib/fog/volume/openstack/v1/models/volume.rb
fog-openstack-0.1.28 lib/fog/volume/openstack/v1/models/volume.rb
fog-openstack-0.3.8 lib/fog/volume/openstack/v1/models/volume.rb