class Fog::Compute::Proxmox::Real

Real class

class Real #action_server request

class Real #clone_server request

class Real #create_backup request

class Real #create_server request

class Real #create_snapshot request

class Real #create_spice request

class Real #create_term request

class Real #create_vnc request

class Real #delete_server request

class Real #delete_snapshot request

class Real #delete_volume request

class Real #get_node_statistics request

class Real #get_server_config request

class Real #get_server_status request

class Real #get_snapshot_config request

class Real #get_task collection

class Real #get_vnc request

class Real #get_volume request

class Real #list_nodes request

class Real #list_servers request

class Real #list_snapshots request

class Real #list_storages request

class Real #list_tasks request

class Real #list_volumes request

class Real #log_task

class Real #migrate_server request

class Real #move_disk request

class Real #move_volume request

class Real #next_vmid collection

class Real #resize_container request

class Real #resize_server request

class Real #rollback_snapshot request

class Real #status_task

class Real #stop_task collection

class Real #template_server request

class Real #update_server request

class Real #update_snapshot request

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/compute/proxmox.rb, line 113
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

action_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/action_server.rb, line 24
def action_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  action = path_params[:action]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/status/#{action}",
    body: URI.encode_www_form(body_params)
  )
end
clone_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/clone_server.rb, line 24
def clone_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/clone",
    body: URI.encode_www_form(body_params)
  )
end
create_backup(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_backup.rb, line 24
def create_backup(path_params, body_params)
  node = path_params[:node]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/vzdump",
    body: URI.encode_www_form(body_params)
  )
end
create_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_server.rb, line 24
def create_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}",
    body: URI.encode_www_form(body_params)
  )
end
create_snapshot(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_snapshot.rb, line 24
def create_snapshot(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot",
    body: URI.encode_www_form(body_params)
  )
end
create_spice(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_spice.rb, line 24
def create_spice(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/spiceproxy",
    body: URI.encode_www_form(body_params)
  )
end
create_term(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_term.rb, line 24
def create_term(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/termproxy",
    body: URI.encode_www_form(body_params)
  )
end
create_vnc(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/create_vnc.rb, line 24
def create_vnc(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/vncproxy",
    body: URI.encode_www_form(body_params)
  )
end
delete_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/delete_server.rb, line 25
def delete_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'DELETE',
    path: "nodes/#{node}/#{type}/#{vmid}",
    body: URI.encode_www_form(body_params)
  )
end
delete_snapshot(path_params, query_params) click to toggle source
# File lib/fog/compute/proxmox/requests/delete_snapshot.rb, line 24
def delete_snapshot(path_params, query_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  snapname = path_params[:snapname]
  request(
    expects: [200],
    method: 'DELETE',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot/#{snapname}",
    query: URI.encode_www_form(query_params)
  )
end
delete_volume(node, storage, volume) click to toggle source
# File lib/fog/compute/proxmox/requests/delete_volume.rb, line 24
def delete_volume(node, storage, volume)
  request(
    expects: [200],
    method: 'DELETE',
    path: "nodes/#{node}/storage/#{storage}/content/#{volume}"
  )
end
get_node_statistics(path_params,query_params) click to toggle source
# File lib/fog/compute/proxmox/requests/get_node_statistics.rb, line 25
def get_node_statistics(path_params,query_params)
  node = path_params[:node]
  output = path_params[:output]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{output}",
    query: URI.encode_www_form(query_params)
  )
end
get_server_config(path_params) click to toggle source
# File lib/fog/compute/proxmox/requests/get_server_config.rb, line 24
def get_server_config(path_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{type}/#{vmid}/config"
  )
end
get_server_status(path_params) click to toggle source
# File lib/fog/compute/proxmox/requests/get_server_status.rb, line 24
def get_server_status(path_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{type}/#{vmid}/status/current"
  )
end
get_snapshot_config(path_params) click to toggle source
# File lib/fog/compute/proxmox/requests/get_snapshot_config.rb, line 24
def get_snapshot_config(path_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  snapname = path_params[:snapname]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot/#{snapname}/config"
  )
end
get_task(node, upid) click to toggle source
# File lib/fog/compute/proxmox/requests/get_task.rb, line 25
def get_task(node, upid)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/tasks/#{upid}"
  )
end
get_vnc(path_params, query_params) click to toggle source
# File lib/fog/compute/proxmox/requests/get_vnc.rb, line 24
def get_vnc(path_params, query_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [101, 200],
    method: 'GET',
    path: "nodes/#{node}/#{type}/#{vmid}/vncwebsocket",
    query: URI.encode_www_form(query_params)
  )
end
get_volume(node, storage, volume) click to toggle source
# File lib/fog/compute/proxmox/requests/get_volume.rb, line 26
def get_volume(node, storage, volume)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/storage/#{storage}/content/#{volume}"
  )
end
list_nodes() click to toggle source
# File lib/fog/compute/proxmox/requests/list_nodes.rb, line 25
def list_nodes
  request(
    expects: [200],
    method: 'GET',
    path: 'nodes'
  )
end
list_servers(options) click to toggle source
# File lib/fog/compute/proxmox/requests/list_servers.rb, line 24
def list_servers(options)
  node = options[:node]
  type = options[:type]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{type}"
  )
