Sha256: efeb75b682d13a0e7f6aa9129142221fba54a33c5feb343b62e2af6d2374ff0e

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'fog/openstack/models/volume/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
                     service.update_volume(id, attributes.reject { |k, _v| k == :id })
                   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

5 entries across 5 versions & 1 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/volume_v1/volume.rb
fog-openstack-0.1.9 lib/fog/openstack/models/volume_v1/volume.rb
fog-openstack-0.1.8 lib/fog/openstack/models/volume_v1/volume.rb
fog-openstack-0.1.7 lib/fog/openstack/models/volume_v1/volume.rb
fog-openstack-0.1.6 lib/fog/openstack/models/volume_v1/volume.rb