Class: Fog::Network::Proxmox::Networks

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

Overview

class Networks 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


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

def all(options = {})
  requires :node
  path_params = { node: node }
  query_params = options
  load_response(service.list_networks(path_params, query_params), 'networks')
end

#find_by_id(id) ⇒ Object


43
44
45
46
47
48
49
50
# File 'lib/fog/network/proxmox/models/networks.rb', line 43

def find_by_id(id)
  cached_network = find { |network| network.iface == id }
  return cached_network if cached_network
  network_hash = service.get_network(id)
  Fog::Network::Proxmox::Network.new(
    network_hash.merge(service: service, node: node, iface: id)
  )
end

#new(attributes = {}) ⇒ Object


31
32
33
34
# File 'lib/fog/network/proxmox/models/networks.rb', line 31

def new(attributes = {})
  requires :node
  super({ node: node }.merge(attributes))
end