end
list_snapshots(path_params) click to toggle source
# File lib/fog/compute/proxmox/requests/list_snapshots.rb, line 24
def list_snapshots(path_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot"
  )
end
list_storages(node, options = {}) click to toggle source
# File lib/fog/compute/proxmox/requests/list_storages.rb, line 27
def list_storages(node, options = {})
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/storage",
    query: URI.encode_www_form(options)
  )
end
list_tasks(node, options) click to toggle source
# File lib/fog/compute/proxmox/requests/list_tasks.rb, line 25
def list_tasks(node, options)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/tasks",
    query: URI.encode_www_form(options)
  )
end
list_volumes(node, storage, options) click to toggle source
# File lib/fog/compute/proxmox/requests/list_volumes.rb, line 25
def list_volumes(node, storage, options)
  request(
    expects: [200],
    method: 'GET',
    path: "/nodes/#{node}/storage/#{storage}/content",
    query: URI.encode_www_form(options)
  )
end
log_task(node, upid, options) click to toggle source
# File lib/fog/compute/proxmox/requests/log_task.rb, line 25
def log_task(node, upid, options)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/tasks/#{upid}/log",
    query: URI.encode_www_form(options)
  )
end
migrate_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/migrate_server.rb, line 24
def migrate_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/migrate",
    body: URI.encode_www_form(body_params)
  )
end
move_disk(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/move_disk.rb, line 24
def move_disk(path_params, body_params)
  node = path_params[:node]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/qemu/#{vmid}/move_disk",
    body: URI.encode_www_form(body_params)
  )
end
move_volume(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/move_volume.rb, line 24
def move_volume(path_params, body_params)
  node = path_params[:node]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/lxc/#{vmid}/move_volume",
    body: URI.encode_www_form(body_params)
  )
end
next_vmid(options = {}) click to toggle source
# File lib/fog/compute/proxmox/requests/next_vmid.rb, line 25
def next_vmid(options = {})
  request(
    expects: [200],
    method: 'GET',
    path: 'cluster/nextid',
    query: URI.encode_www_form(options)
  )
end
resize_container(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/resize_container.rb, line 24
def resize_container(path_params, body_params)
  node = path_params[:node]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'PUT',
    path: "nodes/#{node}/lxc/#{vmid}/resize",
    body: URI.encode_www_form(body_params)
  )
end
resize_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/resize_server.rb, line 24
def resize_server(path_params, body_params)
  node = path_params[:node]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'PUT',
    path: "nodes/#{node}/qemu/#{vmid}/resize",
    body: URI.encode_www_form(body_params)
  )
end
rollback_snapshot(path_params) click to toggle source
# File lib/fog/compute/proxmox/requests/rollback_snapshot.rb, line 26
def rollback_snapshot(path_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  snapname = path_params[:snapname]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot/#{snapname}/rollback"
  )
end
status_task(node, upid) click to toggle source
# File lib/fog/compute/proxmox/requests/status_task.rb, line 25
def status_task(node, upid)
  request(
    expects: [200],
    method: 'GET',
    path: "nodes/#{node}/tasks/#{upid}/status"
  )
end
stop_task(node, upid) click to toggle source
# File lib/fog/compute/proxmox/requests/stop_task.rb, line 25
def stop_task(node, upid)
  request(
    expects: [200],
    method: 'DELETE',
    path: "nodes/#{node}/tasks/#{upid}"
  )
end
template_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/template_server.rb, line 24
def template_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: 'POST',
    path: "nodes/#{node}/#{type}/#{vmid}/template",
    body: URI.encode_www_form(body_params)
  )
end
update_server(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/update_server.rb, line 24
def update_server(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  request(
    expects: [200],
    method: type == 'qemu' ? 'POST' : 'PUT',
    path: "nodes/#{node}/#{type}/#{vmid}/config",
    body: URI.encode_www_form(body_params)
  )
end
update_snapshot(path_params, body_params) click to toggle source
# File lib/fog/compute/proxmox/requests/update_snapshot.rb, line 24
def update_snapshot(path_params, body_params)
  node = path_params[:node]
  type = path_params[:type]
  vmid = path_params[:vmid]
  snapname = path_params[:snapname]
  request(
    expects: [200],
    method: 'PUT',
    path: "nodes/#{node}/#{type}/#{vmid}/snapshot/#{snapname}/config",
    body: URI.encode_www_form(body_params)
  )
end