How to use getEndpoint method in chromeless

Best JavaScript code snippet using chromeless

pve-nodes-api.js

Source:pve-nodes-api.js Github

copy

Full Screen

1const { PveAuth } = require("./auth/pve-auth");2module.exports = function (uname, pwd, realm, host, verboseLevel) {3 const pveCurl = require("./pve-curl")(verboseLevel);4 const pveLog = require("./utils/logging")(verboseLevel); 5 var pveAuth = null;6 if (7 typeof uname === "undefined" ||8 uname === null ||9 typeof pwd === null ||10 pwd === null ||11 typeof realm === "undefined" ||12 realm === null ||13 typeof host === "undefined" ||14 host === null15 ) {16 pveAuth = null;17 } else {18 pveAuth = new PveAuth({19 uname: uname,20 pwd: pwd,21 realm: realm,22 host: host,23 verboseLevel: verboseLevel,24 }); 25 }26 let Module = {27 SetSslVerifyPeer: (sslVerifyPeer) => {28 pveLog.Info(`SSL Verify Peer set to ${sslVerifyPeer}`);29 pveCurl.PveCurl.SetSslVerifyPeer(sslVerifyPeer);30 },31 SetSslVerifyHost: (sslVerifyHost) => {32 logging.Info(`SSL Verify Host set to ${sslVerifyHost}`);33 pveCurl.PveCurl.SetSslVerifyHost(sslVerifyHost);34 },35 SetAuthenticator: (authenticator) => {36 pveAuth = authenticator;37 },38 Get: async function () {39 return await pveCurl.PveCurl.Get(40 `${pveAuth.GetEndpoint()}/nodes`,41 {},42 {},43 { PVEAuthCookie: pveAuth.GetAuthCookie() }44 );45 },46 Node: function (node) {47 return {48 Get: async function () {49 return await pveCurl.PveCurl.Get(50 `${pveAuth.GetEndpoint()}/nodes/${node}`,51 {},52 {},53 { PVEAuthCookie: pveAuth.GetAuthCookie() }54 );55 },56 Apt: {57 Get: async function () {58 return await pveCurl.PveCurl.Get(59 `${pveAuth.GetEndpoint()}/nodes/${node}/apt`,60 {},61 {},62 { PVEAuthCookie: pveAuth.GetAuthCookie() }63 );64 },65 ChangeLog: {66 Get: async function (params) {67 return await pveCurl.PveCurl.Get(68 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/changelog`,69 params,70 {},71 { PVEAuthCookie: pveAuth.GetAuthCookie() }72 );73 },74 },75 Repositories: {76 Get: async function () {77 return await pveCurl.PveCurl.Get(78 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/repositories`,79 {},80 {},81 { PVEAuthCookie: pveAuth.GetAuthCookie() }82 );83 },84 Post: async function (params) {85 return await pveCurl.PveCurl.Post(86 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/repositories`,87 params,88 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },89 { PVEAuthCookie: pveAuth.GetAuthCookie() }90 );91 },92 Put: async function (params) {93 return await pveCurl.PveCurl.Put(94 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/repositories`,95 params,96 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },97 { PVEAuthCookie: pveAuth.GetAuthCookie() }98 );99 },100 },101 Update: {102 Get: async function () {103 return await pveCurl.PveCurl.Get(104 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/update`,105 {},106 {},107 { PVEAuthCookie: pveAuth.GetAuthCookie() }108 );109 },110 Post: async function (params) {111 return await pveCurl.PveCurl.Post(112 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/update`,113 params,114 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },115 { PVEAuthCookie: pveAuth.GetAuthCookie() }116 );117 },118 },119 Version: {120 Get: async function () {121 return await pveCurl.PveCurl.Get(122 `${pveAuth.GetEndpoint()}/nodes/${node}/apt/version`,123 {},124 {},125 { PVEAuthCookie: pveAuth.GetAuthCookie() }126 );127 },128 },129 },130 Capabilities: {131 Get: async function () {132 return await pveCurl.PveCurl.Get(133 `${pveAuth.GetEndpoint()}/nodes/${node}/capabilities`,134 {},135 {},136 { PVEAuthCookie: pveAuth.GetAuthCookie() }137 );138 },139 Qemu: {140 Get: async function () {141 return await pveCurl.PveCurl.Get(142 `${pveAuth.GetEndpoint()}/nodes/${node}/capabilities/qemu`,143 {},144 {},145 { PVEAuthCookie: pveAuth.GetAuthCookie() }146 );147 },148 Cpu: {149 Get: async function () {150 return await pveCurl.PveCurl.Get(151 `${pveAuth.GetEndpoint()}/nodes/${node}/capabilities/qemu/cpu`,152 {},153 {},154 { PVEAuthCookie: pveAuth.GetAuthCookie() }155 );156 },157 },158 Machines: {159 Get: async function () {160 return await pveCurl.PveCurl.Get(161 `${pveAuth.GetEndpoint()}/nodes/${node}/capabilities/qemu/machines`,162 {},163 {},164 { PVEAuthCookie: pveAuth.GetAuthCookie() }165 );166 },167 },168 },169 },170 Ceph: {171 Get: async function () {172 return await pveCurl.PveCurl.Get(173 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph`,174 {},175 {},176 { PVEAuthCookie: pveAuth.GetAuthCookie() }177 );178 },179 Fs: {180 Get: async function () {181 return await pveCurl.PveCurl.Get(182 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/fs`,183 {},184 {},185 { PVEAuthCookie: pveAuth.GetAuthCookie() }186 );187 },188 Name: function (name) {189 return {190 Post: async function (params) {191 return await pveCurl.PveCurl.Post(192 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/${name}`,193 params,194 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },195 { PVEAuthCookie: pveAuth.GetAuthCookie() }196 );197 },198 };199 },200 },201 Mds: {202 Get: async function () {203 return await pveCurl.PveCurl.Get(204 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mds`,205 {},206 {},207 { PVEAuthCookie: pveAuth.GetAuthCookie() }208 );209 },210 Name: function (name) {211 return {212 Post: async function (params) {213 return await pveCurl.PveCurl.Get(214 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mds/${name}`,215 params,216 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },217 { PVEAuthCookie: pveAuth.GetAuthCookie() }218 );219 },220 Delete: async function (params) {221 return await pveCurl.PveCurl.Get(222 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mds/${name}`,223 params,224 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },225 { PVEAuthCookie: pveAuth.GetAuthCookie() }226 );227 },228 };229 },230 },231 Mgr: {232 Get: async function () {233 return await pveCurl.PveCurl.Get(234 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mgr`,235 {},236 {},237 { PVEAuthCookie: pveAuth.GetAuthCookie() }238 );239 },240 Id: function (id) {241 return {242 Post: async function (params) {243 return await pveCurl.PveCurl.Get(244 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mgr/${id}`,245 params,246 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },247 { PVEAuthCookie: pveAuth.GetAuthCookie() }248 );249 },250 Delete: async function (params) {251 return await pveCurl.PveCurl.Get(252 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mgr/${id}`,253 params,254 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },255 { PVEAuthCookie: pveAuth.GetAuthCookie() }256 );257 },258 };259 },260 },261 Mon: {262 Get: async function () {263 return await pveCurl.PveCurl.Get(264 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mon`,265 {},266 {},267 { PVEAuthCookie: pveAuth.GetAuthCookie() }268 );269 },270 MonID: async function (monid) {271 return {272 Post: async function (params) {273 return await pveCurl.PveCurl.Get(274 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mon/${monid}`,275 params,276 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },277 { PVEAuthCookie: pveAuth.GetAuthCookie() }278 );279 },280 Delete: async function (params) {281 return await pveCurl.PveCurl.Get(282 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/mon/${monid}`,283 params,284 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },285 { PVEAuthCookie: pveAuth.GetAuthCookie() }286 );287 },288 };289 },290 },291 Osd: {292 Get: async function () {293 return await pveCurl.PveCurl.Get(294 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd`,295 {},296 {},297 { PVEAuthCookie: pveAuth.GetAuthCookie() }298 );299 },300 Post: async function (params) {301 return await pveCurl.PveCurl.Post(302 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd`,303 params,304 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },305 { PVEAuthCookie: pveAuth.GetAuthCookie() }306 );307 },308 OsdID: function (osdid) {309 return {310 Delete: async function (params) {311 return await pveCurl.PveCurl.Get(312 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd/${osdid}`,313 params,314 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },315 { PVEAuthCookie: pveAuth.GetAuthCookie() }316 );317 },318 In: {319 Post: async function (params) {320 return await pveCurl.PveCurl.Post(321 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd/${osdid}/in`,322 params,323 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },324 { PVEAuthCookie: pveAuth.GetAuthCookie() }325 );326 },327 },328 Out: {329 Post: async function (params) {330 return await pveCurl.PveCurl.Post(331 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd/${osdid}/out`,332 params,333 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },334 { PVEAuthCookie: pveAuth.GetAuthCookie() }335 );336 },337 },338 Scrub: {339 Post: async function (params) {340 return await pveCurl.PveCurl.Post(341 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/osd/${osdid}/scrub`,342 params,343 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },344 { PVEAuthCookie: pveAuth.GetAuthCookie() }345 );346 },347 },348 };349 },350 },351 Pools: {352 Get: async function () {353 return await pveCurl.PveCurl.Get(354 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/pools`,355 {},356 {},357 { PVEAuthCookie: pveAuth.GetAuthCookie() }358 );359 },360 Post: async function (params) {361 return await pveCurl.PveCurl.Post(362 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/pools`,363 params,364 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },365 { PVEAuthCookie: pveAuth.GetAuthCookie() }366 );367 },368 Name: function (name) {369 return {370 Get: async function (params) {371 return await pveCurl.PveCurl.Get(372 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/pools/${name}`,373 params,374 {},375 { PVEAuthCookie: pveAuth.GetAuthCookie() }376 );377 },378 Put: async function (params) {379 return await pveCurl.PveCurl.Put(380 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/pools/${name}`,381 params,382 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },383 { PVEAuthCookie: pveAuth.GetAuthCookie() }384 );385 },386 Delete: async function (params) {387 return await pveCurl.PveCurl.Delete(388 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/pools/${name}`,389 params,390 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },391 { PVEAuthCookie: pveAuth.GetAuthCookie() }392 );393 },394 };395 },396 },397 Config: {398 Get: async function () {399 return await pveCurl.PveCurl.Get(400 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/config`,401 {},402 {},403 { PVEAuthCookie: pveAuth.GetAuthCookie() }404 );405 },406 },407 ConfigDb: {408 Get: async function () {409 return await pveCurl.PveCurl.Get(410 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/configdb`,411 {},412 {},413 { PVEAuthCookie: pveAuth.GetAuthCookie() }414 );415 },416 },417 Crush: {418 Get: async function () {419 return await pveCurl.PveCurl.Get(420 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/crush`,421 {},422 {},423 { PVEAuthCookie: pveAuth.GetAuthCookie() }424 );425 },426 },427 Init: {428 Post: async function () {429 return await pveCurl.PveCurl.Get(430 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/init`,431 {},432 {},433 { PVEAuthCookie: pveAuth.GetAuthCookie() }434 );435 },436 },437 Log: {438 Get: async function () {439 return await pveCurl.PveCurl.Get(440 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/log`,441 {},442 {},443 { PVEAuthCookie: pveAuth.GetAuthCookie() }444 );445 },446 },447 Restart: {448 Post: async function (params) {449 return await pveCurl.PveCurl.Get(450 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/config`,451 params,452 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },453 { PVEAuthCookie: pveAuth.GetAuthCookie() }454 );455 },456 },457 Rules: {458 Get: async function () {459 return await pveCurl.PveCurl.Get(460 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/rules`,461 {},462 {},463 { PVEAuthCookie: pveAuth.GetAuthCookie() }464 );465 },466 },467 Start: {468 Post: async function (params) {469 return await pveCurl.PveCurl.Get(470 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/start`,471 params,472 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },473 { PVEAuthCookie: pveAuth.GetAuthCookie() }474 );475 },476 },477 Status: {478 Get: async function () {479 return await pveCurl.PveCurl.Get(480 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/status`,481 {},482 {},483 { PVEAuthCookie: pveAuth.GetAuthCookie() }484 );485 },486 },487 Stop: {488 Post: async function (params) {489 return await pveCurl.PveCurl.Get(490 `${pveAuth.GetEndpoint()}/nodes/${node}/ceph/stop`,491 params,492 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },493 { PVEAuthCookie: pveAuth.GetAuthCookie() }494 );495 },496 },497 },498 Certificates: {499 Get: async function () {500 return await pveCurl.PveCurl.Get(501 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates`,502 {},503 {},504 { PVEAuthCookie: pveAuth.GetAuthCookie() }505 );506 },507 Acme: {508 Get: async function () {509 return await pveCurl.PveCurl.Get(510 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/acme`,511 {},512 {},513 { PVEAuthCookie: pveAuth.GetAuthCookie() }514 );515 },516 Certificate: {517 Post: async function (params) {518 return await pveCurl.PveCurl.Post(519 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/acme/certificate`,520 params,521 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },522 { PVEAuthCookie: pveAuth.GetAuthCookie() }523 );524 },525 Put: async function (params) {526 return await pveCurl.PveCurl.Put(527 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/acme/certificate`,528 params,529 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },530 { PVEAuthCookie: pveAuth.GetAuthCookie() }531 );532 },533 Delete: async function () {534 return await pveCurl.PveCurl.Delete(535 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/acme/certificate`,536 {},537 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },538 { PVEAuthCookie: pveAuth.GetAuthCookie() }539 );540 },541 },542 },543 Custom: {544 Post: async function (params) {545 return await pveCurl.PveCurl.Post(546 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/custom`,547 params,548 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },549 { PVEAuthCookie: pveAuth.GetAuthCookie() }550 );551 },552 Delete: async function (params) {553 return await pveCurl.PveCurl.Delete(554 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/custom`,555 params,556 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },557 { PVEAuthCookie: pveAuth.GetAuthCookie() }558 );559 },560 },561 Info: {562 Get: async function () {563 return await pveCurl.PveCurl.Get(564 `${pveAuth.GetEndpoint()}/nodes/${node}/certificates/info`,565 {},566 {},567 { PVEAuthCookie: pveAuth.GetAuthCookie() }568 );569 },570 },571 },572 Disks: {573 Get: async function () {574 return await pveCurl.PveCurl.Get(575 `${pveAuth.GetEndpoint()}/nodes/${node}/disks`,576 {},577 {},578 { PVEAuthCookie: pveAuth.GetAuthCookie() }579 );580 },581 Zfs: {582 Get: async function () {583 return await pveCurl.PveCurl.Get(584 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/zfs`,585 {},586 {},587 { PVEAuthCookie: pveAuth.GetAuthCookie() }588 );589 },590 Post: async function (params) {591 return await pveCurl.PveCurl.Post(592 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/zfs`,593 params,594 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },595 { PVEAuthCookie: pveAuth.GetAuthCookie() }596 );597 },598 Name: function (name) {599 return {600 Get: async function () {601 return await pveCurl.PveCurl.Get(602 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/zfs/${name}`,603 {},604 {},605 { PVEAuthCookie: pveAuth.GetAuthCookie() }606 );607 },608 };609 },610 },611 Directory: {612 Get: async function () {613 return await pveCurl.PveCurl.Get(614 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/directory`,615 {},616 {},617 { PVEAuthCookie: pveAuth.GetAuthCookie() }618 );619 },620 Post: async function (params) {621 return await pveCurl.PveCurl.Post(622 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/directory`,623 params,624 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },625 { PVEAuthCookie: pveAuth.GetAuthCookie() }626 );627 },628 },629 InitGpt: {630 Post: async function (params) {631 return await pveCurl.PveCurl.Post(632 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/initgpt`,633 params,634 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },635 { PVEAuthCookie: pveAuth.GetAuthCookie() }636 );637 },638 },639 List: {640 Get: async function (params) {641 return await pveCurl.PveCurl.Get(642 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/list`,643 params,644 {},645 { PVEAuthCookie: pveAuth.GetAuthCookie() }646 );647 },648 },649 Lvm: {650 Get: async function () {651 return await pveCurl.PveCurl.Get(652 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/lvm`,653 {},654 {},655 { PVEAuthCookie: pveAuth.GetAuthCookie() }656 );657 },658 Post: async function (params) {659 return await pveCurl.PveCurl.Post(660 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/lvm`,661 params,662 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },663 { PVEAuthCookie: pveAuth.GetAuthCookie() }664 );665 },666 },667 LvmThin: {668 Get: async function () {669 return await pveCurl.PveCurl.Get(670 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/lvmthin`,671 {},672 {},673 { PVEAuthCookie: pveAuth.GetAuthCookie() }674 );675 },676 Post: async function (params) {677 return await pveCurl.PveCurl.Post(678 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/lvmthin`,679 params,680 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },681 { PVEAuthCookie: pveAuth.GetAuthCookie() }682 );683 },684 },685 Smart: {686 Get: async function (params) {687 return await pveCurl.PveCurl.Get(688 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/smart`,689 params,690 {},691 { PVEAuthCookie: pveAuth.GetAuthCookie() }692 );693 },694 },695 WipeDisk: {696 Put: async function () {697 return await pveCurl.PveCurl.Put(698 `${pveAuth.GetEndpoint()}/nodes/${node}/disks/wipedisk`,699 params,700 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },701 { PVEAuthCookie: pveAuth.GetAuthCookie() }702 );703 },704 },705 },706 Firewall: {707 Get: async function () {708 return await pveCurl.PveCurl.Get(709 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall`,710 {},711 {},712 { PVEAuthCookie: pveAuth.GetAuthCookie() }713 );714 },715 Rules: {716 Get: async function () {717 return await pveCurl.PveCurl.Get(718 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/rules`,719 {},720 {},721 { PVEAuthCookie: pveAuth.GetAuthCookie() }722 );723 },724 Post: async function (params) {725 return await pveCurl.PveCurl.Post(726 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/rules`,727 params,728 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },729 { PVEAuthCookie: pveAuth.GetAuthCookie() }730 );731 },732 Pos: function (pos) {733 return {734 Get: async function () {735 return await pveCurl.PveCurl.Get(736 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/rules/${pos}`,737 {},738 {},739 { PVEAuthCookie: pveAuth.GetAuthCookie() }740 );741 },742 Put: async function (params) {743 return await pveCurl.PveCurl.Put(744 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/rules/${pos}`,745 { params },746 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },747 { PVEAuthCookie: pveAuth.GetAuthCookie() }748 );749 },750 Delete: async function (params) {751 return await pveCurl.PveCurl.Delete(752 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/rules/${pos}`,753 { params },754 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },755 { PVEAuthCookie: pveAuth.GetAuthCookie() }756 );757 },758 };759 },760 },761 Log: {762 Get: async function () {763 return await pveCurl.PveCurl.Get(764 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/log`,765 {},766 {},767 { PVEAuthCookie: pveAuth.GetAuthCookie() }768 );769 },770 },771 Options: {772 Get: async function () {773 return await pveCurl.PveCurl.Get(774 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/options`,775 {},776 {},777 { PVEAuthCookie: pveAuth.GetAuthCookie() }778 );779 },780 Put: async function (params) {781 return await pveCurl.PveCurl.Put(782 `${pveAuth.GetEndpoint()}/nodes/${node}/firewall/options`,783 { params },784 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },785 { PVEAuthCookie: pveAuth.GetAuthCookie() }786 );787 },788 },789 },790 Hardware: {791 Get: async function () {792 return await pveCurl.PveCurl.Get(793 `${pveAuth.GetEndpoint()}/nodes/${node}/hardware`,794 {},795 {},796 { PVEAuthCookie: pveAuth.GetAuthCookie() }797 );798 },799 Pci: {800 Get: async function () {801 return await pveCurl.PveCurl.Get(802 `${pveAuth.GetEndpoint()}/nodes/${node}/hardware/pci`,803 {},804 {},805 { PVEAuthCookie: pveAuth.GetAuthCookie() }806 );807 },808 PciID: function (pciid) {809 return {810 Get: async function () {811 return await pveCurl.PveCurl.Get(812 `${pveAuthInfo.apiTicket.endpoint}/nodes/${node}/hardware/pci/${pciid}`,813 {},814 {},815 { PVEAuthCookie: pveAuth.GetAuthCookie() }816 );817 },818 Mdev: {819 Get: async function () {820 return await pveCurl.PveCurl.Get(821 `${pveAuthInfo.apiTicket.endpoint}/nodes/${node}/hardware/pci/${pciid}`,822 {},823 {},824 { PVEAuthCookie: pveAuth.GetAuthCookie() }825 );826 },827 },828 };829 },830 },831 Usb: {832 Get: async function () {833 return pveCurl.PveCurl.Get(834 `${pveAuthInfo.apiTicket.endpoint}/nodes/${node}/hardware/usb`,835 {},836 {},837 { PVEAuthCookie: pveAuth.GetAuthCookie() }838 );839 },840 },841 },842 Lxc: {843 Get: async function () {844 return await pveCurl.PveCurl.Get(845 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc`,846 {},847 {},848 { PVEAuthCookie: pveAuth.GetAuthCookie() }849 );850 },851 Post: async function (params) {852 return await pveCurl.PveCurl.Post(853 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc`,854 params,855 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },856 { PVEAuthCookie: pveAuth.GetAuthCookie() }857 );858 },859 Vmid: function (vmid) {860 return {861 Get: async function () {862 return await pveCurl.PveCurl.Get(863 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}`,864 {},865 {},866 { PVEAuthCookie: pveAuth.GetAuthCookie() }867 );868 },869 Delete: async function (params) {870 return await pveCurl.PveCurl.Delete(871 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}`,872 params,873 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },874 { PVEAuthCookie: pveAuth.GetAuthCookie() }875 );876 },877 Firewall: {878 Get: async function () {879 return await pveCurl.PveCurl.Get(880 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall`,881 {},882 {},883 { PVEAuthCookie: pveAuth.GetAuthCookie() }884 );885 },886 Aliases: {887 Get: async function () {888 return await pveCurl.PveCurl.Get(889 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/aliases`,890 {},891 {},892 { PVEAuthCookie: pveAuth.GetAuthCookie() }893 );894 },895 Post: async function (params) {896 return await pveCurl.PveCurl.Post(897 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/aliases`,898 params,899 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },900 {901 PVEAuthCookie:902 pveAuthInfo.apiTicket.csrfPreventionToken,903 }904 );905 },906 Name: function (name) {907 return {908 Get: async function () {909 return await pveCurl.PveCurl.Get(910 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/aliases/${name}`,911 {},912 {},913 { PVEAuthCookie: pveAuth.GetAuthCookie() }914 );915 },916 Put: async function (params) {917 return await pveCurl.PveCurl.Put(918 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/aliases/${name}`,919 params,920 {921 CSRFPreventionToken:922 pveAuth.GetCsrfPreventionToken(),923 },924 { PVEAuthCookie: pveAuth.GetAuthCookie() }925 );926 },927 Delete: async function (params) {928 return await pveCurl.PveCurl.Delete(929 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/aliases/${name}`,930 params,931 {932 CSRFPreventionToken:933 pveAuth.GetCsrfPreventionToken(),934 },935 { PVEAuthCookie: pveAuth.GetAuthCookie() }936 );937 },938 };939 },940 },941 IpSet: {942 Get: async function () {943 return await pveCurl.PveCurl.Get(944 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset`,945 {},946 {},947 { PVEAuthCookie: pveAuth.GetAuthCookie() }948 );949 },950 Post: async function (params) {951 return await pveCurl.PveCurl.Post(952 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset`,953 params,954 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },955 { PVEAuthCookie: pveAuth.GetAuthCookie() }956 );957 },958 Name: function (name) {959 return {960 Get: async function () {961 return await pveCurl.PveCurl.Get(962 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name`,963 {},964 {},965 { PVEAuthCookie: pveAuth.GetAuthCookie() }966 );967 },968 Post: async function (params) {969 return await pveCurl.PveCurl.Post(970 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name`,971 params,972 {973 CSRFPreventionToken:974 pveAuth.GetCsrfPreventionToken(),975 },976 { PVEAuthCookie: pveAuth.GetAuthCookie() }977 );978 },979 Delete: async function () {980 return await pveCurl.PveCurl.Delete(981 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name`,982 {},983 {984 CSRFPreventionToken:985 pveAuth.GetCsrfPreventionToken(),986 },987 { PVEAuthCookie: pveAuth.GetAuthCookie() }988 );989 },990 Cidr: function (cidr) {991 return {992 Get: async function () {993 return await pveCurl.PveCurl.Get(994 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name/${cidr}`,995 {},996 {},997 { PVEAuthCookie: pveAuth.GetAuthCookie() }998 );999 },1000 Put: async function (params) {1001 return await pveCurl.PveCurl.Put(1002 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name/${cidr}`,1003 params,1004 {1005 CSRFPreventionToken:1006 pveAuthInfo.apiTicket.csrfPreventionToken,1007 },1008 { PVEAuthCookie: pveAuth.GetAuthCookie() }1009 );1010 },1011 Delete: async function (params) {1012 return await pveCurl.PveCurl.Delete(1013 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/ipset/name/${cidr}`,1014 params,1015 {1016 CSRFPreventionToken:1017 pveAuthInfo.apiTicket.csrfPreventionToken,1018 },1019 { PVEAuthCookie: pveAuth.GetAuthCookie() }1020 );1021 },1022 };1023 },1024 };1025 },1026 },1027 Rules: {1028 Get: async function () {1029 return await pveCurl.PveCurl.Get(1030 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/rules`,1031 {},1032 {},1033 { PVEAuthCookie: pveAuth.GetAuthCookie() }1034 );1035 },1036 Post: async function (params) {1037 return await pveCurl.PveCurl.Post(1038 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/rules`,1039 params,1040 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1041 { PVEAuthCookie: pveAuth.GetAuthCookie() }1042 );1043 },1044 Pos: function (pos) {1045 return {1046 Get: async function () {1047 return await pveCurl.PveCurl.Get(1048 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/rules/${pos}`,1049 {},1050 {},1051 { PVEAuthCookie: pveAuth.GetAuthCookie() }1052 );1053 },1054 Put: async function (params) {1055 return await pveCurl.PveCurl.Put(1056 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/rules/${pos}`,1057 params,1058 {1059 CSRFPreventionToken:1060 pveAuth.GetCsrfPreventionToken(),1061 },1062 { PVEAuthCookie: pveAuth.GetAuthCookie() }1063 );1064 },1065 Delete: async function (params) {1066 return await pveCurl.PveCurl.Delete(1067 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/rules/${pos}`,1068 params,1069 {1070 CSRFPreventionToken:1071 pveAuth.GetCsrfPreventionToken(),1072 },1073 { PVEAuthCookie: pveAuth.GetAuthCookie() }1074 );1075 },1076 };1077 },1078 },1079 Log: {1080 Get: async function (params) {1081 return await pveCurl.PveCurl.Get(1082 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/log`,1083 params,1084 {},1085 { PVEAuthCookie: pveAuth.GetAuthCookie() }1086 );1087 },1088 },1089 Options: {1090 Get: async function () {1091 return await pveCurl.PveCurl.Get(1092 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/options`,1093 {},1094 {},1095 { PVEAuthCookie: pveAuth.GetAuthCookie() }1096 );1097 },1098 Put: async function (params) {1099 return await pveCurl.PveCurl.Get(1100 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/options`,1101 params,1102 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1103 { PVEAuthCookie: pveAuth.GetAuthCookie() }1104 );1105 },1106 },1107 Refs: {1108 Get: async function (params) {1109 return await pveCurl.PveCurl.Get(1110 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/firewall/refs`,1111 params,1112 {},1113 { PVEAuthCookie: pveAuth.GetAuthCookie() }1114 );1115 },1116 },1117 },1118 SnapShot: {1119 Get: async function () {1120 return await pveCurl.PveCurl.Get(1121 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot`,1122 {},1123 {},1124 { PVEAuthCookie: pveAuth.GetAuthCookie() }1125 );1126 },1127 Post: async function (params) {1128 return await pveCurl.PveCurl.Post(1129 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot`,1130 params,1131 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1132 { PVEAuthCookie: pveAuth.GetAuthCookie() }1133 );1134 },1135 SnapName: function (snapname) {1136 return {1137 Get: async function () {1138 return await pveCurl.PveCurl.Get(1139 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot/${snapname}`,1140 {},1141 {},1142 { PVEAuthCookie: pveAuth.GetAuthCookie() }1143 );1144 },1145 Delete: async function (params) {1146 return await pveCurl.PveCurl.Delete(1147 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot/${snapname}`,1148 params,1149 {1150 CSRFPreventionToken: pveAuth.GetCsrfPreventionToken(),1151 },1152 { PVEAuthCookie: pveAuth.GetAuthCookie() }1153 );1154 },1155 Config: {1156 Get: async function () {1157 return await pveCurl.PveCurl.Get(1158 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot/${snapname}/config`,1159 {},1160 {},1161 { PVEAuthCookie: pveAuth.GetAuthCookie() }1162 );1163 },1164 Put: async function (params) {1165 return await pveCurl.PveCurl.Put(1166 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot/${snapname}/config`,1167 params,1168 {1169 CSRFPreventionToken:1170 pveAuth.GetCsrfPreventionToken(),1171 },1172 { PVEAuthCookie: pveAuth.GetAuthCookie() }1173 );1174 },1175 },1176 Rollback: {1177 Post: async function (params) {1178 return await pveCurl.PveCurl.Post(1179 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/snapshot/${snapname}/rollback`,1180 {},1181 {1182 CSRFPreventionToken:1183 pveAuth.GetCsrfPreventionToken(),1184 },1185 { PVEAuthCookie: pveAuth.GetAuthCookie() }1186 );1187 },1188 },1189 };1190 },1191 },1192 Status: {1193 Get: async function () {1194 return await pveCurl.PveCurl.Get(1195 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status`,1196 {},1197 {},1198 { PVEAuthCookie: pveAuth.GetAuthCookie() }1199 );1200 },1201 Current: {1202 Get: async function () {1203 return await pveCurl.PveCurl.Get(1204 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/current`,1205 {},1206 {},1207 { PVEAuthCookie: pveAuth.GetAuthCookie() }1208 );1209 },1210 },1211 Reboot: {1212 Post: async function (params) {1213 return await pveCurl.PveCurl.Post(1214 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/reboot`,1215 params,1216 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1217 { PVEAuthCookie: pveAuth.GetAuthCookie() }1218 );1219 },1220 },1221 Resume: {1222 Post: async function () {1223 return await pveCurl.PveCurl.Post(1224 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/resume`,1225 {},1226 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1227 { PVEAuthCookie: pveAuth.GetAuthCookie() }1228 );1229 },1230 },1231 Shutdown: {1232 Post: async function (params) {1233 return await pveCurl.PveCurl.Post(1234 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/shutdown`,1235 params,1236 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1237 { PVEAuthCookie: pveAuth.GetAuthCookie() }1238 );1239 },1240 },1241 Start: {1242 Post: async function (params) {1243 return await pveCurl.PveCurl.Post(1244 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/start`,1245 params,1246 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1247 { PVEAuthCookie: pveAuth.GetAuthCookie() }1248 );1249 },1250 },1251 Stop: {1252 Post: async function (params) {1253 return await pveCurl.PveCurl.Post(1254 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/stop`,1255 params,1256 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1257 { PVEAuthCookie: pveAuth.GetAuthCookie() }1258 );1259 },1260 },1261 Suspend: {1262 Post: async function () {1263 return await pveCurl.PveCurl.Post(1264 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/status/suspend`,1265 {},1266 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1267 { PVEAuthCookie: pveAuth.GetAuthCookie() }1268 );1269 },1270 },1271 },1272 Clone: {1273 Post: async function (params) {1274 return await pveCurl.PveCurl.Post(1275 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/clone`,1276 params,1277 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1278 { PVEAuthCookie: pveAuth.GetAuthCookie() }1279 );1280 },1281 },1282 Config: {1283 Get: async function (params) {1284 return await pveCurl.PveCurl.Get(1285 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/config`,1286 params,1287 {},1288 { PVEAuthCookie: pveAuth.GetAuthCookie() }1289 );1290 },1291 Put: async function (params) {1292 return await pveCurl.PveCurl.Put(1293 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/config`,1294 params,1295 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1296 { PVEAuthCookie: pveAuth.GetAuthCookie() }1297 );1298 },1299 },1300 Feature: {1301 Get: async function (params) {1302 return await pveCurl.PveCurl.Get(1303 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/feature`,1304 params,1305 {},1306 { PVEAuthCookie: pveAuth.GetAuthCookie() }1307 );1308 },1309 },1310 Migrate: {1311 Post: async function (params) {1312 return await pveCurl.PveCurl.Post(1313 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/migrate`,1314 params,1315 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1316 { PVEAuthCookie: pveAuth.GetAuthCookie() }1317 );1318 },1319 },1320 MoveVolume: {1321 Post: function (params) {1322 return await pveCurl.PveCurl.Post(1323 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/move_volume`,1324 params,1325 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1326 { PVEAuthCookie: pveAuth.GetAuthCookie() }1327 );1328 },1329 },1330 Pending: {1331 Get: async function () {1332 return await pveCurl.PveCurl.Get(1333 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/pending`,1334 {},1335 {},1336 { PVEAuthCookie: pveAuth.GetAuthCookie() }1337 );1338 },1339 },1340 Resize: {1341 Put: async function (params) {1342 return await pveCurl.PveCurl.Put(1343 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/resize`,1344 params,1345 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1346 { PVEAuthCookie: pveAuth.GetAuthCookie() }1347 );1348 },1349 },1350 Rrd: {1351 Get: async function (params) {1352 return await pveCurl.PveCurl.Get(1353 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/rrd`,1354 params,1355 {},1356 { PVEAuthCookie: pveAuth.GetAuthCookie() }1357 );1358 },1359 },1360 RrdData: {1361 Get: async function (params) {1362 return await pveCurl.PveCurl.Get(1363 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/rrd`,1364 params,1365 {},1366 { PVEAuthCookie: pveAuth.GetAuthCookie() }1367 );1368 },1369 },1370 SpiceProxy: {1371 Post: async function (params) {1372 return await pveCurl.PveCurl.Post(1373 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/spiceproxy`,1374 params,1375 { CSRFPreventionToken: pveAuthInfo.apiTicket.ticket },1376 { PVEAuthCookie: pveAuth.GetAuthCookie() }1377 );1378 },1379 },1380 Template: {1381 Post: async function () {1382 return await pveCurl.PveCurl.Post(1383 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/template`,1384 {},1385 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1386 { PVEAuthCookie: pveAuth.GetAuthCookie() }1387 );1388 },1389 },1390 TermProxy: {1391 Post: async function () {1392 return await pveCurl.PveCurl.Post(1393 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/termproxy`,1394 {},1395 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1396 { PVEAuthCookie: pveAuth.GetAuthCookie() }1397 );1398 },1399 },1400 VncProxy: {1401 Post: async function (params) {1402 return await pveCurl.PveCurl.Post(1403 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/vncproxy`,1404 params,1405 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1406 { PVEAuthCookie: pveAuth.GetAuthCookie() }1407 );1408 },1409 },1410 VncWebSocket: {1411 Get: async function (params) {1412 return await pveCurl.PveCurl.Get(1413 `${pveAuth.GetEndpoint()}/nodes/${node}/lxc/${vmid}/vncwebsocket`,1414 params,1415 {},1416 { PVEAuthCookie: pveAuth.GetAuthCookie() }1417 );1418 },1419 },1420 };1421 },1422 },1423 Network: {1424 Get: async function (params) {1425 return await pveCurl.PveCurl.Get(1426 `${pveAuth.GetEndpoint()}/nodes/${node}/network`,1427 params,1428 {},1429 { PVEAuthCookie: pveAuth.GetAuthCookie() }1430 );1431 },1432 Post: async function (params) {1433 return await pveCurl.PveCurl.Post(1434 `${pveAuth.GetEndpoint()}/nodes/${node}/network`,1435 params,1436 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1437 { PVEAuthCookie: pveAuth.GetAuthCookie() }1438 );1439 },1440 Put: async function () {1441 return await pveCurl.PveCurl.Put(1442 `${pveAuth.GetEndpoint()}/nodes/${node}/network`,1443 {},1444 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1445 { PVEAuthCookie: pveAuth.GetAuthCookie() }1446 );1447 },1448 Delete: async function () {1449 return await pveCurl.PveCurl.Delete(1450 `${pveAuth.GetEndpoint()}/nodes/${node}/network`,1451 {},1452 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1453 { PVEAuthCookie: pveAuth.GetAuthCookie() }1454 );1455 },1456 IFace: function (iface) {1457 return {1458 Get: async function () {1459 return await pveCurl.PveCurl.Get(1460 `${pveAuth.GetEndpoint()}/nodes/${node}/network/${iface}`,1461 {},1462 {},1463 { PVEAuthCookie: pveAuth.GetAuthCookie() }1464 );1465 },1466 Put: async function (params) {1467 return await pveCurl.PveCurl.Put(1468 `${pveAuth.GetEndpoint()}/nodes/${node}/network/${iface}`,1469 {},1470 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1471 { PVEAuthCookie: pveAuth.GetAuthCookie() }1472 );1473 },1474 Delete: async function () {1475 return await pveCurl.PveCurl.Put(1476 `${pveAuth.GetEndpoint()}/nodes/${node}/network/${iface}`,1477 {},1478 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1479 { PVEAuthCookie: pveAuth.GetAuthCookie() }1480 );1481 },1482 };1483 },1484 },1485 Qemu: {1486 Get: async function (params) {1487 return await pveCurl.PveCurl.Get(1488 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu`,1489 params,1490 {},1491 { PVEAuthCookie: pveAuth.GetAuthCookie() }1492 );1493 },1494 Post: async function (params) {1495 return await pveCurl.PveCurl.Post(1496 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu`,1497 params,1498 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1499 { PVEAuthCookie: pveAuth.GetAuthCookie() }1500 );1501 },1502 Vmid: function (vmid) {1503 return {1504 Get: async function () {1505 return await pveCurl.PveCurl.Get(1506 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}`,1507 {},1508 {},1509 { PVEAuthCookie: pveAuth.GetAuthCookie() }1510 );1511 },1512 Delete: async function (params) {1513 return await pveCurl.PveCurl.Delete(1514 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}`,1515 params,1516 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1517 { PVEAuthCookie: pveAuth.GetAuthCookie() }1518 );1519 },1520 Agent: {1521 Get: async function () {1522 return await pveCurl.PveCurl.Get(1523 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent`,1524 {},1525 {},1526 { PVEAuthCookie: pveAuth.GetAuthCookie() }1527 );1528 },1529 Post: async function (params) {1530 return await pveCurl.PveCurl.Post(1531 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent`,1532 params,1533 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1534 { PVEAuthCookie: pveAuth.GetAuthCookie() }1535 );1536 },1537 Exec: {1538 Post: async function (params) {1539 return await pveCurl.PveCurl.Post(1540 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/exec`,1541 params,1542 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1543 { PVEAuthCookie: pveAuth.GetAuthCookie() }1544 );1545 },1546 },1547 ExecStatus: {1548 Get: async function (params) {1549 return await pveCurl.PveCurl.Get(1550 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/exec-status`,1551 params,1552 {},1553 { PVEAuthCookie: pveAuth.GetAuthCookie() }1554 );1555 },1556 },1557 FileRead: {1558 Get: async function (params) {1559 return await pveCurl.PveCurl.Get(1560 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/file-read`,1561 params,1562 {},1563 { PVEAuthCookie: pveAuth.GetAuthCookie() }1564 );1565 },1566 },1567 FileWrite: {1568 Post: async function (params) {1569 return await pveCurl.PveCurl.Post(1570 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/file-write`,1571 params,1572 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1573 { PVEAuthCookie: pveAuth.GetAuthCookie() }1574 );1575 },1576 },1577 FsFreezeFreeze: {1578 Post: async function () {1579 return await pveCurl.PveCurl.Post(1580 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/fsfreeze-freeze`,1581 {},1582 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1583 { PVEAuthCookie: pveAuth.GetAuthCookie() }1584 );1585 },1586 },1587 FsFreezeStatus: {1588 Post: async function () {1589 return await pveCurl.PveCurl.Post(1590 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/fsfreeze-status`,1591 {},1592 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1593 { PVEAuthCookie: pveAuth.GetAuthCookie() }1594 );1595 },1596 },1597 FsFreezeThaw: {1598 Post: async function () {1599 return await pveCurl.PveCurl.Post(1600 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/fsfreeze-thaw`,1601 {},1602 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1603 { PVEAuthCookie: pveAuth.GetAuthCookie() }1604 );1605 },1606 },1607 FsTrim: {1608 Post: async function (params) {1609 return await pveCurl.PveCurl.Post(1610 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/fstrim`,1611 params,1612 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1613 { PVEAuthCookie: pveAuth.GetAuthCookie() }1614 );1615 },1616 },1617 GetFsInfo: {1618 Get: async function () {1619 return await pveCurl.PveCurl.Get(1620 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-fsinfo`,1621 {},1622 {},1623 { PVEAuthCookie: pveAuth.GetAuthCookie() }1624 );1625 },1626 },1627 GetHostName: {1628 Get: async function () {1629 return await pveCurl.PveCurl.Get(1630 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-host-name`,1631 {},1632 {},1633 { PVEAuthCookie: pveAuth.GetAuthCookie() }1634 );1635 },1636 },1637 GetMemoryBlockInfo: {1638 Get: async function () {1639 return await pveCurl.PveCurl.Get(1640 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-memory-block-info`,1641 {},1642 {},1643 { PVEAuthCookie: pveAuth.GetAuthCookie() }1644 );1645 },1646 },1647 GetMemoryBlocks: {1648 Get: async function () {1649 return await pveCurl.PveCurl.Get(1650 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-memory-blocks`,1651 {},1652 {},1653 { PVEAuthCookie: pveAuth.GetAuthCookie() }1654 );1655 },1656 },1657 GetOsInfo: {1658 Get: async function () {1659 return await pveCurl.PveCurl.Get(1660 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-osinfo`,1661 {},1662 {},1663 { PVEAuthCookie: pveAuth.GetAuthCookie() }1664 );1665 },1666 },1667 GetTime: {1668 Get: async function () {1669 return await pveCurl.PveCurl.Get(1670 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-time`,1671 {},1672 {},1673 { PVEAuthCookie: pveAuth.GetAuthCookie() }1674 );1675 },1676 },1677 GetTimezone: {1678 Get: async function () {1679 return await pveCurl.PveCurl.Get(1680 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-timezone`,1681 {},1682 {},1683 { PVEAuthCookie: pveAuth.GetAuthCookie() }1684 );1685 },1686 },1687 GetUsers: {1688 Get: async function () {1689 return await pveCurl.PveCurl.Get(1690 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-users`,1691 {},1692 {},1693 { PVEAuthCookie: pveAuth.GetAuthCookie() }1694 );1695 },1696 },1697 GetVCpus: {1698 Get: async function () {1699 return await pveCurl.PveCurl.Get(1700 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/get-vcpus`,1701 {},1702 {},1703 { PVEAuthCookie: pveAuth.GetAuthCookie() }1704 );1705 },1706 },1707 Info: {1708 Get: async function () {1709 return await pveCurl.PveCurl.Get(1710 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/info`,1711 {},1712 {},1713 { PVEAuthCookie: pveAuth.GetAuthCookie() }1714 );1715 },1716 },1717 NetworkGetInterfaces: {1718 Get: async function () {1719 return await pveCurl.PveCurl.Get(1720 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/network-get-interfaces`,1721 {},1722 {},1723 { PVEAuthCookie: pveAuth.GetAuthCookie() }1724 );1725 },1726 },1727 Ping: {1728 Post: async function () {1729 return await pveCurl.PveCurl.Post(1730 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/ping`,1731 {},1732 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1733 { PVEAuthCookie: pveAuth.GetAuthCookie() }1734 );1735 },1736 },1737 SetUserPassword: {1738 Post: async function (params) {1739 return await pveCurl.PveCurl.Post(1740 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/set-user-password`,1741 params,1742 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1743 { PVEAuthCookie: pveAuth.GetAuthCookie() }1744 );1745 },1746 },1747 Shutdown: {1748 Post: async function () {1749 return await pveCurl.PveCurl.Post(1750 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/shutdown`,1751 {},1752 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1753 { PVEAuthCookie: pveAuth.GetAuthCookie() }1754 );1755 },1756 },1757 SuspendDisk: {1758 Post: async function () {1759 return await pveCurl.PveCurl.Post(1760 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/suspend-disk`,1761 {},1762 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1763 { PVEAuthCookie: pveAuth.GetAuthCookie() }1764 );1765 },1766 },1767 SuspendHybrid: {1768 Post: async function () {1769 return await pveCurl.PveCurl.Post(1770 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/suspend-hybrid`,1771 {},1772 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1773 { PVEAuthCookie: pveAuth.GetAuthCookie() }1774 );1775 },1776 },1777 SuspendRam: {1778 Post: async function () {1779 return await pveCurl.PveCurl.Post(1780 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/agent/suspend-ram`,1781 {},1782 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1783 { PVEAuthCookie: pveAuth.GetAuthCookie() }1784 );1785 },1786 },1787 },1788 CloudInit: {1789 Dump: {1790 Get: async function (params) {1791 return await pveCurl.PveCurl.Get(1792 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/cloudinit/dump`,1793 params,1794 {},1795 { PVEAuthCookie: pveAuth.GetAuthCookie() }1796 );1797 },1798 },1799 },1800 Firewall: {1801 Get: async function () {1802 return await pveCurl.PveCurl.Get(1803 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall`,1804 {},1805 {},1806 { PVEAuthCookie: pveAuth.GetAuthCookie() }1807 );1808 },1809 Aliases: {1810 Get: async function () {1811 return await pveCurl.PveCurl.Get(1812 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/aliases`,1813 {},1814 {},1815 { PVEAuthCookie: pveAuth.GetAuthCookie() }1816 );1817 },1818 Post: async function (params) {1819 return await pveCurl.PveCurl.Post(1820 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/aliases`,1821 params,1822 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1823 {1824 PVEAuthCookie:1825 pveAuthInfo.apiTicket.csrfPreventionToken,1826 }1827 );1828 },1829 Name: function (name) {1830 return {1831 Get: async function () {1832 return await pveCurl.PveCurl.Get(1833 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/aliases/${name}`,1834 {},1835 {},1836 { PVEAuthCookie: pveAuth.GetAuthCookie() }1837 );1838 },1839 Put: async function (params) {1840 return await pveCurl.PveCurl.Put(1841 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/aliases/${name}`,1842 params,1843 {1844 CSRFPreventionToken:1845 pveAuth.GetCsrfPreventionToken(),1846 },1847 { PVEAuthCookie: pveAuth.GetAuthCookie() }1848 );1849 },1850 Delete: async function (params) {1851 return await pveCurl.PveCurl.Delete(1852 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/aliases/${name}`,1853 params,1854 {1855 CSRFPreventionToken:1856 pveAuth.GetCsrfPreventionToken(),1857 },1858 { PVEAuthCookie: pveAuth.GetAuthCookie() }1859 );1860 },1861 };1862 },1863 },1864 IpSet: {1865 Get: async function () {1866 return await pveCurl.PveCurl.Get(1867 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset`,1868 {},1869 {},1870 { PVEAuthCookie: pveAuth.GetAuthCookie() }1871 );1872 },1873 Post: async function (params) {1874 return await pveCurl.PveCurl.Post(1875 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset`,1876 params,1877 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1878 { PVEAuthCookie: pveAuth.GetAuthCookie() }1879 );1880 },1881 Name: function (name) {1882 return {1883 Get: async function () {1884 return await pveCurl.PveCurl.Get(1885 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name`,1886 {},1887 {},1888 { PVEAuthCookie: pveAuth.GetAuthCookie() }1889 );1890 },1891 Post: async function (params) {1892 return await pveCurl.PveCurl.Post(1893 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name`,1894 params,1895 {1896 CSRFPreventionToken:1897 pveAuth.GetCsrfPreventionToken(),1898 },1899 { PVEAuthCookie: pveAuth.GetAuthCookie() }1900 );1901 },1902 Delete: async function () {1903 return await pveCurl.PveCurl.Delete(1904 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name`,1905 {},1906 {1907 CSRFPreventionToken:1908 pveAuth.GetCsrfPreventionToken(),1909 },1910 { PVEAuthCookie: pveAuth.GetAuthCookie() }1911 );1912 },1913 Cidr: function (cidr) {1914 return {1915 Get: async function () {1916 return await pveCurl.PveCurl.Get(1917 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name/${cidr}`,1918 {},1919 {},1920 { PVEAuthCookie: pveAuth.GetAuthCookie() }1921 );1922 },1923 Put: async function (params) {1924 return await pveCurl.PveCurl.Put(1925 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name/${cidr}`,1926 params,1927 {1928 CSRFPreventionToken:1929 pveAuthInfo.apiTicket.csrfPreventionToken,1930 },1931 { PVEAuthCookie: pveAuth.GetAuthCookie() }1932 );1933 },1934 Delete: async function (params) {1935 return await pveCurl.PveCurl.Delete(1936 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/ipset/name/${cidr}`,1937 params,1938 {1939 CSRFPreventionToken:1940 pveAuthInfo.apiTicket.csrfPreventionToken,1941 },1942 { PVEAuthCookie: pveAuth.GetAuthCookie() }1943 );1944 },1945 };1946 },1947 };1948 },1949 },1950 Rules: {1951 Get: async function () {1952 return await pveCurl.PveCurl.Get(1953 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/rules`,1954 {},1955 {},1956 { PVEAuthCookie: pveAuth.GetAuthCookie() }1957 );1958 },1959 Post: async function (params) {1960 return await pveCurl.PveCurl.Post(1961 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/rules`,1962 params,1963 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },1964 { PVEAuthCookie: pveAuth.GetAuthCookie() }1965 );1966 },1967 Pos: function (pos) {1968 return {1969 Get: async function () {1970 return await pveCurl.PveCurl.Get(1971 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/rules/${pos}`,1972 {},1973 {},1974 { PVEAuthCookie: pveAuth.GetAuthCookie() }1975 );1976 },1977 Put: async function (params) {1978 return await pveCurl.PveCurl.Put(1979 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/rules/${pos}`,1980 params,1981 {1982 CSRFPreventionToken:1983 pveAuth.GetCsrfPreventionToken(),1984 },1985 { PVEAuthCookie: pveAuth.GetAuthCookie() }1986 );1987 },1988 Delete: async function (params) {1989 return await pveCurl.PveCurl.Delete(1990 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/rules/${pos}`,1991 params,1992 {1993 CSRFPreventionToken:1994 pveAuth.GetCsrfPreventionToken(),1995 },1996 { PVEAuthCookie: pveAuth.GetAuthCookie() }1997 );1998 },1999 };2000 },2001 },2002 Log: {2003 Get: async function (params) {2004 return await pveCurl.PveCurl.Get(2005 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/log`,2006 params,2007 {},2008 { PVEAuthCookie: pveAuth.GetAuthCookie() }2009 );2010 },2011 },2012 Options: {2013 Get: async function () {2014 return await pveCurl.PveCurl.Get(2015 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/options`,2016 {},2017 {},2018 { PVEAuthCookie: pveAuth.GetAuthCookie() }2019 );2020 },2021 Put: async function (params) {2022 return await pveCurl.PveCurl.Get(2023 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/options`,2024 params,2025 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2026 { PVEAuthCookie: pveAuth.GetAuthCookie() }2027 );2028 },2029 },2030 Refs: {2031 Get: async function (params) {2032 return await pveCurl.PveCurl.Get(2033 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/firewall/refs`,2034 params,2035 {},2036 { PVEAuthCookie: pveAuth.GetAuthCookie() }2037 );2038 },2039 },2040 },2041 SnapShot: {2042 Get: async function () {2043 return await pveCurl.PveCurl.Get(2044 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot`,2045 {},2046 {},2047 { PVEAuthCookie: pveAuth.GetAuthCookie() }2048 );2049 },2050 Post: async function (params) {2051 return await pveCurl.PveCurl.Post(2052 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot`,2053 params,2054 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2055 { PVEAuthCookie: pveAuth.GetAuthCookie() }2056 );2057 },2058 SnapName: function (snapname) {2059 return {2060 Get: async function () {2061 return await pveCurl.PveCurl.Get(2062 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot/${snapname}`,2063 {},2064 {},2065 { PVEAuthCookie: pveAuth.GetAuthCookie() }2066 );2067 },2068 Delete: async function (params) {2069 return await pveCurl.PveCurl.Delete(2070 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot/${snapname}`,2071 params,2072 {2073 CSRFPreventionToken: pveAuth.GetCsrfPreventionToken(),2074 },2075 { PVEAuthCookie: pveAuth.GetAuthCookie() }2076 );2077 },2078 Config: {2079 Get: async function () {2080 return await pveCurl.PveCurl.Get(2081 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot/${snapname}/config`,2082 {},2083 {},2084 { PVEAuthCookie: pveAuth.GetAuthCookie() }2085 );2086 },2087 Put: async function (params) {2088 return await pveCurl.PveCurl.Put(2089 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot/${snapname}/config`,2090 params,2091 {2092 CSRFPreventionToken:2093 pveAuth.GetCsrfPreventionToken(),2094 },2095 { PVEAuthCookie: pveAuth.GetAuthCookie() }2096 );2097 },2098 },2099 Rollback: {2100 Post: async function (params) {2101 return await pveCurl.PveCurl.Post(2102 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/snapshot/${snapname}/rollback`,2103 {},2104 {2105 CSRFPreventionToken:2106 pveAuth.GetCsrfPreventionToken(),2107 },2108 { PVEAuthCookie: pveAuth.GetAuthCookie() }2109 );2110 },2111 },2112 };2113 },2114 },2115 Status: {2116 Get: async function () {2117 return await pveCurl.PveCurl.Get(2118 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status`,2119 {},2120 {},2121 { PVEAuthCookie: pveAuth.GetAuthCookie() }2122 );2123 },2124 Current: {2125 Get: async function () {2126 return await pveCurl.PveCurl.Get(2127 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/current`,2128 {},2129 {},2130 { PVEAuthCookie: pveAuth.GetAuthCookie() }2131 );2132 },2133 },2134 Reboot: {2135 Post: async function (params) {2136 return await pveCurl.PveCurl.Post(2137 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/reboot`,2138 params,2139 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2140 { PVEAuthCookie: pveAuth.GetAuthCookie() }2141 );2142 },2143 },2144 Reset: {2145 Post: async function (params) {2146 return await pveCurl.PveCurl.Post(2147 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/reset`,2148 params,2149 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2150 { PVEAuthCookie: pveAuth.GetAuthCookie() }2151 );2152 },2153 },2154 Resume: {2155 Post: async function () {2156 return await pveCurl.PveCurl.Post(2157 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/resume`,2158 {},2159 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2160 { PVEAuthCookie: pveAuth.GetAuthCookie() }2161 );2162 },2163 },2164 Shutdown: {2165 Post: async function (params) {2166 return await pveCurl.PveCurl.Post(2167 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/shutdown`,2168 params,2169 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2170 { PVEAuthCookie: pveAuth.GetAuthCookie() }2171 );2172 },2173 },2174 Start: {2175 Post: async function (params) {2176 return await pveCurl.PveCurl.Post(2177 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/start`,2178 params,2179 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2180 { PVEAuthCookie: pveAuth.GetAuthCookie() }2181 );2182 },2183 },2184 Stop: {2185 Post: async function (params) {2186 return await pveCurl.PveCurl.Post(2187 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/stop`,2188 params,2189 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2190 { PVEAuthCookie: pveAuth.GetAuthCookie() }2191 );2192 },2193 },2194 Suspend: {2195 Post: async function () {2196 return await pveCurl.PveCurl.Post(2197 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/status/suspend`,2198 {},2199 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2200 { PVEAuthCookie: pveAuth.GetAuthCookie() }2201 );2202 },2203 },2204 },2205 Clone: {2206 Post: async function (params) {2207 return await pveCurl.PveCurl.Post(2208 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/clone`,2209 params,2210 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2211 { PVEAuthCookie: pveAuth.GetAuthCookie() }2212 );2213 },2214 },2215 Config: {2216 Get: async function (params) {2217 return await pveCurl.PveCurl.Get(2218 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/config`,2219 params,2220 {},2221 { PVEAuthCookie: pveAuth.GetAuthCookie() }2222 );2223 },2224 Post: async function (params) {2225 return await pveCurl.PveCurl.Post(2226 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/config`,2227 params,2228 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2229 { PVEAuthCookie: pveAuth.GetAuthCookie() }2230 );2231 },2232 Put: async function (params) {2233 return await pveCurl.PveCurl.Put(2234 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/config`,2235 params,2236 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2237 { PVEAuthCookie: pveAuth.GetAuthCookie() }2238 );2239 },2240 },2241 Feature: {2242 Get: async function (params) {2243 return await pveCurl.PveCurl.Get(2244 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/feature`,2245 params,2246 {},2247 { PVEAuthCookie: pveAuth.GetAuthCookie() }2248 );2249 },2250 },2251 Migrate: {2252 Get: async function (params) {2253 return await pveCurl.PveCurl.Get(2254 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/migrate`,2255 params,2256 {},2257 { PVEAuthCookie: pveAuth.GetAuthCookie() }2258 );2259 },2260 Post: async function (params) {2261 return await pveCurl.PveCurl.Post(2262 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/migrate`,2263 params,2264 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2265 { PVEAuthCookie: pveAuth.GetAuthCookie() }2266 );2267 },2268 },2269 Monitor: {2270 Post: async function (params) {2271 return await pveCurl.PveCurl.Post(2272 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/monitor`,2273 params,2274 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2275 { PVEAuthCookie: pveAuth.GetAuthCookie() }2276 );2277 },2278 },2279 MoveDisk: {2280 Post: function () {2281 return await pveCurl.PveCurl.Post(2282 `${pveAuth.GetEndpoint()}/nodes/${node}/${vmid}/move_disk`,2283 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2284 { PVEAuthCookie: pveAuth.GetAuthCookie() }2285 );2286 },2287 },2288 Pending: {2289 Get: async function () {2290 return await pveCurl.PveCurl.Get(2291 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/pending`,2292 {},2293 {},2294 { PVEAuthCookie: pveAuth.GetAuthCookie() }2295 );2296 },2297 },2298 Resize: {2299 Put: async function (params) {2300 return await pveCurl.PveCurl.Put(2301 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/resize`,2302 params,2303 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2304 { PVEAuthCookie: pveAuth.GetAuthCookie() }2305 );2306 },2307 },2308 Rrd: {2309 Get: async function (params) {2310 return await pveCurl.PveCurl.Get(2311 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/rrd`,2312 params,2313 {},2314 { PVEAuthCookie: pveAuth.GetAuthCookie() }2315 );2316 },2317 },2318 RrdData: {2319 Get: async function (params) {2320 return await pveCurl.PveCurl.Get(2321 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/rrd`,2322 params,2323 {},2324 { PVEAuthCookie: pveAuth.GetAuthCookie() }2325 );2326 },2327 },2328 SendKey: {2329 Put: async function (params) {2330 return await pveCurl.PveCurl.Put(2331 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/sendlink`,2332 params,2333 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2334 { PVEAuthCookie: pveAuth.GetAuthCookie() }2335 );2336 },2337 },2338 SpiceProxy: {2339 Post: async function (params) {2340 return await pveCurl.PveCurl.Post(2341 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/spiceproxy`,2342 params,2343 { CSRFPreventionToken: pveAuthInfo.apiTicket.ticket },2344 { PVEAuthCookie: pveAuth.GetAuthCookie() }2345 );2346 },2347 },2348 Template: {2349 Post: async function () {2350 return await pveCurl.PveCurl.Post(2351 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/template`,2352 {},2353 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2354 { PVEAuthCookie: pveAuth.GetAuthCookie() }2355 );2356 },2357 },2358 TermProxy: {2359 Post: async function () {2360 return await pveCurl.PveCurl.Post(2361 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/termproxy`,2362 {},2363 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2364 { PVEAuthCookie: pveAuth.GetAuthCookie() }2365 );2366 },2367 },2368 Unlink: {2369 Put: async function (params) {2370 return await pveCurl.PveCurl.Put(2371 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/unlink`,2372 params,2373 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2374 { PVEAuthCookie: pveAuth.GetAuthCookie() }2375 );2376 },2377 },2378 VncProxy: {2379 Post: async function (params) {2380 return await pveCurl.PveCurl.Post(2381 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/vncproxy`,2382 params,2383 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2384 { PVEAuthCookie: pveAuth.GetAuthCookie() }2385 );2386 },2387 },2388 VncWebSocket: {2389 Get: async function (params) {2390 return await pveCurl.PveCurl.Get(2391 `${pveAuth.GetEndpoint()}/nodes/${node}/qemu/${vmid}/vncwebsocket`,2392 params,2393 {},2394 { PVEAuthCookie: pveAuth.GetAuthCookie() }2395 );2396 },2397 },2398 };2399 },2400 },2401 Replication: {2402 Get: async function (params) {2403 return await pveCurl.PveCurl.Get(2404 `${pveAuth.GetEndpoint()}/nodes/${node}/replication`,2405 params,2406 {},2407 { PVEAuthCookie: pveAuth.GetAuthCookie() }2408 );2409 },2410 Id: function (id) {2411 return {2412 Get: async function () {2413 return await pveCurl.PveCurl.Get(2414 `${pveAuth.GetEndpoint()}/nodes/${node}/replication/${id}`,2415 {},2416 {},2417 { PVEAuthCookie: pveAuth.GetAuthCookie() }2418 );2419 },2420 Log: {2421 Get: async function (params) {2422 return await pveCurl.PveCurl.Get(2423 `${pveAuth.GetEndpoint()}/nodes/${node}/replication/${id}/log`,2424 params,2425 {},2426 { PVEAuthCookie: pveAuth.GetAuthCookie() }2427 );2428 },2429 },2430 ScheduleNow: {2431 Post: async function (params) {2432 return await pveCurl.PveCurl.Post(2433 `${pveAuth.GetEndpoint()}/nodes/${node}/replication/${id}/schedule_now`,2434 {},2435 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2436 { PVEAuthCookie: pveAuth.GetAuthCookie() }2437 );2438 },2439 },2440 Status: {2441 Get: async function () {2442 return await pveCurl.PveCurl.Get(2443 `${pveAuth.GetEndpoint()}/nodes/${node}/replication/${id}/status`,2444 {},2445 {},2446 { PVEAuthCookie: pveAuth.GetAuthCookie() }2447 );2448 },2449 },2450 };2451 },2452 },2453 Scan: {2454 Get: async function () {2455 return await pveCurl.PveCurl.Get(2456 `${pveAuth.GetEndpoint()}/nodes/${node}/scan`,2457 {},2458 {},2459 { PVEAuthCookie: pveAuth.GetAuthCookie() }2460 );2461 },2462 Cifs: {2463 Get: async function (params) {2464 return await pveCurl.PveCurl.Get(2465 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/cifs`,2466 params,2467 {},2468 { PVEAuthCookie: pveAuth.GetAuthCookie() }2469 );2470 },2471 },2472 GlusterFS: {2473 Get: async function (params) {2474 return await pveCurl.PveCurl.Get(2475 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/glusterfs`,2476 params,2477 {},2478 { PVEAuthCookie: pveAuth.GetAuthCookie() }2479 );2480 },2481 },2482 Iscsi: {2483 Get: async function (params) {2484 return await pveCurl.PveCurl.Get(2485 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/iscsi`,2486 params,2487 {},2488 { PVEAuthCookie: pveAuth.GetAuthCookie() }2489 );2490 },2491 },2492 Lvm: {2493 Get: async function () {2494 return await pveCurl.PveCurl.Get(2495 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/lvm`,2496 {},2497 {},2498 { PVEAuthCookie: pveAuth.GetAuthCookie() }2499 );2500 },2501 },2502 LvmThin: {2503 Get: async function (params) {2504 return await pveCurl.PveCurl.Get(2505 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/lvmthin`,2506 params,2507 {},2508 { PVEAuthCookie: pveAuth.GetAuthCookie() }2509 );2510 },2511 },2512 Nfs: {2513 Get: async function (params) {2514 return await pveCurl.PveCurl.Get(2515 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/nfs`,2516 params,2517 {},2518 { PVEAuthCookie: pveAuth.GetAuthCookie() }2519 );2520 },2521 },2522 Pbs: {2523 Get: async function (params) {2524 return await pveCurl.PveCurl.Get(2525 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/pbs`,2526 params,2527 {},2528 { PVEAuthCookie: pveAuth.GetAuthCookie() }2529 );2530 },2531 },2532 Zfs: {2533 Get: async function () {2534 return await pveCurl.PveCurl.Get(2535 `${pveAuth.GetEndpoint()}/nodes/${node}/scan/zfs`,2536 {},2537 {},2538 { PVEAuthCookie: pveAuth.GetAuthCookie() }2539 );2540 },2541 },2542 },2543 Sdn: {2544 Get: async function () {2545 return await pveCurl.PveCurl.Get(2546 `${pveAuth.GetEndpoint()}/nodes/${node}/sdn`,2547 {},2548 {},2549 { PVEAuthCookie: pveAuth.GetAuthCookie() }2550 );2551 },2552 Zones: {2553 Get: async function () {2554 return await pveCurl.PveCurl.Get(2555 `${pveAuth.GetEndpoint()}/nodes/${node}/sdn/zones`,2556 {},2557 {},2558 { PVEAuthCookie: pveAuth.GetAuthCookie() }2559 );2560 },2561 Zone: function (zone) {2562 return {2563 Get: async function () {2564 return await pveCurl.PveCurl.Get(2565 `${pveAuth.GetEndpoint()}/nodes/${node}/sdn/zones/${zone}`,2566 {},2567 {},2568 { PVEAuthCookie: pveAuth.GetAuthCookie() }2569 );2570 },2571 Content: {2572 Get: async function () {2573 return await pveCurl.PveCurl.Get(2574 `${pveAuth.GetEndpoint()}/nodes/${node}/sdn/zones/${zone}/content`,2575 {},2576 {},2577 { PVEAuthCookie: pveAuth.GetAuthCookie() }2578 );2579 },2580 },2581 };2582 },2583 },2584 },2585 Services: {2586 Get: async function () {2587 return await pveCurl.PveCurl.Get(2588 `${pveAuth.GetEndpoint()}/nodes/${node}/services`,2589 {},2590 {},2591 { PVEAuthCookie: pveAuth.GetAuthCookie() }2592 );2593 },2594 Service: function (service) {2595 return {2596 Get: async function () {2597 return await pveCurl.PveCurl.Get(2598 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}`,2599 {},2600 {},2601 { PVEAuthCookie: pveAuth.GetAuthCookie() }2602 );2603 },2604 Reload: {2605 Post: async function () {2606 return await pveCurl.PveCurl.Post(2607 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}/reload`,2608 {},2609 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2610 { PVEAuthCookie: pveAuth.GetAuthCookie() }2611 );2612 },2613 },2614 Restart: {2615 Post: async function () {2616 return await pveCurl.PveCurl.Post(2617 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}/restart`,2618 {},2619 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2620 { PVEAuthCookie: pveAuth.GetAuthCookie() }2621 );2622 },2623 },2624 Start: {2625 Post: async function () {2626 return await pveCurl.PveCurl.Post(2627 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}/start`,2628 {},2629 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2630 { PVEAuthCookie: pveAuth.GetAuthCookie() }2631 );2632 },2633 },2634 State: {2635 Get: async function () {2636 return await pveCurl.PveCurl.Get(2637 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}/state`,2638 {},2639 {},2640 { PVEAuthCookie: pveAuth.GetAuthCookie() }2641 );2642 },2643 },2644 Stop: {2645 Post: async function () {2646 return await pveCurl.PveCurl.Post(2647 `${pveAuth.GetEndpoint()}/nodes/${node}/services/${service}/stop`,2648 {},2649 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2650 { PVEAuthCookie: pveAuth.GetAuthCookie() }2651 );2652 },2653 },2654 };2655 },2656 },2657 Storage: {2658 Get: async function (params) {2659 return await pveCurl.PveCurl.Get(2660 `${pveAuth.GetEndpoint()}/nodes/${node}/storage`,2661 params,2662 {},2663 { PVEAuthCookie: pveAuth.GetAuthCookie() }2664 );2665 },2666 Storage: function (storage) {2667 return {2668 Get: async function () {2669 return await pveCurl.PveCurl.Get(2670 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}`,2671 {},2672 {},2673 { PVEAuthCookie: pveAuth.GetAuthCookie() }2674 );2675 },2676 Content: {2677 Get: async function (params) {2678 return await pveCurl.PveCurl.Get(2679 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content`,2680 params,2681 {},2682 { PVEAuthCookie: pveAuth.GetAuthCookie() }2683 );2684 },2685 Post: async function (params) {2686 return await pveCurl.PveCurl.Post(2687 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content`,2688 params,2689 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2690 { PVEAuthCookie: pveAuth.GetAuthCookie() }2691 );2692 },2693 Volume: function (volume) {2694 return {2695 Get: async function () {2696 return await pveCurl.PveCurl.Get(2697 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content/${volume}`,2698 {},2699 {},2700 { PVEAuthCookie: pveAuth.GetAuthCookie() }2701 );2702 },2703 Post: async function (params) {2704 return await pveCurl.PveCurl.Post(2705 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content/${volume}`,2706 params,2707 {2708 CSRFPreventionToken: pveAuth.GetCsrfPreventionToken(),2709 },2710 { PVEAuthCookie: pveAuth.GetAuthCookie() }2711 );2712 },2713 Put: async function (params) {2714 return await pveCurl.PveCurl.Put(2715 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content/${volume}`,2716 params,2717 {2718 CSRFPreventionToken: pveAuth.GetCsrfPreventionToken(),2719 },2720 { PVEAuthCookie: pveAuth.GetAuthCookie() }2721 );2722 },2723 Delete: async function (params) {2724 return await pveCurl.PveCurl.Delete(2725 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/content/${volume}`,2726 params,2727 {2728 CSRFPreventionToken: pveAuth.GetCsrfPreventionToken(),2729 },2730 { PVEAuthCookie: pveAuth.GetAuthCookie() }2731 );2732 },2733 };2734 },2735 },2736 FileRestore: {2737 Post: async function (params) {2738 return await pveCurl.PveCurl.Post(2739 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/file-restore`,2740 params,2741 { CSRFPreventionToken: pveAuthInfo.apiTicket.ticket },2742 { PVEAuthCookie: pveAuth.GetAuthCookie() }2743 );2744 },2745 Download: {2746 Get: async function (volume) {2747 return await pveCurl.PveCurl.Get(2748 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/file-restore/download`,2749 params,2750 {},2751 { PVEAuthCookie: pveAuth.GetAuthCookie() }2752 );2753 },2754 },2755 List: {2756 Get: async function () {2757 return await pveCurl.PveCurl.Get(2758 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/file-restore/list`,2759 params,2760 {},2761 { PVEAuthCookie: pveAuth.GetAuthCookie() }2762 );2763 },2764 },2765 },2766 DownloadUrl: {2767 Post: async function (params) {2768 return await pveCurl.PveCurl.Post(2769 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/download-url`,2770 params,2771 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2772 { PVEAuthCookie: pveAuth.GetAuthCookie() }2773 );2774 },2775 },2776 PruneBackups: {2777 Get: async function (params) {2778 return await pveCurl.PveCurl.Get(2779 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/prunebackups`,2780 params,2781 {},2782 { PVEAuthCookie: pveAuth.GetAuthCookie() }2783 );2784 },2785 Delete: async function (params) {2786 return await pveCurl.PveCurl.Delete(2787 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/prunebackups`,2788 params,2789 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2790 { PVEAuthCookie: pveAuth.GetAuthCookie() }2791 );2792 },2793 },2794 Rrd: {2795 Get: async function (params) {2796 return await pveCurl.PveCurl.Get(2797 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/rrd`,2798 params,2799 {},2800 { PVEAuthCookie: pveAuth.GetAuthCookie() }2801 );2802 },2803 },2804 RrdData: {2805 Get: async function (params) {2806 return await pveCurl.PveCurl.Get(2807 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/rrddata`,2808 params,2809 {},2810 { PVEAuthCookie: pveAuth.GetAuthCookie() }2811 );2812 },2813 },2814 Status: {2815 Get: async function () {2816 return await pveCurl.PveCurl.Get(2817 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/status`,2818 params,2819 {},2820 { PVEAuthCookie: pveAuth.GetAuthCookie() }2821 );2822 },2823 },2824 Upload: {2825 Post: async function (params) {2826 return await pveCurl.PveCurl.Post(2827 `${pveAuth.GetEndpoint()}/nodes/${node}/storage/${storage}/upload`,2828 params,2829 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2830 { PVEAuthCookie: pveAuth.GetAuthCookie() }2831 );2832 },2833 },2834 };2835 },2836 },2837 Tasks: {2838 Get: async function (params) {2839 return await pveCurl.PveCurl.Get(2840 `${pveAuth.GetEndpoint()}/nodes/${node}/tasks`,2841 params,2842 {},2843 { PVEAuthCookie: pveAuth.GetAuthCookie() }2844 );2845 },2846 Upid: function (upid) {2847 return {2848 Get: async function () {2849 return await pveCurl.PveCurl.Get(2850 `${pveAuth.GetEndpoint()}/nodes/${node}/tasks/${upid}`,2851 {},2852 {},2853 { PVEAuthCookie: pveAuth.GetAuthCookie() }2854 );2855 },2856 Delete: async function () {2857 return await pveCurl.PveCurl.Delete(2858 `${pveAuth.GetEndpoint()}/nodes/${node}/tasks/${upid}`,2859 {},2860 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2861 { PVEAuthCookie: pveAuth.GetAuthCookie() }2862 );2863 },2864 Log: {2865 Get: async function (params) {2866 return await pveCurl.PveCurl.Get(2867 `${pveAuth.GetEndpoint()}/nodes/${node}/tasks/${upid}/log`,2868 params,2869 {},2870 { PVEAuthCookie: pveAuth.GetAuthCookie() }2871 );2872 },2873 },2874 Status: {2875 Get: async function (params) {2876 return await pveCurl.PveCurl.Get(2877 `${pveAuth.GetEndpoint()}/nodes/${node}/tasks/${upid}/status`,2878 params,2879 {},2880 { PVEAuthCookie: pveAuth.GetAuthCookie() }2881 );2882 },2883 },2884 };2885 },2886 },2887 VZDump: {2888 Post: async function (params) {2889 return await pveCurl.PveCurl.Post(2890 `${pveAuth.GetEndpoint()}/nodes/${node}/vzdump`,2891 params,2892 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2893 { PVEAuthCookie: pveAuth.GetAuthCookie() }2894 );2895 },2896 Defaults: {2897 Get: async function (params) {2898 return await pveCurl.PveCurl.Get(2899 `${pveAuth.GetEndpoint()}/nodes/${node}/vzdump/defaults`,2900 params,2901 {},2902 { PVEAuthCookie: pveAuth.GetAuthCookie() }2903 );2904 },2905 },2906 ExtractConfig: {2907 Get: async function (params) {2908 return await pveCurl.PveCurl.Get(2909 `${pveAuth.GetEndpoint()}/nodes/${node}/vzdump/extraconfig`,2910 params,2911 {},2912 { PVEAuthCookie: pveAuth.GetAuthCookie() }2913 );2914 },2915 },2916 },2917 AplInfo: {2918 Get: async function () {2919 return await pveCurl.PveCurl.Get(2920 `${pveAuth.GetEndpoint()}/nodes/${node}/aplinfo`,2921 {},2922 {},2923 { PVEAuthCookie: pveAuth.GetAuthCookie() }2924 );2925 },2926 Post: async function (params) {2927 return await pveCurl.PveCurl.Post(2928 `${pveAuth.GetEndpoint()}/nodes/${node}/aplinfo`,2929 params,2930 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2931 { PVEAuthCookie: pveAuth.GetAuthCookie() }2932 );2933 },2934 },2935 Config: {2936 Get: async function (params) {2937 return await pveCurl.PveCurl.Get(2938 `${pveAuth.GetEndpoint()}/nodes/${node}/config`,2939 params,2940 {},2941 { PVEAuthCookie: pveAuth.GetAuthCookie() }2942 );2943 },2944 Put: async function (params) {2945 return await pveCurl.PveCurl.Put(2946 `${pveAuth.GetEndpoint()}/nodes/${node}/config`,2947 params,2948 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2949 { PVEAuthCookie: pveAuth.GetAuthCookie() }2950 );2951 },2952 },2953 Dns: {2954 Get: async function () {2955 return await pveCurl.PveCurl.Get(2956 `${pveAuth.GetEndpoint()}/nodes/${node}/dns`,2957 {},2958 {},2959 { PVEAuthCookie: pveAuth.GetAuthCookie() }2960 );2961 },2962 Put: async function (params) {2963 return await pveCurl.PveCurl.Put(2964 `${pveAuth.GetEndpoint()}/nodes/${node}/dns`,2965 params,2966 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2967 { PVEAuthCookie: pveAuth.GetAuthCookie() }2968 );2969 },2970 },2971 Execute: {2972 Get: async function () {2973 return await pveCurl.PveCurl.Get(2974 `${pveAuth.GetEndpoint()}/nodes/${node}/execute`,2975 {},2976 {},2977 { PVEAuthCookie: pveAuth.GetAuthCookie() }2978 );2979 },2980 Put: async function (params) {2981 return await pveCurl.PveCurl.Put(2982 `${pveAuth.GetEndpoint()}/nodes/${node}/execute`,2983 params,2984 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },2985 { PVEAuthCookie: pveAuth.GetAuthCookie() }2986 );2987 },2988 },2989 Hosts: {2990 Get: async function () {2991 return await pveCurl.PveCurl.Get(2992 `${pveAuth.GetEndpoint()}/nodes/${node}/hosts`,2993 {},2994 {},2995 { PVEAuthCookie: pveAuth.GetAuthCookie() }2996 );2997 },2998 Post: async function (params) {2999 return await pveCurl.PveCurl.Post(3000 `${pveAuth.GetEndpoint()}/nodes/${node}/hosts`,3001 params,3002 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3003 { PVEAuthCookie: pveAuth.GetAuthCookie() }3004 );3005 },3006 },3007 Journal: {3008 Get: async function (params) {3009 return await pveCurl.PveCurl.Get(3010 `${pveAuth.GetEndpoint()}/nodes/${node}/journal`,3011 params,3012 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3013 { PVEAuthCookie: pveAuth.GetAuthCookie() }3014 );3015 },3016 },3017 MigrateAll: {3018 Post: async function (params) {3019 return await pveCurl.PveCurl.Post(3020 `${pveAuth.GetEndpoint()}/nodes/${node}/migrateall`,3021 params,3022 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3023 { PVEAuthCookie: pveAuth.GetAuthCookie() }3024 );3025 },3026 },3027 NetStat: {3028 Get: async function () {3029 return await pveCurl.PveCurl.Get(3030 `${pveAuth.GetEndpoint()}/nodes/${node}/netstat`,3031 {},3032 {},3033 { PVEAuthCookie: pveAuth.GetAuthCookie() }3034 );3035 },3036 },3037 Report: {3038 Get: async function () {3039 return await pveCurl.PveCurl.Get(3040 `${pveAuth.GetEndpoint()}/nodes/${node}/report`,3041 {},3042 {},3043 { PVEAuthCookie: pveAuth.GetAuthCookie() }3044 );3045 },3046 },3047 Rrd: {3048 Get: async function (params) {3049 return await pveCurl.PveCurl.Get(3050 `${pveAuth.GetEndpoint()}/nodes/${node}/rrd`,3051 params,3052 {},3053 { PVEAuthCookie: pveAuth.GetAuthCookie() }3054 );3055 },3056 },3057 RrdData: {3058 Get: async function (params) {3059 return await pveCurl.PveCurl.Get(3060 `${pveAuth.GetEndpoint()}/nodes/${node}/rrddata`,3061 params,3062 {},3063 { PVEAuthCookie: pveAuth.GetAuthCookie() }3064 );3065 },3066 },3067 SpiceShell: {3068 Post: async function (params) {3069 return await pveCurl.PveCurl.Post(3070 `${pveAuth.GetEndpoint()}/nodes/${node}/spiceshell`,3071 params,3072 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3073 { PVEAuthCookie: pveAuth.GetAuthCookie() }3074 );3075 },3076 },3077 StartAll: {3078 Post: async function (params) {3079 return await pveCurl.PveCurl.Post(3080 `${pveAuth.GetEndpoint()}/nodes/${node}/startall`,3081 params,3082 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3083 { PVEAuthCookie: pveAuth.GetAuthCookie() }3084 );3085 },3086 },3087 Status: {3088 Get: async function () {3089 return await pveCurl.PveCurl.Get(3090 `${pveAuth.GetEndpoint()}/nodes/${node}/status`,3091 {},3092 {},3093 { PVEAuthCookie: pveAuth.GetAuthCookie() }3094 );3095 },3096 Post: async function (params) {3097 return await pveCurl.PveCurl.Post(3098 `${pveAuth.GetEndpoint()}/nodes/${node}/status`,3099 params,3100 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3101 { PVEAuthCookie: pveAuth.GetAuthCookie() }3102 );3103 },3104 },3105 StopAll: {3106 Post: async function (params) {3107 return await pveCurl.PveCurl.Post(3108 `${pveAuth.GetEndpoint()}/nodes/${node}/stopall`,3109 params,3110 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3111 { PVEAuthCookie: pveAuth.GetAuthCookie() }3112 );3113 },3114 },3115 Subscription: {3116 Get: async function () {3117 return await pveCurl.PveCurl.Get(3118 `${pveAuth.GetEndpoint()}/nodes/${node}/subscription`,3119 {},3120 {},3121 { PVEAuthCookie: pveAuth.GetAuthCookie() }3122 );3123 },3124 Post: async function (params) {3125 return await pveCurl.PveCurl.Post(3126 `${pveAuth.GetEndpoint()}/nodes/${node}/subscription`,3127 params,3128 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3129 { PVEAuthCookie: pveAuth.GetAuthCookie() }3130 );3131 },3132 Put: async function (params) {3133 return await pveCurl.PveCurl.Put(3134 `${pveAuth.GetEndpoint()}/nodes/${node}/subscription`,3135 params,3136 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3137 { PVEAuthCookie: pveAuth.GetAuthCookie() }3138 );3139 },3140 Delete: async function () {3141 return await pveCurl.PveCurl.Delete(3142 `${pveAuth.GetEndpoint()}/nodes/${node}/subscription`,3143 params,3144 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3145 { PVEAuthCookie: pveAuth.GetAuthCookie() }3146 );3147 },3148 },3149 SysLog: {3150 Get: async function () {3151 return await pveCurl.PveCurl.Get(3152 `${pveAuth.GetEndpoint()}/nodes/${node}/syslog`,3153 params,3154 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3155 { PVEAuthCookie: pveAuth.GetAuthCookie() }3156 );3157 },3158 },3159 TermProxy: {3160 Post: async function (params) {3161 return await pveCurl.PveCurl.Post(3162 `${pveAuth.GetEndpoint()}/nodes/${node}/termproxy`,3163 params,3164 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3165 { PVEAuthCookie: pveAuth.GetAuthCookie() }3166 );3167 },3168 },3169 Time: {3170 Get: async function () {3171 return await pveCurl.PveCurl.Get(3172 `${pveAuth.GetEndpoint()}/nodes/${node}/time`,3173 {},3174 {},3175 { PVEAuthCookie: pveAuth.GetAuthCookie() }3176 );3177 },3178 Put: async function (params) {3179 return await pveCurl.PveCurl.Put(3180 `${pveAuth.GetEndpoint()}/nodes/${node}/time`,3181 params,3182 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3183 { PVEAuthCookie: pveAuth.GetAuthCookie() }3184 );3185 },3186 },3187 Version: {3188 Get: async function () {3189 return await pveCurl.PveCurl.Get(3190 `${pveAuth.GetEndpoint()}/nodes/${node}/version`,3191 {},3192 {},3193 { PVEAuthCookie: pveAuth.GetAuthCookie() }3194 );3195 },3196 },3197 VncShell: {3198 Post: async function (params) {3199 return await pveCurl.PveCurl.Post(3200 `${pveAuth.GetEndpoint()}/nodes/${node}/vncshell`,3201 params,3202 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3203 { PVEAuthCookie: pveAuth.GetAuthCookie() }3204 );3205 },3206 },3207 VncWebSocket: {3208 Get: async function () {3209 return await pveCurl.PveCurl.Get(3210 `${pveAuth.GetEndpoint()}/nodes/${node}/vncwebsocket`,3211 {},3212 {},3213 { PVEAuthCookie: pveAuth.GetAuthCookie() }3214 );3215 },3216 },3217 WakeOnLan: {3218 Post: async function () {3219 return await pveCurl.PveCurl.Post(3220 `${pveAuth.GetEndpoint()}/nodes/${node}/wakeonlan`,3221 {},3222 { CSRFPreventionToken: pveAuth.GetCsrfPreventionToken() },3223 { PVEAuthCookie: pveAuth.GetAuthCookie() }3224 );3225 },3226 },3227 };3228 },3229 };3230 return Module;...

