Skip to content

Commit

Permalink
Merge pull request #35 from UrielCh/issue34
Browse files Browse the repository at this point in the history
fix Issue 34
  • Loading branch information
UrielCh authored Sep 11, 2024
2 parents 768a9a0 + d221d83 commit eda9291
Show file tree
Hide file tree
Showing 12 changed files with 3,351 additions and 1,549 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ api/dist/
auth.ts
api/pnpm-lock.yaml
api/esm/*.d.ts
api/.vscode/launch.json
api/cjs/package-lock.json
api/esm/package-lock.json
38 changes: 32 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "test",
"skipFiles": [
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/generator",
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/api/src/main.test.ts"]
},

{
"type": "node",
"request": "launch",
Expand All @@ -12,7 +26,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/generator",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/generator/src/gen.ts"]
},
{
Expand All @@ -23,7 +39,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/sample",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/sample/src/sample.ts"]
},
{
Expand All @@ -34,7 +52,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/sample",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/sample/src/sample2.ts"]
},

Expand All @@ -46,7 +66,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/sample",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/sample/src/sample-connect-kvm.ts"]
},

Expand All @@ -58,7 +80,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/proxmox-usb-hotplug",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/proxmox-usb-hotplug/src/proxmox-usb-hotplug.ts", "--help"],
// "args": ["${workspaceFolder}/proxmox-usb-hotplug/src/index.ts", "-c", "../../auth.conf", "byVendor"],
},
Expand All @@ -71,7 +95,9 @@
"<node_internals>/**"
],
"cwd": "${workspaceFolder}/proxmox-usb-hotplug",
"runtimeArgs": ["-r", "ts-node/register"],
// "runtimeArgs": ["-r", "ts-node/register"],
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"args": ["${workspaceFolder}/proxmox-usb-hotplug/src/proxmox-usb-hotplug.ts", "-c", "/etc/usb-hotplug.conf"],
}

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ that it.

### Example

To call `GET /cluster/acme/account/{name}` you will call `promox.cluster.acme.account.$(name).$get()`
To call `GET /cluster/acme/account/{name}` you will call `proxmox.cluster.acme.account.$(name).$get()`

To call `GET /api2/json/cluster/backup/{id}/included_volumes` you will call `promox.cluster.backup.{id}.included_volumes.$get()`
To call `GET /api2/json/cluster/backup/{id}/included_volumes` you will call `proxmox.cluster.backup.{id}.included_volumes.$get()`

To call `GET /api2/json/nodes` you will call `promox.nodes.$get()`
To call `GET /api2/json/nodes` you will call `proxmox.nodes.$get()`

The provided typing will assist you within intelisense, so you do not need to read any external doc.

Expand All @@ -48,12 +48,12 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

async function test() {
// connect to proxmox
const promox = proxmoxApi({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
const proxmox = proxmoxApi({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
// list nodes
const nodes = await promox.nodes.$get();
const nodes = await proxmox.nodes.$get();
// iterate cluster nodes
for (const node of nodes) {
const theNode = promox.nodes.$(node.node);
const theNode = proxmox.nodes.$(node.node);
// list Qemu VMS
const qemus = await theNode.qemu.$get({full:true});
// iterate Qemu VMS
Expand Down Expand Up @@ -84,7 +84,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
async function test() {
// connect to proxmox
const engine = new ProxmoxEngine({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
const promox = proxmoxApi(engine);
const proxmox = proxmoxApi(engine);
}
```

Expand All @@ -98,7 +98,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

async function test() {
// connect to proxmox
const promox = proxmoxApi({host: '127.0.0.1', tokenID: 'USER@REALM!TOKENID', tokenSecret: '12345678-1234-1234-1234-1234567890ab'});
const proxmox = proxmoxApi({host: '127.0.0.1', tokenID: 'USER@REALM!TOKENID', tokenSecret: '12345678-1234-1234-1234-1234567890ab'});
}
```

Expand Down
16 changes: 8 additions & 8 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ that it.

### Example

To call `GET /cluster/acme/account/{name}` you will call `promox.cluster.acme.account.$(name).$get()`
To call `GET /cluster/acme/account/{name}` you will call `proxmox.cluster.acme.account.$(name).$get()`

To call `GET /api2/json/cluster/backup/{id}/included_volumes` you will call `promox.cluster.backup.{id}.included_volumes.$get()`
To call `GET /api2/json/cluster/backup/{id}/included_volumes` you will call `proxmox.cluster.backup.{id}.included_volumes.$get()`

To call `GET /api2/json/nodes` you will call `promox.nodes.$get()`
To call `GET /api2/json/nodes` you will call `proxmox.nodes.$get()`

The provided typing will assist you within intelisense, so you do not need to read any external doc.

Expand All @@ -48,12 +48,12 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

async function test() {
// connect to proxmox
const promox = proxmoxApi({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
const proxmox = proxmoxApi({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
// list nodes
const nodes = await promox.nodes.$get();
const nodes = await proxmox.nodes.$get();
// iterate cluster nodes
for (const node of nodes) {
const theNode = promox.nodes.$(node.node);
const theNode = proxmox.nodes.$(node.node);
// list Qemu VMS
const qemus = await theNode.qemu.$get({full:true});
// iterate Qemu VMS
Expand Down Expand Up @@ -84,7 +84,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
async function test() {
// connect to proxmox
const engine = new ProxmoxEngine({host: '127.0.0.1', password: 'password', username: 'user1@pam'});
const promox = proxmoxApi(engine);
const proxmox = proxmoxApi(engine);
}
```

Expand All @@ -98,7 +98,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

async function test() {
// connect to proxmox
const promox = proxmoxApi({host: '127.0.0.1', tokenID: 'USER@REALM!TOKENID', tokenSecret: '12345678-1234-1234-1234-1234567890ab'});
const proxmox = proxmoxApi({host: '127.0.0.1', tokenID: 'USER@REALM!TOKENID', tokenSecret: '12345678-1234-1234-1234-1234567890ab'});
}
```

Expand Down
Loading

0 comments on commit eda9291

Please sign in to comment.