Class: Fog::Compute::OpenStack::Hosts

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

Instance Method Summary collapse

Instance Method Details

#allObject



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

def all
  data = service.list_hosts.body['hosts']
  load(data)
end

#get(host_name) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/openstack/models/compute/hosts.rb', line 15

def get(host_name)
  if host = service.get_host_details(host_name).body['host']
    new({
      'host_name' => host_name,
      'details' => host}
    )
  end
rescue Fog::Compute::OpenStack::NotFound
  nil
end