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

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

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



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

def all(options = {})
  data = service.list_hosts(options)
  load_response(data, 'hosts')
end

#get(host_name) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/fog/openstack/compute/models/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::OpenStack::Compute::NotFound
  nil
end