forked from kaliro/pvea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
64 lines (48 loc) · 1.24 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// pvea example file
const pveajs = require('./lib/pvea.js');
// format: domain, username@authtype, password.
// example: proxmox.example.org, admin@pve, hunter2.
const pvea = new pveajs('xxx', 'xxx@pve', 'xxx')
async function main() {
pvea.getVersion().then( res => {
console.log(res)
})
pvea.getNodes().then( res => {
console.log(res)
})
pvea.getNodeVersion('xxx').then( res => {
console.log(res)
})
pvea.getNodeTime('xxx').then( res => {
console.log(res)
})
pvea.getNodeLog('xxx', { limit: '3', since: '2020-07-07' }).then( res => {
console.log(res)
})
pvea.getNodeTasks('xxx', { limit: '3', vmid: '106' }).then( res => {
console.log(res)
})
pvea.getNodeStatus('xxx').then( res => {
console.log(res)
})
pvea.getNodeSubscription('xxx').then( res => {
console.log(res)
})
pvea.getNodeReport('xxx').then( res => {
console.log(res)
})
pvea.getNodeNetstat('xxx').then( res => {
console.log(res)
})
pvea.createLxcContainer(node, {
vmid: 107,
hostname: 'test',
password: 'secret',
ostemplate: 'storage:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz',
memory: 512,
swap: 512,
storage: 'containers'
})
// more examples to come
}
pvea.run(main)