Sha256: 1e89d9cc79ec091898db7a67d0bccb0a1c32180297a960421d57eeae0b08f394

Contents?: true

Size: 1.26 KB

Versions: 23

Compression:

Stored size: 1.26 KB

Contents

module Fog
  module Vsphere
    class Compute
      class Host < Fog::Model
        identity :name

        attribute :datacenter
        attribute :cluster
        attribute :cpu_cores
        attribute :cpu_sockets
        attribute :cpu_threads
        attribute :cpu_hz
        attribute :memory
        attribute :uuid
        attribute :ipaddress
        attribute :ipaddress6
        attribute :model
        attribute :vendor
        attribute :product_name
        attribute :product_version
        attribute :hostname
        attribute :domainname

        # Lazy Loaded Attributes
        [:vm_ids].each do |attr|
          define_method attr do
            attributes[attr] = attributes[attr].call if attributes[attr].is_a?(Proc)
            attributes[attr]
          end
        end
        # End Lazy Loaded Attributes

        def to_s
          name
        end

        def memory_mb
          memory / 1024 / 1024
        end

        def shutdown
          service.host_shutdown(name, cluster, datacenter)
        end

        def start_maintenance
          service.host_start_maintenance(name, cluster, datacenter)
        end

        def finish_maintenance
          service.host_finish_maintenance(name, cluster, datacenter)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.7.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.8 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.7 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.6 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.5 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.4 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.3 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.2 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.5.3 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.6.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.5.2 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.5.1 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.5.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.4.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.3.1 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.3.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.2.5 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.2.2 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.2.1 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-3.2.0 lib/fog/vsphere/models/compute/host.rb