class Fog::Proxmox::Network::Real

Real class

class Real #create_network request

class Real #delete_network request

class Real #get_node request

class Real #get_node request

class Real #list_networks request

class Real #list_nodes request

class Real #power_node request

class Real #update_network request

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/network/proxmox.rb, line 60
def initialize(options = {})
  initialize_identity(options)
  @connection_options = options[:connection_options] || {}
  @path_prefix = URI.parse(options[:pve_url]).path
  authenticate
  @persistent = options[:persistent] || false
  url = "#{@scheme}://#{@host}:#{@port}"
  @connection = Fog::Core::Connection.new(url, @persistent, @connection_options.merge(path_prefix: @path_prefix))
end

Public Instance Methods

config() click to toggle source
# File lib/fog/network/proxmox.rb, line 70
def config
  self
end
configure(source) click to toggle source
# File lib/fog/network/proxmox.rb, line 74
def configure(source)
  source.instance_variables.each do |v|
    instance_variable_set(v, source.instance_variable_get(v))
  end
end
create_network(path_params, body_params) click to toggle source
# File lib/fog/network/proxmox/requests/create_network.rb, line 24
def create_network(path_params, body_params)
  node = path_params[:node]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/network",
    body: URI.encode_www_form(body_params)
  )
end
delete_network(path_params) click to toggle source
# File lib/fog/network/proxmox/requests/delete_network.rb, line 25
def delete_network(path_params)
  node = path_params[:node]
  iface = path_params[:iface]
  request(
    expects: [200],
    method: 'DELETE',
    path: "nodes/#{node}/network/#{iface}"
  )
end
get_network(path_params) click to toggle source
# File lib/fog/network/proxmox/requests/get_network.rb, line 25
def get_network(path_params)
  node = path_params[:node]
  iface = path_params[:iface]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/network/#{iface}"
  )
end
get_node(node) click to toggle source
# File lib/fog/network/proxmox/requests/get_node.rb, line 25
def get_node(node)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/status"
  )
end
list_networks(path_params, query_params) click to toggle source
# File lib/fog/network/proxmox/requests/list_networks.rb, line 25
def list_networks(path_params, query_params)
  node = path_params[:node]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/network",
    query: URI.encode_www_form(query_params)
  )
end
list_nodes() click to toggle source
# File lib/fog/network/proxmox/requests/list_nodes.rb, line 25
def list_nodes
  request(
    expects: [200],
    method: 'GET',
    path: 'cluster/resources',
    query: 'type=node'
  )
end
power_node(path_params, body_params) click to toggle source
# File lib/fog/network/proxmox/requests/power_node.rb, line 25
def power_node(path_params, body_params)
  node = path_params[:node]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/status",
    body: URI.encode_www_form(body_params)
  )
end
update_network(path_params, body_params) click to toggle source
# File lib/fog/network/proxmox/requests/update_network.rb, line 24
def update_network(path_params, body_params)
  node = path_params[:node]
  iface = path_params[:iface]
  request(
    expects: [200],
    method: 'PUT',
    path: "nodes/#{node}/network/#{iface}",
    body: URI.encode_www_form(body_params)
  )
end