Class: Fog::Proxmox::Network::Real
- Inherits:
-
Object
- Object
- Fog::Proxmox::Network::Real
show all
- Includes:
- Core
- Defined in:
- lib/fog/network/proxmox.rb,
lib/fog/network/proxmox/requests/get_node.rb,
lib/fog/network/proxmox/requests/list_nodes.rb,
lib/fog/network/proxmox/requests/power_node.rb,
lib/fog/network/proxmox/requests/get_network.rb,
lib/fog/network/proxmox/requests/list_networks.rb,
lib/fog/network/proxmox/requests/create_network.rb,
lib/fog/network/proxmox/requests/delete_network.rb,
lib/fog/network/proxmox/requests/update_network.rb
Overview
class Real update_network request
Instance Attribute Summary
Attributes included from Core
#deadline, #principal, #pve_csrftoken, #pve_ticket, #pve_username
Instance Method Summary
collapse
Methods included from Core
#credentials, #initialize_identity, not_found_class, #reload
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
61
62
63
64
65
66
67
68
69
|
# File 'lib/fog/network/proxmox.rb', line 61
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
|
Instance Method Details
#config ⇒ Object
71
72
73
|
# File 'lib/fog/network/proxmox.rb', line 71
def config
self
end
|
75
76
77
78
79
|
# File 'lib/fog/network/proxmox.rb', line 75
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) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/fog/network/proxmox/requests/create_network.rb', line 25
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) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/network/proxmox/requests/delete_network.rb', line 26
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) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/network/proxmox/requests/get_network.rb', line 26
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) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/fog/network/proxmox/requests/get_node.rb', line 26
def get_node(node)
request(
expects: [200],
method: 'GET',
path: "nodes/#{node}/status"
)
end
|
#list_networks(path_params, query_params) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/network/proxmox/requests/list_networks.rb', line 26
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 ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/fog/network/proxmox/requests/list_nodes.rb', line 26
def list_nodes
request(
expects: [200],
method: 'GET',
path: 'cluster/resources',
query: 'type=node'
)
end
|
#power_node(path_params, body_params) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/network/proxmox/requests/power_node.rb', line 26
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) ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/network/proxmox/requests/update_network.rb', line 25
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
|