Sha256: b7393d9edd06a5987df1ca1214ffcc0b823d2f74e8a7cc2748bfcd32623c83ef

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

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

        attribute :datacenter
        attribute :cluster
        attribute :cpu_cores
        attribute :cpu_sockets
        attribute :cpu_threads
        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

8 entries across 6 versions & 2 rubygems

Version Path
fog-vsphere-2.4.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-2.3.0 lib/fog/vsphere/models/compute/host.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/host.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/host.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/host.rb
fog-vsphere-2.2.0 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-2.1.1 lib/fog/vsphere/models/compute/host.rb
fog-vsphere-2.1.0 lib/fog/vsphere/models/compute/host.rb