add disk create endpoint
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
5f1cf088a0
commit
ab235fe581
15
index.js
15
index.js
@ -108,6 +108,21 @@ app.post("/api/disk/delete", async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post("/api/disk/create", async (req, res) => {
|
||||||
|
let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`;
|
||||||
|
|
||||||
|
let auth = await checkAuth(req.cookies, vmpath);
|
||||||
|
if (auth) {
|
||||||
|
let method = req.body.type === "qemu" ? "POST" : "PUT";
|
||||||
|
let result = await requestPVE(`${vmpath}/config`, method, req.cookies, req.body.action, pveAPIToken);
|
||||||
|
result = await handleResponse(req.body.node, result);
|
||||||
|
res.send({auth: auth, status: result.status, data: result.data.data});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.send({auth: auth});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.post("/api/resources", async (req, res) => {
|
app.post("/api/resources", async (req, res) => {
|
||||||
let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`;
|
let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user