Class: Fog::Baremetal::OpenStack::Nodes

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/openstack/models/baremetal/nodes.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#load_response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 34

def method_missing(method_sym, *arguments, &block)
  if method_sym.to_s =~ /^find_by_(.*)$/
    load(service.list_nodes_detailed({$1 => arguments.first}).body['nodes'])
  else
    super
  end
end

Instance Method Details

#all(options = {}) ⇒ Object



10
11
12
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 10

def all(options = {})
  load_response(service.list_nodes_detailed(options), 'nodes')
end

#destroy(uuid) ⇒ Object



29
30
31
32
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 29

def destroy(uuid)
  node = self.find_by_uuid(uuid)
  node.destroy
end

#details(options = {}) ⇒ Object



18
19
20
21
22
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 18

def details(options = {})
  Fog::Logger.deprecation("Calling OpenStack[:baremetal].nodes.details will be removed, "\
                          " call .nodes.all for detailed list.")
  load(service.list_nodes_detailed(options).body['nodes'])
end

#find_by_uuid(uuid) ⇒ Object Also known as: get



24
25
26
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 24

def find_by_uuid(uuid)
  new(service.get_node(uuid).body)
end

#summary(options = {}) ⇒ Object



14
15
16
# File 'lib/fog/openstack/models/baremetal/nodes.rb', line 14

def summary(options = {})
  load_response(service.list_nodes(options), 'nodes')
end