bdy 1.25.13-dev → 1.25.14-dev
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/distTs/package.json +1 -1
- package/distTs/src/agent/manager.js +19 -6
- package/distTs/src/agent/system.js +9 -4
- package/distTs/src/api/client.js +20 -7
- package/distTs/src/cliCommand.js +17 -1
- package/distTs/src/cliIndex.js +12 -2
- package/distTs/src/command/agent/debug.js +4 -3
- package/distTs/src/command/agent/disable.js +4 -3
- package/distTs/src/command/agent/enable.js +4 -3
- package/distTs/src/command/agent/install.js +28 -12
- package/distTs/src/command/agent/proxy/disable.js +4 -3
- package/distTs/src/command/agent/proxy/enable.js +4 -3
- package/distTs/src/command/agent/proxy/status.js +1 -1
- package/distTs/src/command/agent/restart.js +13 -5
- package/distTs/src/command/agent/start.js +11 -4
- package/distTs/src/command/agent/status.js +1 -1
- package/distTs/src/command/agent/stop.js +5 -4
- package/distTs/src/command/agent/tags/get.js +1 -1
- package/distTs/src/command/agent/tags/set.js +4 -3
- package/distTs/src/command/agent/target/disable.js +4 -3
- package/distTs/src/command/agent/target/enable.js +4 -3
- package/distTs/src/command/agent/target/status.js +1 -1
- package/distTs/src/command/agent/tunnel/disable.js +4 -3
- package/distTs/src/command/agent/tunnel/enable.js +4 -3
- package/distTs/src/command/agent/tunnel/http.js +10 -2
- package/distTs/src/command/agent/tunnel/list.js +1 -1
- package/distTs/src/command/agent/tunnel/remove.js +4 -3
- package/distTs/src/command/agent/tunnel/start.js +9 -5
- package/distTs/src/command/agent/tunnel/status.js +1 -1
- package/distTs/src/command/agent/tunnel/tcp.js +10 -2
- package/distTs/src/command/agent/tunnel/tls.js +10 -2
- package/distTs/src/command/agent/uninstall.js +6 -4
- package/distTs/src/command/agent/update.js +13 -5
- package/distTs/src/command/agent/user.js +4 -3
- package/distTs/src/command/agent/version.js +1 -1
- package/distTs/src/command/api/info.js +5 -3
- package/distTs/src/command/api/list.js +1 -0
- package/distTs/src/command/artifact/composer/publish.js +21 -16
- package/distTs/src/command/artifact/delete.js +8 -5
- package/distTs/src/command/artifact/docker/login.js +22 -5
- package/distTs/src/command/artifact/download.js +16 -15
- package/distTs/src/command/artifact/get.js +3 -2
- package/distTs/src/command/artifact/open.js +3 -2
- package/distTs/src/command/artifact/publish.js +3 -2
- package/distTs/src/command/artifact/version/create.js +3 -2
- package/distTs/src/command/artifact/version/delete.js +9 -6
- package/distTs/src/command/artifact/version/get.js +4 -3
- package/distTs/src/command/artifact/version/list.js +3 -2
- package/distTs/src/command/artifact/version/open.js +7 -6
- package/distTs/src/command/config/add/http.js +3 -2
- package/distTs/src/command/config/add/tcp.js +3 -2
- package/distTs/src/command/config/add/tls.js +3 -2
- package/distTs/src/command/config/get/region.js +5 -2
- package/distTs/src/command/config/get/timeout.js +5 -2
- package/distTs/src/command/config/get/token.js +5 -2
- package/distTs/src/command/config/get/tunnel.js +3 -2
- package/distTs/src/command/config/get/tunnels.js +1 -1
- package/distTs/src/command/config/get/whitelist.js +5 -2
- package/distTs/src/command/config/remove/token.js +4 -3
- package/distTs/src/command/config/remove/tunnel.js +6 -4
- package/distTs/src/command/config/set/region.js +4 -3
- package/distTs/src/command/config/set/timeout.js +4 -3
- package/distTs/src/command/config/set/token.js +5 -3
- package/distTs/src/command/config/set/whitelist.js +4 -3
- package/distTs/src/command/crawl/link.js +10 -4
- package/distTs/src/command/crawl/run.js +30 -18
- package/distTs/src/command/distro/delete.js +8 -5
- package/distTs/src/command/distro/get.js +3 -2
- package/distTs/src/command/distro/open.js +3 -2
- package/distTs/src/command/distro/route/create.js +3 -2
- package/distTs/src/command/distro/route/delete.js +8 -5
- package/distTs/src/command/distro/route/get.js +3 -2
- package/distTs/src/command/distro/route/list.js +3 -2
- package/distTs/src/command/distro/route/open.js +3 -2
- package/distTs/src/command/distro/route/update.js +3 -2
- package/distTs/src/command/distro/update.js +3 -2
- package/distTs/src/command/domain/buy.js +36 -17
- package/distTs/src/command/domain/get.js +3 -2
- package/distTs/src/command/domain/list.js +1 -1
- package/distTs/src/command/domain/open.js +4 -2
- package/distTs/src/command/domain/search.js +1 -0
- package/distTs/src/command/environment/create.js +1 -1
- package/distTs/src/command/environment/delete.js +6 -4
- package/distTs/src/command/environment/get.js +1 -0
- package/distTs/src/command/environment/list.js +1 -1
- package/distTs/src/command/environment/open.js +3 -1
- package/distTs/src/command/environment/update.js +1 -1
- package/distTs/src/command/login.js +29 -17
- package/distTs/src/command/logout.js +4 -3
- package/distTs/src/command/pipeline/create.js +13 -3
- package/distTs/src/command/pipeline/delete.js +9 -6
- package/distTs/src/command/pipeline/get.js +4 -3
- package/distTs/src/command/pipeline/open.js +2 -1
- package/distTs/src/command/pipeline/run/execution.js +3 -3
- package/distTs/src/command/pipeline/run/list.js +4 -3
- package/distTs/src/command/pipeline/run/open.js +2 -1
- package/distTs/src/command/pipeline/update.js +4 -3
- package/distTs/src/command/pipeline/yaml.js +4 -3
- package/distTs/src/command/project/link.js +74 -36
- package/distTs/src/command/project/list.js +1 -0
- package/distTs/src/command/project/open.js +3 -1
- package/distTs/src/command/register.js +2 -1
- package/distTs/src/command/sandbox/app/add.js +1 -0
- package/distTs/src/command/sandbox/app/list.js +1 -1
- package/distTs/src/command/sandbox/app/logs.js +1 -1
- package/distTs/src/command/sandbox/app/remove.js +4 -3
- package/distTs/src/command/sandbox/app/start.js +4 -3
- package/distTs/src/command/sandbox/app/status.js +3 -2
- package/distTs/src/command/sandbox/app/stop.js +4 -3
- package/distTs/src/command/sandbox/cp.js +23 -23
- package/distTs/src/command/sandbox/create.js +3 -1
- package/distTs/src/command/sandbox/destroy.js +6 -4
- package/distTs/src/command/sandbox/endpoint/add.js +1 -1
- package/distTs/src/command/sandbox/endpoint/delete.js +9 -6
- package/distTs/src/command/sandbox/endpoint/get.js +3 -2
- package/distTs/src/command/sandbox/endpoint/list.js +1 -1
- package/distTs/src/command/sandbox/exec/command.js +1 -0
- package/distTs/src/command/sandbox/exec/kill.js +7 -5
- package/distTs/src/command/sandbox/exec/list.js +1 -1
- package/distTs/src/command/sandbox/exec/logs.js +1 -1
- package/distTs/src/command/sandbox/exec/status.js +1 -1
- package/distTs/src/command/sandbox/get.js +1 -1
- package/distTs/src/command/sandbox/list.js +1 -1
- package/distTs/src/command/sandbox/logs.js +1 -1
- package/distTs/src/command/sandbox/open.js +3 -1
- package/distTs/src/command/sandbox/restart.js +9 -4
- package/distTs/src/command/sandbox/snapshot/create.js +1 -1
- package/distTs/src/command/sandbox/snapshot/delete.js +8 -5
- package/distTs/src/command/sandbox/snapshot/get.js +3 -2
- package/distTs/src/command/sandbox/snapshot/list.js +1 -1
- package/distTs/src/command/sandbox/snapshot/open.js +4 -2
- package/distTs/src/command/sandbox/ssh.js +1 -0
- package/distTs/src/command/sandbox/start.js +9 -4
- package/distTs/src/command/sandbox/status.js +1 -1
- package/distTs/src/command/sandbox/stop.js +9 -4
- package/distTs/src/command/sandbox/update.js +12 -6
- package/distTs/src/command/sandbox/yaml.js +1 -1
- package/distTs/src/command/target/create.js +1 -0
- package/distTs/src/command/target/delete.js +6 -3
- package/distTs/src/command/target/exec/command.js +1 -1
- package/distTs/src/command/target/exec/kill.js +6 -4
- package/distTs/src/command/target/exec/list.js +1 -1
- package/distTs/src/command/target/exec/logs.js +1 -1
- package/distTs/src/command/target/exec/status.js +1 -1
- package/distTs/src/command/target/get.js +1 -0
- package/distTs/src/command/target/list.js +1 -0
- package/distTs/src/command/target/open.js +3 -1
- package/distTs/src/command/target/scope.js +4 -4
- package/distTs/src/command/target/update.js +1 -0
- package/distTs/src/command/tests/capture.js +10 -7
- package/distTs/src/command/tests/unit/link.js +10 -4
- package/distTs/src/command/tests/visual/link.js +10 -4
- package/distTs/src/command/tests/visual/session/close.js +8 -3
- package/distTs/src/command/tests/visual/setup.js +6 -3
- package/distTs/src/command/tests/visual/upload.js +11 -8
- package/distTs/src/command/tunnel/http.js +6 -2
- package/distTs/src/command/tunnel/start.js +8 -3
- package/distTs/src/command/tunnel/tcp.js +6 -3
- package/distTs/src/command/tunnel/tls.js +6 -3
- package/distTs/src/command/version.js +24 -2
- package/distTs/src/command/whoami.js +1 -1
- package/distTs/src/command/workspace/get.js +7 -2
- package/distTs/src/command/workspace/list.js +1 -1
- package/distTs/src/command/workspace/open.js +4 -2
- package/distTs/src/command/workspace/set.js +4 -3
- package/distTs/src/command/yaml/actions/info.js +1 -1
- package/distTs/src/command/yaml/actions/list.js +1 -1
- package/distTs/src/command/yaml/pipeline.js +1 -0
- package/distTs/src/command/yaml/validate.js +1 -0
- package/distTs/src/discovery.js +169 -50
- package/distTs/src/input.js +6 -6
- package/distTs/src/output.js +72 -33
- package/distTs/src/texts.js +103 -42
- package/distTs/src/tunnel/output/noninteractive/tunnelJsonl.js +62 -0
- package/distTs/src/utils.js +19 -0
- package/distTs/src/visualTest/browser.js +3 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_LIST, { examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST });
|
|
10
|
+
const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST });
|
|
11
11
|
commandSandboxEndpointList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointList);
|
|
13
13
|
commandSandboxEndpointList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const finishExec_1 = require("../finishExec");
|
|
11
11
|
const commandSandboxExecCommand = (0, utils_1.newCommand)('command', texts_1.DESC_COMMAND_SANDBOX_EXEC_COMMAND, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE],
|
|
12
13
|
helpText: texts_1.HELP_SANDBOX_EXEC_COMMAND_JSONL,
|
|
13
14
|
examples: texts_1.EXAMPLE_SANDBOX_EXEC_COMMAND,
|
|
14
15
|
});
|
|
@@ -7,19 +7,21 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_SANDBOX_EXEC_KILL, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_KILL });
|
|
10
|
+
const commandSandboxExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_SANDBOX_EXEC_KILL, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE], examples: texts_1.EXAMPLE_SANDBOX_EXEC_KILL });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecKill);
|
|
12
12
|
commandSandboxExecKill.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
13
|
+
commandSandboxExecKill.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxExecKill.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxExecKill.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
15
16
|
commandSandboxExecKill.action(async (identifier, commandId, options) => {
|
|
16
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
18
|
const client = input_1.default.restApiTokenClient();
|
|
18
19
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
19
|
-
const
|
|
20
|
+
const json = options.format === 'json';
|
|
21
|
+
const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.OPTION_SANDBOX_COMMAND_KILL_CONFIRM)(identifier, commandId), json);
|
|
20
22
|
if (!confirmed)
|
|
21
|
-
output_1.default.
|
|
22
|
-
await client.terminateSandboxCommand(workspace, sandboxId, commandId);
|
|
23
|
-
output_1.default.
|
|
23
|
+
output_1.default.exitResult(json, { killed: null });
|
|
24
|
+
const result = await client.terminateSandboxCommand(workspace, sandboxId, commandId);
|
|
25
|
+
output_1.default.exitResult(json, result, (0, texts_1.TXT_SANDBOX_COMMAND_KILLED)(commandId));
|
|
24
26
|
});
|
|
25
27
|
exports.default = commandSandboxExecKill;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_EXEC_LIST, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_LIST });
|
|
10
|
+
const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_EXEC_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_EXEC_LIST });
|
|
11
11
|
commandSandboxExecList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecList);
|
|
13
13
|
commandSandboxExecList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -8,7 +8,7 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const finishExec_1 = require("../finishExec");
|
|
11
|
-
const commandSandboxExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_EXEC_LOGS, { helpText: texts_1.HELP_SANDBOX_EXEC_JSONL, examples: texts_1.EXAMPLE_SANDBOX_EXEC_LOGS });
|
|
11
|
+
const commandSandboxExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_EXEC_LOGS, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], helpText: texts_1.HELP_SANDBOX_EXEC_JSONL, examples: texts_1.EXAMPLE_SANDBOX_EXEC_LOGS });
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecLogs);
|
|
13
13
|
commandSandboxExecLogs.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
|
|
14
14
|
commandSandboxExecLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_STATUS, helpText: texts_1.HELP_SANDBOX_EXEC_STATUS });
|
|
10
|
+
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_EXEC_STATUS, helpText: texts_1.HELP_SANDBOX_EXEC_STATUS });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecStatus);
|
|
12
12
|
commandSandboxExecStatus.option('--format <text|json>', texts_1.OPTION_EXEC_FORMAT_JSON);
|
|
13
13
|
commandSandboxExecStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_GET);
|
|
10
|
+
const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_GET, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ] });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxGet);
|
|
12
12
|
commandSandboxGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandSandboxGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_LIST);
|
|
10
|
+
const commandSandboxList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ] });
|
|
11
11
|
commandSandboxList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxList);
|
|
13
13
|
commandSandboxList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandSandboxLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_LOGS, { examples: texts_1.EXAMPLE_SANDBOX_LOGS });
|
|
10
|
+
const commandSandboxLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_LOGS, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_LOGS });
|
|
11
11
|
commandSandboxLogs.hideVersionUpdate = true;
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxLogs);
|
|
13
13
|
commandSandboxLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -8,15 +8,17 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandSandboxOpen = (0, utils_1.newCommand)('open', texts_1.DESC_COMMAND_RESOURCE_OPEN, {
|
|
11
|
+
requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ],
|
|
11
12
|
examples: [{ description: 'Open a sandbox in Buddy', command: 'bdy sb open my-sandbox' }],
|
|
12
13
|
});
|
|
13
14
|
(0, utils_1.sandboxScopeOptions)(commandSandboxOpen);
|
|
15
|
+
commandSandboxOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
16
|
commandSandboxOpen.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
17
|
commandSandboxOpen.action(async (identifier, options) => {
|
|
16
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
19
|
const client = input_1.default.restApiTokenClient();
|
|
18
20
|
const id = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
19
21
|
const sandbox = await client.getSandbox(workspace, id);
|
|
20
|
-
await output_1.default.openUrl(sandbox.html_url);
|
|
22
|
+
await output_1.default.openUrl(sandbox.html_url, options.format === 'json');
|
|
21
23
|
});
|
|
22
24
|
exports.default = commandSandboxOpen;
|
|
@@ -7,17 +7,20 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxRestart = (0, utils_1.newCommand)('restart', texts_1.DESC_COMMAND_SANDBOX_RESTART);
|
|
10
|
+
const commandSandboxRestart = (0, utils_1.newCommand)('restart', texts_1.DESC_COMMAND_SANDBOX_RESTART, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE] });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxRestart);
|
|
12
12
|
commandSandboxRestart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
13
|
+
commandSandboxRestart.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxRestart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxRestart.action(async (identifier, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
17
|
const client = input_1.default.restApiTokenClient();
|
|
17
18
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
-
|
|
19
|
+
const json = options.format === 'json';
|
|
20
|
+
let result = await client.restartSandbox(workspace, sandboxId);
|
|
19
21
|
if (options.wait) {
|
|
20
|
-
|
|
22
|
+
if (!json)
|
|
23
|
+
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
21
24
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
22
25
|
try {
|
|
23
26
|
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
@@ -28,7 +31,9 @@ commandSandboxRestart.action(async (identifier, options) => {
|
|
|
28
31
|
catch {
|
|
29
32
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_TIMEOUT);
|
|
30
33
|
}
|
|
34
|
+
if (json)
|
|
35
|
+
result = await client.getSandbox(workspace, sandboxId);
|
|
31
36
|
}
|
|
32
|
-
output_1.default.
|
|
37
|
+
output_1.default.exitResult(json, result, (0, texts_1.TXT_SANDBOX_STARTED)(identifier));
|
|
33
38
|
});
|
|
34
39
|
exports.default = commandSandboxRestart;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxSnapshotCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE, { examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_CREATE });
|
|
10
|
+
const commandSandboxSnapshotCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE], examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_CREATE });
|
|
11
11
|
commandSandboxSnapshotCreate.alias('add');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotCreate);
|
|
13
13
|
commandSandboxSnapshotCreate.option('-n, --name <name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME);
|
|
@@ -3,14 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
10
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxSnapshotDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE, { examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_DELETE });
|
|
11
|
+
const commandSandboxSnapshotDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_MANAGE], examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_DELETE });
|
|
11
12
|
commandSandboxSnapshotDelete.alias('rm');
|
|
12
13
|
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotDelete);
|
|
13
14
|
commandSandboxSnapshotDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
15
|
+
commandSandboxSnapshotDelete.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
16
|
commandSandboxSnapshotDelete.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
17
|
commandSandboxSnapshotDelete.argument('<snapshot-name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME_ARG);
|
|
16
18
|
commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) => {
|
|
@@ -21,12 +23,13 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
|
|
|
21
23
|
const snapshots = snapshotsResult.snapshots || [];
|
|
22
24
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
23
25
|
if (!foundSnapshot) {
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
|
|
26
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND, texts_1.HINT_SANDBOX_SNAPSHOT_LIST));
|
|
25
27
|
}
|
|
26
|
-
const
|
|
28
|
+
const json = options.format === 'json';
|
|
29
|
+
const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM)(identifier, snapshotName), json);
|
|
27
30
|
if (!confirmed)
|
|
28
|
-
output_1.default.
|
|
31
|
+
output_1.default.exitResult(json, { deleted: null });
|
|
29
32
|
await client.deleteSandboxSnapshot(workspace, sandboxId, foundSnapshot.id);
|
|
30
|
-
output_1.default.
|
|
33
|
+
output_1.default.exitResult(json, { deleted: snapshotName }, (0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETED)(snapshotName));
|
|
31
34
|
});
|
|
32
35
|
exports.default = commandSandboxSnapshotDelete;
|
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
6
7
|
const utils_1 = require("../../../utils");
|
|
7
8
|
const texts_1 = require("../../../texts");
|
|
8
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
10
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxSnapshotGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_GET, { examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_GET });
|
|
11
|
+
const commandSandboxSnapshotGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_GET, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_GET });
|
|
11
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotGet);
|
|
12
13
|
commandSandboxSnapshotGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxSnapshotGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -20,7 +21,7 @@ commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
|
|
|
20
21
|
const snapshots = snapshotsResult.snapshots || [];
|
|
21
22
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
22
23
|
if (!foundSnapshot) {
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
|
|
24
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND, texts_1.HINT_SANDBOX_SNAPSHOT_LIST));
|
|
24
25
|
}
|
|
25
26
|
const snapshot = await client.getSandboxSnapshot(workspace, sandboxId, foundSnapshot.id);
|
|
26
27
|
if (options.format === 'json') {
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxSnapshotList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST, { examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_LIST });
|
|
10
|
+
const commandSandboxSnapshotList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ], examples: texts_1.EXAMPLE_SANDBOX_SNAPSHOT_LIST });
|
|
11
11
|
commandSandboxSnapshotList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotList);
|
|
13
13
|
commandSandboxSnapshotList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -9,9 +9,11 @@ const input_1 = __importDefault(require("../../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
11
11
|
const commandSandboxSnapshotOpen = (0, utils_1.newCommand)('open', texts_1.DESC_COMMAND_RESOURCE_OPEN, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ],
|
|
12
13
|
examples: [{ description: 'Open a sandbox snapshot in Buddy', command: 'bdy sb snap open my-sandbox backup' }],
|
|
13
14
|
});
|
|
14
15
|
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotOpen);
|
|
16
|
+
commandSandboxSnapshotOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
17
|
commandSandboxSnapshotOpen.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
18
|
commandSandboxSnapshotOpen.argument('<snapshot-name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME_ARG);
|
|
17
19
|
commandSandboxSnapshotOpen.action(async (identifier, snapshotName, options) => {
|
|
@@ -21,8 +23,8 @@ commandSandboxSnapshotOpen.action(async (identifier, snapshotName, options) => {
|
|
|
21
23
|
const response = await client.listSandboxSnapshots(workspace, sandboxId);
|
|
22
24
|
const found = (response.snapshots || []).find((item) => item.name === snapshotName);
|
|
23
25
|
if (!found)
|
|
24
|
-
throw new cliError_1.default('not_found', texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
|
|
26
|
+
throw new cliError_1.default('not_found', texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND, texts_1.HINT_SANDBOX_SNAPSHOT_LIST);
|
|
25
27
|
const snapshot = await client.getSandboxSnapshot(workspace, sandboxId, found.id);
|
|
26
|
-
await output_1.default.openUrl(snapshot.html_url);
|
|
28
|
+
await output_1.default.openUrl(snapshot.html_url, options.format === 'json');
|
|
27
29
|
});
|
|
28
30
|
exports.default = commandSandboxSnapshotOpen;
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const commandSandboxSsh = (0, utils_1.newCommand)('ssh', texts_1.DESC_COMMAND_SANDBOX_SSH, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ],
|
|
12
13
|
examples: texts_1.EXAMPLE_SANDBOX_SSH,
|
|
13
14
|
});
|
|
14
15
|
commandSandboxSsh.alias('connect');
|
|
@@ -7,17 +7,20 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_SANDBOX_START);
|
|
10
|
+
const commandSandboxStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_SANDBOX_START, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE] });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxStart);
|
|
12
12
|
commandSandboxStart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
13
|
+
commandSandboxStart.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxStart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxStart.action(async (identifier, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
17
|
const client = input_1.default.restApiTokenClient();
|
|
17
18
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
-
|
|
19
|
+
const json = options.format === 'json';
|
|
20
|
+
let result = await client.startSandbox(workspace, sandboxId);
|
|
19
21
|
if (options.wait) {
|
|
20
|
-
|
|
22
|
+
if (!json)
|
|
23
|
+
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
21
24
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
22
25
|
try {
|
|
23
26
|
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
@@ -28,7 +31,9 @@ commandSandboxStart.action(async (identifier, options) => {
|
|
|
28
31
|
catch {
|
|
29
32
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_TIMEOUT);
|
|
30
33
|
}
|
|
34
|
+
if (json)
|
|
35
|
+
result = await client.getSandbox(workspace, sandboxId);
|
|
31
36
|
}
|
|
32
|
-
output_1.default.
|
|
37
|
+
output_1.default.exitResult(json, result, (0, texts_1.TXT_SANDBOX_STARTED)(identifier));
|
|
33
38
|
});
|
|
34
39
|
exports.default = commandSandboxStart;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_STATUS);
|
|
10
|
+
const commandSandboxStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_STATUS, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ] });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxStatus);
|
|
12
12
|
commandSandboxStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandSandboxStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -7,17 +7,20 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandSandboxStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_SANDBOX_STOP);
|
|
10
|
+
const commandSandboxStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_SANDBOX_STOP, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE] });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxStop);
|
|
12
12
|
commandSandboxStop.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
13
|
+
commandSandboxStop.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxStop.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxStop.action(async (identifier, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
17
|
const client = input_1.default.restApiTokenClient();
|
|
17
18
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
-
|
|
19
|
+
const json = options.format === 'json';
|
|
20
|
+
let result = await client.stopSandbox(workspace, sandboxId);
|
|
19
21
|
if (options.wait) {
|
|
20
|
-
|
|
22
|
+
if (!json)
|
|
23
|
+
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_STOP);
|
|
21
24
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
22
25
|
try {
|
|
23
26
|
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
@@ -28,7 +31,9 @@ commandSandboxStop.action(async (identifier, options) => {
|
|
|
28
31
|
catch {
|
|
29
32
|
output_1.default.exitError(texts_1.ERR_SANDBOX_STOP_TIMEOUT);
|
|
30
33
|
}
|
|
34
|
+
if (json)
|
|
35
|
+
result = await client.getSandbox(workspace, sandboxId);
|
|
31
36
|
}
|
|
32
|
-
output_1.default.
|
|
37
|
+
output_1.default.exitResult(json, result, (0, texts_1.TXT_SANDBOX_STOPPED)(identifier));
|
|
33
38
|
});
|
|
34
39
|
exports.default = commandSandboxStop;
|
|
@@ -7,12 +7,13 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandSandboxUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_SANDBOX_UPDATE);
|
|
10
|
+
const commandSandboxUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_SANDBOX_UPDATE, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_WRITE] });
|
|
11
11
|
commandSandboxUpdate.alias('edit');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxUpdate);
|
|
13
13
|
commandSandboxUpdate.option('--wait-for-running [seconds]', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
|
|
14
14
|
commandSandboxUpdate.option('--wait-for-configured [seconds]', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
|
|
15
15
|
commandSandboxUpdate.option('--wait-for-apps [seconds]', texts_1.OPTION_SANDBOX_WAIT_APPS);
|
|
16
|
+
commandSandboxUpdate.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
16
17
|
commandSandboxUpdate.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
17
18
|
commandSandboxUpdate.argument('<yaml|@yaml path>', texts_1.OPTION_SANDBOX_YAML);
|
|
18
19
|
commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
@@ -24,9 +25,11 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
24
25
|
const body = {
|
|
25
26
|
yaml: Buffer.from(yaml, 'utf8').toString('base64'),
|
|
26
27
|
};
|
|
27
|
-
const
|
|
28
|
+
const json = options.format === 'json';
|
|
29
|
+
const say = output_1.default.progress(json);
|
|
30
|
+
let result = await client.updateSandboxByYaml(workspace, sandboxId, body);
|
|
28
31
|
if (options.waitForRunning) {
|
|
29
|
-
|
|
32
|
+
say(texts_1.TXT_SANDBOX_WAITING_RUNNING);
|
|
30
33
|
const timeout = parseInt(options.waitForRunning, 10) || 300;
|
|
31
34
|
try {
|
|
32
35
|
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
@@ -39,7 +42,7 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
if (options.waitForConfigured) {
|
|
42
|
-
|
|
45
|
+
say(texts_1.TXT_SANDBOX_WAITING_SETUP);
|
|
43
46
|
const timeout = parseInt(options.waitForConfigured, 10) || 300;
|
|
44
47
|
try {
|
|
45
48
|
const status = await client.sandboxWaitForConfigured(workspace, sandboxId, timeout);
|
|
@@ -52,7 +55,7 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
if (options.waitForApps) {
|
|
55
|
-
|
|
58
|
+
say(texts_1.TXT_SANDBOX_WAITING_APPS);
|
|
56
59
|
const timeout = parseInt(options.waitForApps, 10) || 300;
|
|
57
60
|
try {
|
|
58
61
|
const status = await client.sandboxWaitForApps(workspace, sandboxId, timeout);
|
|
@@ -64,6 +67,9 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
64
67
|
output_1.default.exitError(texts_1.ERR_SANDBOX_APPS_TIMEOUT);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
if (json &&
|
|
71
|
+
(options.waitForRunning || options.waitForConfigured || options.waitForApps))
|
|
72
|
+
result = await client.getSandbox(workspace, sandboxId);
|
|
73
|
+
output_1.default.exitResult(json, result, (0, texts_1.TXT_SANDBOX_UPDATED)(result.identifier, result.html_url));
|
|
68
74
|
});
|
|
69
75
|
exports.default = commandSandboxUpdate;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandSandboxYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_SANDBOX_GET_YAML);
|
|
10
|
+
const commandSandboxYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_SANDBOX_GET_YAML, { requiredScopes: [utils_1.REST_API_SCOPE.SANDBOX_READ] });
|
|
11
11
|
commandSandboxYaml.hideVersionUpdate = true;
|
|
12
12
|
commandSandboxYaml.alias('yml');
|
|
13
13
|
(0, utils_1.sandboxScopeOptions)(commandSandboxYaml);
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_TARGET_CREATE, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_WRITE],
|
|
12
13
|
examples: texts_1.EXAMPLE_TARGET_CREATE,
|
|
13
14
|
});
|
|
14
15
|
commandTargetCreate.alias('add');
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_TARGET_DELETE, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_MANAGE],
|
|
12
13
|
examples: texts_1.EXAMPLE_TARGET_DELETE,
|
|
13
14
|
});
|
|
14
15
|
commandTargetDelete.alias('rm');
|
|
@@ -17,16 +18,18 @@ commandTargetDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJE
|
|
|
17
18
|
commandTargetDelete.option('--pipeline <identifier>', texts_1.OPTION_TARGET_PIPELINE);
|
|
18
19
|
commandTargetDelete.option('--environment <identifier>', texts_1.OPTION_TARGET_ENVIRONMENT);
|
|
19
20
|
commandTargetDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
21
|
+
commandTargetDelete.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
20
22
|
commandTargetDelete.argument('<identifier>', texts_1.OPTION_TARGET_IDENTIFIER);
|
|
21
23
|
commandTargetDelete.action(async (identifier, options) => {
|
|
22
24
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
23
25
|
const client = input_1.default.restApiTokenClient();
|
|
24
26
|
const target_id = await (0, scope_1.resolveTargetId)(client, workspace, identifier, options,
|
|
25
27
|
/* strictLine */ true);
|
|
26
|
-
const
|
|
28
|
+
const json = options.format === 'json';
|
|
29
|
+
const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.TXT_TARGET_DELETE_CONFIRM)(identifier), json);
|
|
27
30
|
if (!confirmed)
|
|
28
|
-
output_1.default.
|
|
31
|
+
output_1.default.exitResult(json, { deleted: null });
|
|
29
32
|
await client.deleteTarget(workspace, target_id);
|
|
30
|
-
output_1.default.
|
|
33
|
+
output_1.default.exitResult(json, { deleted: identifier }, (0, texts_1.TXT_TARGET_DELETED)(identifier));
|
|
31
34
|
});
|
|
32
35
|
exports.default = commandTargetDelete;
|
|
@@ -10,7 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
10
10
|
const input_1 = __importDefault(require("../../../input"));
|
|
11
11
|
const scope_1 = require("../scope");
|
|
12
12
|
const EXEC_WAIT_MS = 10000;
|
|
13
|
-
const commandTargetExecCommand = (0, utils_1.newCommand)('command', texts_1.DESC_COMMAND_TARGET_EXEC_COMMAND, { examples: texts_1.EXAMPLE_TARGET_EXEC_COMMAND, helpText: texts_1.HELP_TARGET_EXEC_COMMAND });
|
|
13
|
+
const commandTargetExecCommand = (0, utils_1.newCommand)('command', texts_1.DESC_COMMAND_TARGET_EXEC_COMMAND, { requiredScopes: [utils_1.REST_API_SCOPE.TARGET_USE], examples: texts_1.EXAMPLE_TARGET_EXEC_COMMAND, helpText: texts_1.HELP_TARGET_EXEC_COMMAND });
|
|
14
14
|
commandTargetExecCommand.alias('cmd');
|
|
15
15
|
commandTargetExecCommand.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
16
|
commandTargetExecCommand.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
@@ -7,9 +7,10 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandTargetExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_TARGET_EXEC_KILL, { examples: texts_1.EXAMPLE_TARGET_EXEC_KILL });
|
|
10
|
+
const commandTargetExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_TARGET_EXEC_KILL, { requiredScopes: [utils_1.REST_API_SCOPE.TARGET_USE], examples: texts_1.EXAMPLE_TARGET_EXEC_KILL });
|
|
11
11
|
commandTargetExecKill.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandTargetExecKill.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
13
|
+
commandTargetExecKill.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandTargetExecKill.argument('<exec-id>', texts_1.OPTION_TARGET_EXEC_ID);
|
|
14
15
|
commandTargetExecKill.action(async (execId, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -20,10 +21,11 @@ commandTargetExecKill.action(async (execId, options) => {
|
|
|
20
21
|
// the DELETE itself surfaces the 404, so the extra request is skipped.
|
|
21
22
|
if (!options.force)
|
|
22
23
|
await client.getTargetExec(workspace, execId);
|
|
23
|
-
const
|
|
24
|
+
const json = options.format === 'json';
|
|
25
|
+
const confirmed = await output_1.default.confirmDestructive(options.force, (0, texts_1.TXT_TARGET_EXEC_KILL_CONFIRM)(execId), json);
|
|
24
26
|
if (!confirmed)
|
|
25
|
-
output_1.default.
|
|
27
|
+
output_1.default.exitResult(json, { killed: null });
|
|
26
28
|
await client.cancelTargetExec(workspace, execId);
|
|
27
|
-
output_1.default.
|
|
29
|
+
output_1.default.exitResult(json, { killed: execId }, (0, texts_1.TXT_TARGET_EXEC_KILLED)(execId));
|
|
28
30
|
});
|
|
29
31
|
exports.default = commandTargetExecKill;
|
|
@@ -8,7 +8,7 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const scope_1 = require("../scope");
|
|
11
|
-
const commandTargetExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_TARGET_EXEC_LIST, { examples: texts_1.EXAMPLE_TARGET_EXEC_LIST });
|
|
11
|
+
const commandTargetExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_TARGET_EXEC_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ], examples: texts_1.EXAMPLE_TARGET_EXEC_LIST });
|
|
12
12
|
commandTargetExecList.alias('ls');
|
|
13
13
|
commandTargetExecList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
14
|
commandTargetExecList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
@@ -8,7 +8,7 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const scope_1 = require("../scope");
|
|
11
|
-
const commandTargetExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_TARGET_EXEC_LOGS, { helpText: texts_1.HELP_TARGET_EXEC_LOGS_JSONL, examples: texts_1.EXAMPLE_TARGET_EXEC_LOGS });
|
|
11
|
+
const commandTargetExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_TARGET_EXEC_LOGS, { requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ], helpText: texts_1.HELP_TARGET_EXEC_LOGS_JSONL, examples: texts_1.EXAMPLE_TARGET_EXEC_LOGS });
|
|
12
12
|
commandTargetExecLogs.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandTargetExecLogs.option('--offset <n>', texts_1.OPTION_TARGET_EXEC_LOG_OFFSET);
|
|
14
14
|
commandTargetExecLogs.option('--limit <n>', texts_1.OPTION_TARGET_EXEC_LOG_LIMIT);
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandTargetExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_TARGET_EXEC_STATUS, { examples: texts_1.EXAMPLE_TARGET_EXEC_STATUS, helpText: texts_1.HELP_TARGET_EXEC_STATUS });
|
|
10
|
+
const commandTargetExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_TARGET_EXEC_STATUS, { requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ], examples: texts_1.EXAMPLE_TARGET_EXEC_STATUS, helpText: texts_1.HELP_TARGET_EXEC_STATUS });
|
|
11
11
|
commandTargetExecStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandTargetExecStatus.option('--format <text|json>', texts_1.OPTION_EXEC_FORMAT_JSON);
|
|
13
13
|
commandTargetExecStatus.argument('<exec-id>', texts_1.OPTION_TARGET_EXEC_ID);
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_TARGET_GET, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ],
|
|
12
13
|
examples: texts_1.EXAMPLE_TARGET_GET,
|
|
13
14
|
});
|
|
14
15
|
commandTargetGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_TARGET_LIST, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ],
|
|
12
13
|
examples: texts_1.EXAMPLE_TARGET_LIST,
|
|
13
14
|
});
|
|
14
15
|
commandTargetList.alias('ls');
|
|
@@ -9,18 +9,20 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetOpen = (0, utils_1.newCommand)('open', texts_1.DESC_COMMAND_RESOURCE_OPEN, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_READ],
|
|
12
13
|
examples: [{ description: 'Open a target in Buddy', command: 'bdy target open my-target' }],
|
|
13
14
|
});
|
|
14
15
|
commandTargetOpen.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
16
|
commandTargetOpen.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
16
17
|
commandTargetOpen.option('--pipeline <identifier>', texts_1.OPTION_TARGET_PIPELINE);
|
|
17
18
|
commandTargetOpen.option('--environment <identifier>', texts_1.OPTION_TARGET_ENVIRONMENT);
|
|
19
|
+
commandTargetOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
18
20
|
commandTargetOpen.argument('<identifier>', texts_1.OPTION_TARGET_IDENTIFIER);
|
|
19
21
|
commandTargetOpen.action(async (identifier, options) => {
|
|
20
22
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
23
|
const client = input_1.default.restApiTokenClient();
|
|
22
24
|
const id = await (0, scope_1.resolveTargetId)(client, workspace, identifier, options);
|
|
23
25
|
const target = await client.getTarget(workspace, id);
|
|
24
|
-
await output_1.default.openUrl(target.html_url);
|
|
26
|
+
await output_1.default.openUrl(target.html_url, options.format === 'json');
|
|
25
27
|
});
|
|
26
28
|
exports.default = commandTargetOpen;
|