-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathzdb.ts
More file actions
66 lines (55 loc) · 1.68 KB
/
Copy pathzdb.ts
File metadata and controls
66 lines (55 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { FilterOptions, ZdbModes, ZDBSModel } from "../src";
import { getClient } from "./client_loader";
import { log } from "./utils";
async function deploy(client, zdb) {
const res = await client.zdbs.deploy(zdb);
log("================= Deploying ZDBs =================");
log(res);
log("================= Deploying ZDBs =================");
}
async function getDeployment(client, zdb) {
const res = await client.zdbs.getObj(zdb);
log("================= Getting deployment information =================");
log(res);
log("================= Getting deployment information =================");
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, zdb) {
const res = await client.zdbs.delete(zdb);
log("================= Canceling the deployment =================");
log(res);
log("================= Canceling the deployment =================");
}
async function main() {
const name = "tttzdbs";
const grid3 = await getClient(`zdb/${name}`);
const zdbQueryOptions: FilterOptions = {
sru: 3,
hru: 3,
availableFor: grid3.twinId,
farmId: 1,
};
const zdbs: ZDBSModel = {
name,
zdbs: [
{
name: "hamada",
node_id: +(await grid3.capacity.filterNodes(zdbQueryOptions))[0].nodeId,
mode: ZdbModes.user,
disk_size: 1,
publicNamespace: false,
password: "testzdb",
},
],
metadata: "",
description: "test zdbs",
};
//Deploy ZDBs
await deploy(grid3, zdbs);
//Get the deployment
await getDeployment(grid3, name);
//Uncomment the line below to cancel the deployment
// await cancel(grid3, { name });
await grid3.disconnect();
}
main();