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

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

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#destroy, #find_by_id, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



10
11
12
13
# File 'lib/fog/compute/openstack/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/compute/openstack/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::Compute::OpenStack::NotFound
  nil
end