Skip to content

Commit

Permalink
Add node area full
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKampf committed Feb 24, 2020
1 parent 3539a92 commit 8ad1bf7
Show file tree
Hide file tree
Showing 56 changed files with 3,575 additions and 1,057 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/vendor/
/.idea/
.gitignore
/.idea/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Proxmox VE API",
"type": "library",
"keywords": ["Proxmox", "API", "KVM", "OpenVZ", "Virtualization", "PHP"],
"version": "0.1.6",
"version": "0.2.0",
"minimum-stability": "dev",
"prefer-stable": true,
"authors": [
Expand Down
319 changes: 6 additions & 313 deletions src/proxmox/api/nodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
namespace proxmox\api;

use GuzzleHttp\Client;
use proxmox\api\nodes\apt;
use proxmox\api\nodes\ceph;
use proxmox\api\nodes\certificates;
use proxmox\api\nodes\disks;
use proxmox\api\nodes\lxc;
use proxmox\api\nodes\qemu;
use proxmox\api\nodes\node;
use proxmox\helper\connection;

//TODO//Fill the rest comments
/**
* Class nodes
* @package proxmox\api
Expand Down Expand Up @@ -41,65 +35,14 @@ public function __construct($httpClient,$apiURL,$ticket,$hostname){
$this->cookie = connection::getCookies($this->ticket,$this->hostname); //Get auth cookie and save in class variable
}

/**
* Directory index for apt (Advanced Package Tool).
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/apt
* @param $node
* @return apt
*/
public function apt($node){
return new apt($this->httpClient,$this->apiURL.$node.'/apt/',$this->cookie);
}

/**
* Directory index.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/ceph
* @param $node
* @return ceph
*/
public function ceph($node){
return new ceph($this->httpClient,$this->apiURL.$node.'/ceph/',$this->cookie);
}

/**
* Node index.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/certificates
* @param $node
* @return certificates
*/
public function certificates($node){
return new certificates($this->httpClient,$this->apiURL.$node.'/certificates/',$this->cookie);
}

/**
* Node index.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/disks
* @param $node
* @return disks
*/
public function disks($node){
return new disks($this->httpClient,$this->apiURL.$node.'/disks/',$this->cookie);
}

/**
* LXC container index (per node).
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/lxc
* @param $node integer Node name
* @param $vmid integer VMID (unique) ID of the vm
* @return lxc
*/
public function lxc($node,$vmid){
return new lxc($this->httpClient,$this->apiURL.$node.'/',$this->cookie,$vmid);
}

/**
* Virtual machine index (per node).
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu
* @param $node
* @return qemu
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}
* @param $node string
* @return node
*/
public function qemu($node){
return new qemu($this->httpClient,$this->apiURL.$node.'/',$this->cookie);
public function node($node){
return new node($this->httpClient,$this->apiURL.$node.'/',$this->cookie);
}

/**
Expand All @@ -114,254 +57,4 @@ public function qemu($node){
public function get(){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL,$this->cookie));
}

//TODO//Delete on version 2.0.0<
/**
* Read node status
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/status
* @param $node
* @return mixed
*/
public function getNode($node){
return $this->getStatus($node);
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/lxc
* @param $node
* @return mixed
*/
public function getLxc($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/lxc',$this->cookie));
}

/**
* Get list of appliances.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/aplinfo
* @param $node
* @return mixed
*/
public function getAplinfo($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/aplinfo',$this->cookie));
}

/**
* Get node configuration options.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/config
* @param $node
* @return mixed
*/
public function getConfig($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/config',$this->cookie));
}

/**
* Read DNS settings.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/dns
* @param $node
* @return mixed
*/
public function getDNS($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/dns',$this->cookie));
}

/**
* Get the content of /etc/hosts.
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/hosts
* @param $node
* @return mixed
*/
public function getHosts($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/hosts',$this->cookie));
}

/**
* Read Journal
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/journal
* @param $node
* @param $param
* @return mixed
*/
public function getJournal($node,$param){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/journal',$this->cookie,$param));
}

/**
* Read tap/vm network device interface counters
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/netstat
* @param $node
* @return mixed
*/
public function getNetstat($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/netstat',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/report
* @param $node
* @return mixed
*/
public function getReport($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/report',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/rrd
* @param $node
* @return mixed
*/
public function getRrd($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/rrd',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/rrddata
* @param $node
* @param $param
* @return mixed
*/
public function getRrddata($node,$param){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/rrddata',$this->cookie,$param));
}

/**
* Read node status
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/status
* @param $node
* @return mixed
*/
public function getStatus($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/status',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/subscription
* @param $node
* @return mixed
*/
public function getSubscription($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/subscription',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/syslog
* @param $node
* @param $param
* @return mixed
*/
public function getSyslog($node,$param){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/syslog',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/time
* @param $node
* @return mixed
*/
public function getTime($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/time',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/version
* @param $node
* @return mixed
*/
public function getVersion($node){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/version',$this->cookie));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/vncwebsocket
* @param $node
* @param $param
* @return mixed
*/
public function getVncwebsocket($node,$param){
return connection::processHttpResponse(connection::getAPI($this->httpClient,$this->apiURL.$node.'/vncwebsocket',$this->cookie,$param));
}

/**
* POST
*/

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/dns
* @param $node
* @param $commands
* @return mixed
*/
public function postExecute($node,$commands){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/execute',$this->cookie,[
'commands' => $commands]));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/migrateall
* @param $node
* @param $param
* @return mixed
*/
public function postMigrateall($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/migrateall',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/spiceshell
* @param $node
* @param $param
* @return mixed
*/
public function postSpiceshell($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/spiceshell',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/startall
* @param $node
* @param $param
* @return mixed
*/
public function postStartall($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/startall',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/stopall
* @param $node
* @param $param
* @return mixed
*/
public function postStopall($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/stopall',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/termproxy
* @param $node
* @param $param
* @return mixed
*/
public function postTermproxy($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/termproxy',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/vncshell
* @param $node
* @param $param
* @return mixed
*/
public function postVncshell($node,$param){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/vncshell',$this->cookie,$param));
}

/**
* @url https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/wakeonlan
* @param $node
* @return mixed
*/
public function postWakeonlan($node){
return connection::processHttpResponse(connection::postAPI($this->httpClient,$this->apiURL.$node.'/wakeonlan',$this->cookie));
}
}
Loading

0 comments on commit 8ad1bf7

Please sign in to comment.