Sha256: 6af6aa3004944278e84d00729278716ca770ed1825de7fffd474049724742356

Contents?: true

Size: 1.62 KB

Versions: 51

Compression:

Stored size: 1.62 KB

Contents

require 'fog/cloudsigma/nested_model'

module Fog
  module Compute
    class CloudSigma
      class Volume < Fog::CloudSigma::CloudsigmaModel
        identity :uuid

        attribute :status, :type => :string
        attribute :jobs
        attribute :name, :type => :string
        attribute :tags
        attribute :media, :type => :string
        attribute :mounted_on
        attribute :owner
        attribute :meta
        attribute :allow_multimount, :type => :boolean
        attribute :licenses
        attribute :affinities, :type => :array
        attribute :size, :type => :integer
        attribute :resource_uri, :type => :string


        def save
          if persisted?
            update
          else
            create
          end
        end

        def create
          requires :name, :size, :media
          data = attributes

          response = service.create_volume(data)
          new_attributes = response.body['objects'].first
          merge_attributes(new_attributes)
        end

        def update
          requires :identity, :name, :size, :media

          data = attributes()

          response = service.update_volume(identity, data)
          new_attributes = response.body
          merge_attributes(new_attributes)

        end

        def destroy
          requires :identity

          service.delete_volume(identity)

          true
        end

        alias :delete :destroy

        def clone(clone_params={})
          requires :identity
          response = service.clone_volume(identity, clone_params)

          self.class.new(response.body['objects'].first)
        end
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/cloudsigma/models/volume.rb
fog-1.20.0 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/cloudsigma/models/volume.rb
fog-1.19.0 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/cloudsigma/models/volume.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/cloudsigma/models/volume.rb