Sha256: 71a0fae86ebb620a06357b33308539c4691d4f69ae042a53161cf272928cc2fb

Contents?: true

Size: 1.32 KB

Versions: 17

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Compute
    class Ovirt
      class Template < Fog::Model
        identity :id

        attr_accessor :raw

        attribute :name
        attribute :description
        attribute :profile
        attribute :display
        attribute :storage,       :aliases => 'disk_size'
        attribute :creation_time
        attribute :os
        attribute :status
        attribute :cores,         :aliases => 'cpus'
        attribute :memory
        attribute :cluster
        attribute :interfaces
        attribute :volumes

        def interfaces
          attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
              :service => service,
              :vm => self
          )
        end

        def volumes
          attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
              :service => service,
              :vm => self
          )
        end

        def ready?
          !(status =~ /down/i)
        end

        def destroy(options = {})
          service.client.destroy_template(id)
        end

        def save
          raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
          service.client.create_template(attributes)
        end

        def to_s
          name
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ovirt/models/compute/template.rb
fog-1.27.0 lib/fog/ovirt/models/compute/template.rb
fog-1.26.0 lib/fog/ovirt/models/compute/template.rb
fog-1.25.0 lib/fog/ovirt/models/compute/template.rb
nsidc-fog-1.24.1 lib/fog/ovirt/models/compute/template.rb
fog-1.24.0 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.11 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.10 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.9 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.8 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.7 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.6 lib/fog/ovirt/models/compute/template.rb
fog-1.23.0 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.4 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.3 lib/fog/ovirt/models/compute/template.rb
ns-fog-1.22.2 lib/fog/ovirt/models/compute/template.rb
fog-1.22.1 lib/fog/ovirt/models/compute/template.rb