Class: Fog::Vsphere::Compute::Hosts

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/vsphere/models/compute/hosts.rb

Instance Method Summary collapse

Instance Method Details

#all(_filters = {}) ⇒ Object



10
11
12
13
# File 'lib/fog/vsphere/models/compute/hosts.rb', line 10

def all(_filters = {})
  requires :datacenter, :cluster
  load service.list_hosts(datacenter: datacenter, cluster: cluster)
end

#get(name) ⇒ Object



15
16
17
18
# File 'lib/fog/vsphere/models/compute/hosts.rb', line 15

def get(name)
  all.find { |host| host.name == name } ||
    raise(Fog::Vsphere::Compute::NotFound, "no such host #{name}")
end