Class: Fog::Proxmox::Network::Node

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/network/proxmox/models/node.rb

Overview

class Node model of VMs

Instance Method Summary collapse

Constructor Details

#initialize(new_attributes = {}) ⇒ Node

Returns a new instance of Node.



50
51
52
53
54
55
56
57
# File 'lib/fog/network/proxmox/models/node.rb', line 50

def initialize(new_attributes = {})
  prepare_service_value(new_attributes)
  attributes[:node] = new_attributes['node'] unless new_attributes['node'].nil?
  attributes[:node] = new_attributes[:node] unless new_attributes[:node].nil?
  requires :node
  initialize_networks
  super(new_attributes)
end

Instance Method Details

#power(action) ⇒ Object

Raises:

  • (Fog::Errors::Error)


59
60
61
62
63
64
# File 'lib/fog/network/proxmox/models/node.rb', line 59

def power(action)
  action_known = %w[reboot shutdown].include? action
  message = "Action #{action} not implemented"
  raise Fog::Errors::Error, message unless action_known
  service.power_node({ node: node }, command: action)
end