@slicervm/sdk 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +32 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -877,6 +877,7 @@ var VM = class {
|
|
|
877
877
|
ip;
|
|
878
878
|
createdAt;
|
|
879
879
|
arch;
|
|
880
|
+
tags;
|
|
880
881
|
fs;
|
|
881
882
|
bg;
|
|
882
883
|
transport;
|
|
@@ -887,10 +888,37 @@ var VM = class {
|
|
|
887
888
|
if (init.ip !== void 0) this.ip = init.ip;
|
|
888
889
|
if (init.createdAt !== void 0) this.createdAt = init.createdAt;
|
|
889
890
|
if (init.arch !== void 0) this.arch = init.arch;
|
|
891
|
+
if (init.tags !== void 0) this.tags = init.tags;
|
|
890
892
|
this.fs = new VMFileSystem(transport, this.hostname);
|
|
891
893
|
this.bg = new VMBg(transport, this.hostname);
|
|
892
894
|
}
|
|
893
895
|
// --- lifecycle --------------------------------------------------------
|
|
896
|
+
async getTags() {
|
|
897
|
+
const response = await this.transport.request(
|
|
898
|
+
"GET",
|
|
899
|
+
`/vm/${encodeURIComponent(this.hostname)}/tags`
|
|
900
|
+
);
|
|
901
|
+
this.tags = response.tags;
|
|
902
|
+
return response.tags;
|
|
903
|
+
}
|
|
904
|
+
async updateTags(update) {
|
|
905
|
+
const response = await this.transport.request(
|
|
906
|
+
"PATCH",
|
|
907
|
+
`/vm/${encodeURIComponent(this.hostname)}/tags`,
|
|
908
|
+
update
|
|
909
|
+
);
|
|
910
|
+
this.tags = response.tags;
|
|
911
|
+
return response.tags;
|
|
912
|
+
}
|
|
913
|
+
async addTags(...tags) {
|
|
914
|
+
return this.updateTags({ add: tags });
|
|
915
|
+
}
|
|
916
|
+
async removeTags(...tags) {
|
|
917
|
+
return this.updateTags({ remove: tags });
|
|
918
|
+
}
|
|
919
|
+
async replaceTags(tags) {
|
|
920
|
+
return this.updateTags({ replace: tags });
|
|
921
|
+
}
|
|
894
922
|
async delete() {
|
|
895
923
|
await this.transport.request(
|
|
896
924
|
"DELETE",
|
|
@@ -1347,7 +1375,8 @@ var VMsAPI = class {
|
|
|
1347
1375
|
hostGroup: res.hostGroup ?? hostGroup,
|
|
1348
1376
|
...res.ip !== void 0 && { ip: res.ip },
|
|
1349
1377
|
...res.createdAt !== void 0 && { createdAt: res.createdAt },
|
|
1350
|
-
...res.arch !== void 0 && { arch: res.arch }
|
|
1378
|
+
...res.arch !== void 0 && { arch: res.arch },
|
|
1379
|
+
...req.tags !== void 0 && { tags: [...req.tags] }
|
|
1351
1380
|
});
|
|
1352
1381
|
}
|
|
1353
1382
|
/**
|
|
@@ -1367,7 +1396,8 @@ var VMsAPI = class {
|
|
|
1367
1396
|
hostGroup: found.hostGroup ?? "",
|
|
1368
1397
|
...found.ip !== void 0 && { ip: found.ip },
|
|
1369
1398
|
...found.createdAt !== void 0 && { createdAt: found.createdAt },
|
|
1370
|
-
...found.arch !== void 0 && { arch: found.arch }
|
|
1399
|
+
...found.arch !== void 0 && { arch: found.arch },
|
|
1400
|
+
...found.tags !== void 0 && { tags: found.tags }
|
|
1371
1401
|
});
|
|
1372
1402
|
}
|
|
1373
1403
|
/** Return raw VM metadata across all host groups. */
|