Full Screen

Full Screen

miniflux.js

Source:miniflux.js Github

copy

Full Screen

...12 }13 this._base_url = serverURL;14 this._api_key = apiKey;15 }16 #getEndpoint(resource) {17 return `${this._base_url}/v${API_VERSION}/${resource}`;18 }19 async apiCall(method, url, body = null) {20 const params = { headers: { 'X-Auth-Token': this._api_key } };21 if (body) {22 params['method'] = method;23 params['body'] = JSON.stringify(body);24 }25 return fetch(url, params)26 .then((r) => {27 if (!r.ok) {28 throw r;29 }30 if (r.status === 204) {31 return r;32 }33 const contentType = r.headers.get('content-type');34 if (contentType && contentType.indexOf('application/json') !== -1) {35 return r.json(); 36 } else {37 return r.text();38 }39 })40 .catch(async (e) => {41 console.log(e);42 if (e instanceof TypeError) {43 throw new CustomError(e.message, 'Type Error');44 } else if (e instanceof Response) {45 const contentType = e.headers.get('content-type');46 if (contentType && contentType.indexOf('application/json') !== -1) {47 let r = await e.json();48 throw new CustomError(e.status + ': ' + r['error_message'],'Response Error');49 } else {50 let r = await e.text();51 throw new CustomError(e.status + ': ' + r, 'Response Error');52 }53 } else if (typeof e === 'object') {54 throw new CustomError(e.message, e.constructor.name + ' Error');55 } else {56 throw new CustomError(String(e), 'Unknown Error');57 }58 // return Promise.reject()59 });60 }61 /**62 * Get Miniflux Version63 * @returns {String}64 */65 async getVersion() {66 let r = await fetch(`${this._base_url}/version`);67 return await r.text();68 }69 /**70 * Get Miniflux Status71 * @returns {String}72 */73 async healthCheck() {74 let r = await fetch(`${this._base_url}/healthcheck`);75 return await r.text();76 }77 /**78 * Returns the information for the current logged in user 79 * @returns {Object}80 */81 async me() {82 return await this.apiCall('GET', this.#getEndpoint(`me`));83 }84 /**85 * Creates a OPML file for the current User86 * @returns {String}87 */88 async exportFeeds() {89 return await this.apiCall('GET', this.#getEndpoint(`export`));90 }91 /**92 * Imports a OPML file for the current User93 * @returns {Object} With 'message'94 */95 async importFeeds(opml) {96 return await this.apiCall('POST', this.#getEndpoint(`import`), opml);97 }98 /**99 * Find Subscriptions from the provided URL100 * @returns {Array}101 */102 // discover try to find subscriptions from a website103 async discover(url) {104 return await this.apiCall('POST', this.#getEndpoint(`discover`), { "url": url });105 }106 /**107 * Gets info for all feeds108 * @returns {Array}109 */110 async getFeeds() {111 return await this.apiCall('GET', this.#getEndpoint(`feeds`));112 }113 /**114 * Create a new field115 * @returns {Object} with the new "feed_id"116 */117 async createFeed(feedObj) {118 return await this.apiCall('POST', this.#getEndpoint(`feeds`), feedObj);119 }120 /**121 * Get the "reads" and "unreads" counters for all feeds122 * @returns {Object}123 */124 async getFeedCounters() {125 return await this.apiCall('GET', this.#getEndpoint(`feeds/counters`));126 }127 /**128 * Refresh all feeds in a bckground process129 * @returns {Null} Only status code130 */131 async refreshAllFeeds() {132 return await this.apiCall('PUT', this.#getEndpoint(`feeds/refresh`));133 }134 /**135 * Refresh a specific feed synchronously136 * @returns {Null} Only status code137 */138 async refreshFeed(feed_id) {139 return await this.apiCall('PUT', this.#getEndpoint(`feeds/${feed_id}/refresh`));140 }141 /**142 * Gets the info for a feed143 * @returns {Object}144 */145 async getFeed(feed_id) {146 return await this.apiCall('GET', this.#getEndpoint(`feeds/${feed_id}`));147 }148 /**149 * Update the info for a feed150 * @returns {Object}151 */152 async updateFeed(feed_id, feedObj) {153 return await this.apiCall('PUT', this.#getEndpoint(`feeds/${feed_id}`), feedObj);154 }155 /**156 * Remove a feed157 * @returns {Null}158 */159 async deleteFeed(feed_id) {160 return await this.apiCall('DELETE', this.#getEndpoint(`feeds/${feed_id}`));161 }162 /**163 * Get the Icon for a feed164 * @returns {Object}165 */166 async getFeedIcon(feed_id) {167 return await this.apiCall('GET', this.#getEndpoint(`feeds/${feed_id}/icon`));168 }169 /**170 * Mark all entries for a feed as read171 * @returns {Null}172 */173 async markFeedEntriesAsRead(feed_id) {174 return await this.apiCall('PUT', this.#getEndpoint(`feeds/${feed_id}/mark-all-as-read`));175 }176 /**177 * Get entries for a feed178 * @returns {Object}179 */180 async getFeedEntries(feed_id, filters) {181 let url = this.#getEndpoint(`feeds/${feed_id}/entries`);182 var queryString = Object.keys(filters).map(key => key + '=' + filters[key]).join('&');183 if (queryString) {184 url = url + '?' + queryString;185 }186 return await this.apiCall('GET', url);187 }188 /**189 * Get a entry for a feed190 * @returns {Object}191 */192 async getFeedEntry(feed_id, entry_id) {193 return await this.apiCall('GET', this.#getEndpoint(`feeds/${feed_id}/entries/${entry_id}`));194 }195 /**196 * Get entries accross all feeds197 * @returns {Object}198 */199 async getEntries(filters) {200 let url = this.#getEndpoint(`entries`);201 var queryString = Object.keys(filters).map(key => key + '=' + filters[key]).join('&');202 if (queryString) {203 url = url + '?' + queryString;204 }205 return await this.apiCall('GET', url);206 }207 /**208 * Update status of a list of entries209 * @returns {Null}210 */ 211 async updateEntries(entry_ids, status) {212 let data = {"entry_ids": entry_ids, "status": status};213 return await this.apiCall('PUT', this.#getEndpoint(`entries`), data);214 }215 /**216 * Get info for an entry217 * @returns {Object}218 */219 async getEntry(entry_id) {220 return await this.apiCall('GET', this.#getEndpoint(`entries/${entry_id}`));221 }222 /**223 * Toggle Entry Bookmark224 * @returns {Null}225 */226 async toggleBookmark(entry_id) {227 return await this.apiCall('PUT', this.#getEndpoint(`entries/${entry_id}/bookmark`));228 }229 /**230 * Get Original Article for entry231 * @returns {Object}232 */233 async fetchEntryContent(entry_id) {234 return await this.apiCall('GET', this.#getEndpoint(`entries/${entry_id}/fetch-content`));235 }236 /**237 * Get info for all Categories238 * @returns {Array}239 */240 async getCategories() {241 return await this.apiCall('GET', this.#getEndpoint(`categories`));242 }243 /**244 * Create a Category245 * @returns {Object}246 */247 async createCategory(title) {248 let data = {"title": title};249 return await this.apiCall('POST', this.#getEndpoint(`categories`), data);250 }251 /**252 * Update the title for a Category253 * @returns {Object}254 */255 async updateCategory(category_id, title) {256 let data = {"id": category_id, "title": title};257 return await this.apiCall('PUT', this.#getEndpoint(`categories/${category_id}`), data);258 }259 /**260 * Remove a Category261 * @returns {Null}262 */263 async deleteCategory(category_id) {264 return await this.apiCall('DELETE', this.#getEndpoint(`categories/${category_id}`));265 }266 /**267 * Marks all entries in a Category as Read268 * @returns {Null}269 */270 async markCategoryEntriesAsRead(category_id) {271 return await this.apiCall('PUT', this.#getEndpoint(`categories/${category_id}/mark-all-as-read`));272 }273 /**274 * Get feeds in a Category275 * @returns {Array}276 */ 277 async getCategoryFeeds(category_id) {278 return await this.apiCall('GET', this.#getEndpoint(`categories/${category_id}/feeds`));279 }280 /**281 * Get entries in a Category282 * @returns {Object}283 */284 async getCategoryEntries(category_id, filters) {285 let url = this.#getEndpoint(`categories/${category_id}/entries`);286 var queryString = Object.keys(filters).map(key => key + '=' + filters[key]).join('&');287 if (queryString) {288 url = url + '?' + queryString;289 }290 return await this.apiCall('GET', url);291 }292 /**293 * Get entry in a Category294 * @returns {Object}295 */296 async getCategoryEntry(category_id, entry_id) {297 return await this.apiCall('GET', this.#getEndpoint(`categories/${category_id}/entries/${entry_id}`));298 }299 /**300 * Get info for all users301 * @returns {Array}302 */303 async getUsers() {304 return await this.apiCall('GET', this.#getEndpoint(`users`));305 }306 /**307 * Create a new User308 * @returns {Object}309 */310 async createUser(username, password, is_admin) {311 let data = {"username": username, "password": password, "is_admin": is_admin}312 return await this.apiCall('POST', this.#getEndpoint(`users`), data);313 }314 /**315 * Get info for a User316 * @returns {Object}317 */318 async getUserById(user_id) {319 return await this.apiCall('GET', this.#getEndpoint(`users/${user_id}`));320 }321 /**322 * Get info for a User323 * @returns {Object}324 */325 async getUserByUsername(username) {326 return await this.apiCall('GET', this.#getEndpoint(`users/${username}`));327 }328 /**329 * Update info for a User330 * @returns {Object}331 */332 async updateUser(user_id, data) {333 return await this.apiCall('PUT', this.#getEndpoint(`users/${user_id}`), data);334 }335 /**336 * Remove a User337 * @returns {Null}338 */339 async deleteUser(user_id) {340 return await this.apiCall('DELETE', this.#getEndpoint(`users/${user_id}`));341 }342 /**343 * Mark all entries for a user as Read344 * @returns {Object}345 */346 async markUserEntriesAsRead(user_id) {347 return await this.apiCall('PUT', this.#getEndpoint(`users/${user_id}/mark-all-as-read`));348 }349}...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import config from '@/config';2import axios from 'axios';3export default {4 getTopics() {5 return axios.get(getEndpoint()).then(response => response.data);6 function getEndpoint() {7 return [8 config.URL,9 '/topics/'10 ].join('');11 }12 },13 getTopic(topicId) {14 return axios.get(getEndpoint(topicId)).then(response => response.data);15 function getEndpoint(topicId) {16 return [17 config.URL,18 '/topics/',19 topicId20 ].join('');21 }22 },23 getTags(topicId) {24 return axios25 .get(getEndpoint(topicId))26 .then(response => response.data.tags);27 function getEndpoint(topicId) {28 return [29 config.URL,30 '/topics/',31 topicId32 ].join('');33 }34 },35 annotate(text, file) {36 let formData = new FormData()37 formData.append('text', text)38 formData.append('file', file)39 return axios.post(40 getEndpoint(),41 formData,42 )43 function getEndpoint() {44 return [45 config.URL,46 '/tagger/'47 ].join('');48 }49 },50 getScannerResult(taskID) {51 return axios.get(52 getEndpoint(taskID)53 )54 function getEndpoint(taskID) {55 return [56 config.URL,57 '/tagger/result/',58 taskID59 ].join('');60 }61 },62 saveScanned(title, expiration, excerpt, result) {63 return axios.post(64 getEndpoint(),65 {66 title,67 expiration,68 excerpt,69 result: JSON.stringify(result),70 verified: false71 }72 )73 function getEndpoint() {74 return [75 config.URL,76 '/scanned/',77 ].join('');78 }79 },80 getScanned(scannedId) {81 return axios.get(82 getEndpoint(scannedId)83 ).then(response => response.data)84 .catch(error => {85 console.log(error.response)86 });87 function getEndpoint(scannedId) {88 return [89 config.URL,90 '/scanned/',91 scannedId92 ].join('');93 }94 },95 searchScanned(query) {96 return axios.get(97 getEndpoint(query)98 ).then(response => response.data)99 .catch(error => {100 console.log(error.response)101 });102 function getEndpoint(query) {103 return [104 config.URL,105 '/scanned/search/',106 query107 ].join('');108 }109 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = require('chromeless')()2 .type('chromeless', 'input[name="q"]')3 .press(13)4 .wait('#resultStats')5 .evaluate(() => {6 })7 .end()8 .catch(console.error.bind(console))9const chromeless = require('chromeless')()10 .type('chromeless', 'input[name="q"]')11 .press(13)12 .wait('#resultStats')13 .evaluate(() => {14 })15 .end()16 .catch(console.error.bind(console))

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless()2async function run() {3 const endpoint = await chromeless.getEndpoint()4 console.log(endpoint)5}6run().then(chromeless.end.bind(chromeless))7const Chromeless = require('chromeless').Chromeless8const endpoint = require('./test')9const chromeless = new Chromeless({ remote: { endpoint } })10async function run() {11 .type('chromeless', 'input[name="q"]')12 .press(13)13 .wait('#resultStats')14 .screenshot()15}16run().then(chromeless.end.bind(chromeless))

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless()2const endpoint = await chromeless.getEndpoint()3console.log(endpoint)4 .type('chromeless', 'input[name="q"]')5 .press(13)6 .wait('#resultStats')7 .screenshot()8console.log(screenshot)9 .type('chromeless', 'input[name="q"]')10 .press(13)11 .wait('#resultStats')12 .screenshot()13console.log(screenshot)14 .type('chromeless', 'input[name="q"]')15 .press(13)16 .wait('#resultStats')17 .screenshot()18console.log(screenshot)19 .type('chromeless', 'input[name="q"]')20 .press(13)21 .wait('#resultStats')22 .screenshot()23console.log(screenshot)24 .type('chromeless', 'input[name="q"]')25 .press(13)26 .wait('#resultStats')27 .screenshot()28console.log(screenshot)

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless()2const endpoint = await chromeless.getEndpoint()3console.log(endpoint)4chromeless.end()5const chromeless = new Chromeless({6 remote: {7 }8})9 .type('chromeless', 'input[name="q"]')10 .press(13)11 .wait('#resultStats')12 .evaluate(() => document.title)13await chromeless.end()14const chromeless = new Chromeless({15 remote: {16 }17})18 .type('chromeless', 'input[name="q"]')19 .press(13)20 .wait('#resultStats')21 .evaluate(() => document.title)22await chromeless.end()23const chromeless = new Chromeless({24 remote: {25 }26})27 .type('chromeless', 'input[name="q"]')28 .press(13)29 .wait('#resultStats')30 .evaluate(() => document.title)31await chromeless.end()32const chromeless = new Chromeless({

Full Screen

Using AI Code Generation

copy

Full Screen

1const getEndpoint = require('chromeless').getEndpoint2const endpoint = getEndpoint()3console.log(endpoint)4{5 "scripts": {6 },7 "dependencies": {8 }9}10#0 0x55d8f5c7a5f9 base::debug::CollectStackTrace()11#1 0x55d8f5a0f6b6 base::debug::StackTrace::StackTrace()12#2 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()13#3 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()14#4 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()15#5 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()16#6 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()17#7 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()18#8 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()19#9 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()20#10 0x55d8f5a0f7b0 base::debug::StackTrace::StackTrace()

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Chromeless } = require('chromeless');2const chromeless = new Chromeless();3 .getEndpoint()4 .then((endpoint) => {5 console.log(endpoint);6 })7 .catch((err) => {8 console.error(err);9 })10 .then(() => {11 chromeless.end();12 });13const { Chromeless } = require('chromeless');14const chromeless = new Chromeless();15 .getEndpoint()16 .then((endpoint) => {17 console.log(endpoint);18 })19 .catch((err) => {20 console.error(err);21 })22 .then(() => {23 chromeless.end();24 });25See [CONTRIBUTING.md](CONTRIBUTING.md)

Full Screen

Using AI Code Generation

copy

Full Screen

1const chromeless = new Chromeless({2 remote: {3 }4})5const endpoint = chromeless.getEndpoint()6console.log(endpoint)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run chromeless automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful