@zuplo/cli 1.34.0 → 1.36.0
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/common/models.js +2 -0
- package/dist/common/settings.js +6 -0
- package/dist/tunnel/delete/handler.js +1 -0
- package/dist/tunnel/delete/poll-teardown-operation.js +3 -3
- package/dist/tunnel/list/handler.js +2 -2
- package/dist/tunnel/services/update/handler.js +1 -0
- package/dist/tunnel/services/update/poll-provisioning-operations.js +3 -3
- package/package.json +1 -1
package/dist/common/settings.js
CHANGED
|
@@ -8,6 +8,12 @@ class Settings {
|
|
|
8
8
|
get POLL_INTERVAL() {
|
|
9
9
|
return parseInt(process.env.POLL_INTERVAL ?? "1000");
|
|
10
10
|
}
|
|
11
|
+
get MAX_PROVISIONING_RETRIES() {
|
|
12
|
+
return parseInt(process.env.MAX_PROVISIONING_RETRIES ?? "60");
|
|
13
|
+
}
|
|
14
|
+
get PROVISIONING_POLL_INTERVAL() {
|
|
15
|
+
return parseInt(process.env.PROVISIONING_INTERVAL ?? "15000");
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
const settings = new Settings();
|
|
13
19
|
export default settings;
|
|
@@ -29,6 +29,7 @@ export async function deleteTunnel(argv) {
|
|
|
29
29
|
printResultToConsoleAndExitGracefully(`Tunnel ${argv["tunnel-id"]} deleted successfully.`);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
+
printDiagnosticsToConsole(polledTearDownOperation.details);
|
|
32
33
|
printCriticalFailureToConsoleAndExit(`Tunnel ${argv["tunnel-id"]} failed to delete. Here's the error: ${polledTearDownOperation.message}`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { logger } from "../../common/logger.js";
|
|
2
2
|
import { printDiagnosticsToConsole } from "../../common/output.js";
|
|
3
3
|
import settings from "../../common/settings.js";
|
|
4
|
-
function wait(duration = settings.
|
|
4
|
+
function wait(duration = settings.PROVISIONING_POLL_INTERVAL) {
|
|
5
5
|
return new Promise((resolve) => setTimeout(resolve, duration));
|
|
6
6
|
}
|
|
7
7
|
export async function pollTeardownOperation(args) {
|
|
8
8
|
const apiKey = args.argv["api-key"];
|
|
9
9
|
const tunnelId = args.argv["tunnel-id"];
|
|
10
|
-
for (let pollRetry = 0; pollRetry < settings.
|
|
11
|
-
printDiagnosticsToConsole(`Polling for teardown operation status... (${pollRetry}/${settings.
|
|
10
|
+
for (let pollRetry = 0; pollRetry < settings.MAX_PROVISIONING_RETRIES; pollRetry++) {
|
|
11
|
+
printDiagnosticsToConsole(`Polling for teardown operation status... (${pollRetry}/${settings.MAX_PROVISIONING_RETRIES})`);
|
|
12
12
|
const response = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${args.account}/tunnels/${tunnelId}/teardown-operations/${args.teardownOperationId}`, {
|
|
13
13
|
method: "GET",
|
|
14
14
|
headers: {
|
|
@@ -18,12 +18,12 @@ export async function list(argv) {
|
|
|
18
18
|
});
|
|
19
19
|
if (listResponse.ok) {
|
|
20
20
|
const tunnels = await listResponse.json();
|
|
21
|
-
if (tunnels.length === 0) {
|
|
21
|
+
if (tunnels.data.length === 0) {
|
|
22
22
|
const output = "No tunnels found";
|
|
23
23
|
printResultToConsoleAndExitGracefully(output);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
const table = tunnels.map((tunnel) => {
|
|
26
|
+
const table = tunnels.data.map((tunnel) => {
|
|
27
27
|
return { "tunnel-id": tunnel.id, name: tunnel.name };
|
|
28
28
|
});
|
|
29
29
|
printTableToConsoleAndExitGracefully(table);
|
|
@@ -39,6 +39,7 @@ export async function updateServices(argv) {
|
|
|
39
39
|
printResultToConsoleAndExitGracefully(`Tunnel ${argv["tunnel-id"]} updated successfully.`);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
+
printDiagnosticsToConsole(polledProvisioningOperation.details);
|
|
42
43
|
printCriticalFailureToConsoleAndExit(`Tunnel ${argv["tunnel-id"]} failed to update. Here's the error: ${polledProvisioningOperation.message}`);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { logger } from "../../../common/logger.js";
|
|
2
2
|
import { printDiagnosticsToConsole } from "../../../common/output.js";
|
|
3
3
|
import settings from "../../../common/settings.js";
|
|
4
|
-
function wait(duration = settings.
|
|
4
|
+
function wait(duration = settings.PROVISIONING_POLL_INTERVAL) {
|
|
5
5
|
return new Promise((resolve) => setTimeout(resolve, duration));
|
|
6
6
|
}
|
|
7
7
|
export async function pollProvisioningOperation(args) {
|
|
8
8
|
const apiKey = args.argv["api-key"];
|
|
9
9
|
const tunnelId = args.argv["tunnel-id"];
|
|
10
|
-
for (let pollRetry = 0; pollRetry < settings.
|
|
11
|
-
printDiagnosticsToConsole(`Polling for provisioning operation status... (${pollRetry}/${settings.
|
|
10
|
+
for (let pollRetry = 0; pollRetry < settings.MAX_PROVISIONING_RETRIES; pollRetry++) {
|
|
11
|
+
printDiagnosticsToConsole(`Polling for provisioning operation status... (${pollRetry}/${settings.MAX_PROVISIONING_RETRIES})`);
|
|
12
12
|
const response = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${args.account}/tunnels/${tunnelId}/provisioning-operations/${args.provisioningOperationId}`, {
|
|
13
13
|
method: "GET",
|
|
14
14
|
headers: {
|