Class: Fog::Network::Proxmox::Nodes

Inherits:
Proxmox::Collection show all
Defined in:
lib/fog/network/proxmox/models/nodes.rb

Overview

class Nodes Collection of nodes of cluster

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

#clear_ignored_attributes, #create, #destroy, #get, #load_response, #not_implemented, #read, #summary

Instance Method Details

#all(_options = {}) ⇒ Object


30
31
32
# File 'lib/fog/network/proxmox/models/nodes.rb', line 30

def all(_options = {})
  load_response(service.list_nodes, 'nodes')
end

#find_by_id(id) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/fog/network/proxmox/models/nodes.rb', line 34

def find_by_id(id)
  cached_node = find { |node| node.node == id }
  return cached_node if cached_node
  node_hash = service.get_node(id)
  Fog::Network::Proxmox::Node.new(
    node_hash.merge(service: service, node: id)
  )
end