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

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

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

#allObject



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

def all
  load(service.list_nodes.body['nodes'])
end

#destroy(uuid) ⇒ Object



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

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

#details(parameters = nil) ⇒ Object



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

def details(parameters=nil)
  load(service.list_nodes_detailed(parameters).body['nodes'])
end

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



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

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