-
Notifications
You must be signed in to change notification settings - Fork 8
/
fqdn_gateway.ts
56 lines (45 loc) · 1.76 KB
/
fqdn_gateway.ts
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
import { FilterOptions, GatewayFQDNModel } from "../src";
import { getClient } from "./client_loader";
import { log } from "./utils";
async function deploy(client, gw) {
const res = await client.gateway.deploy_fqdn(gw);
log("================= Deploying FQDN gateway =================");
log(res);
log("================= Deploying FQDN gateway =================");
}
async function getDeployment(client, gw) {
const res = await client.gateway.getObj(gw);
log("================= Getting deployment information =================");
log(res);
log("================= Getting deployment information =================");
}
async function cancel(client, gw) {
const res = await client.gateway.delete_fqdn(gw);
log("================= Canceling the deployment =================");
log(res);
log("================= Canceling the deployment =================");
}
// read more about the gateway types in this doc: https://github.com/threefoldtech/zos/tree/main/docs/internals/gateway
async function main() {
const grid3 = await getClient();
const gatewayQueryOptions: FilterOptions = {
gateway: true,
farmId: 1,
};
const gw: GatewayFQDNModel = {
name: "applyFQDN",
node_id: +(await grid3.capacity.filterNodes(gatewayQueryOptions))[0].nodeId,
fqdn: "test.hamada.grid.tf",
tls_passthrough: false,
// the backends have to be in this format `http://ip:port` or `https://ip:port`, and the `ip` pingable from the node so using the ygg ip or public ip if available.
backends: ["http://185.206.122.35:8000"],
};
//Deploy VMs
await deploy(grid3, gw);
//Get the deployment
await getDeployment(grid3, gw.name);
//Uncomment the line below to cancel the deployment
// await cancel(grid3, { name: gw.name });
grid3.disconnect();
}
main();