bdy 1.23.17-dev → 1.23.18-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/api/client.js +49 -10
- package/distTs/src/command/environment/delete.js +1 -2
- package/distTs/src/command/environment/get.js +1 -2
- package/distTs/src/command/environment/update.js +1 -2
- package/distTs/src/command/sandbox/app/add.js +4 -9
- package/distTs/src/command/sandbox/app/list.js +3 -8
- package/distTs/src/command/sandbox/app/logs.js +3 -8
- package/distTs/src/command/sandbox/app/remove.js +4 -9
- package/distTs/src/command/sandbox/app/start.js +3 -8
- package/distTs/src/command/sandbox/app/status.js +3 -8
- package/distTs/src/command/sandbox/app/stop.js +3 -8
- package/distTs/src/command/sandbox/cp.js +10 -18
- package/distTs/src/command/sandbox/create.js +26 -6
- package/distTs/src/command/sandbox/destroy.js +3 -8
- package/distTs/src/command/sandbox/endpoint/add.js +3 -7
- package/distTs/src/command/sandbox/endpoint/delete.js +4 -9
- package/distTs/src/command/sandbox/endpoint/get.js +16 -12
- package/distTs/src/command/sandbox/endpoint/list.js +3 -8
- package/distTs/src/command/sandbox/exec/command.js +5 -10
- package/distTs/src/command/sandbox/exec/kill.js +3 -8
- package/distTs/src/command/sandbox/exec/list.js +3 -8
- package/distTs/src/command/sandbox/exec/logs.js +4 -9
- package/distTs/src/command/sandbox/exec/status.js +3 -8
- package/distTs/src/command/sandbox/get.js +7 -9
- package/distTs/src/command/sandbox/list.js +5 -4
- package/distTs/src/command/sandbox/logs.js +3 -8
- package/distTs/src/command/sandbox/restart.js +4 -9
- package/distTs/src/command/sandbox/snapshot/create.js +4 -9
- package/distTs/src/command/sandbox/snapshot/delete.js +4 -9
- package/distTs/src/command/sandbox/snapshot/get.js +4 -9
- package/distTs/src/command/sandbox/snapshot/list.js +7 -9
- package/distTs/src/command/sandbox/ssh.js +7 -10
- package/distTs/src/command/sandbox/start.js +4 -9
- package/distTs/src/command/sandbox/status.js +3 -8
- package/distTs/src/command/sandbox/stop.js +4 -9
- package/distTs/src/command/sandbox/update.js +7 -12
- package/distTs/src/command/sandbox/yaml.js +5 -8
- package/distTs/src/input.js +85 -1
- package/distTs/src/texts.js +12 -9
- package/distTs/src/types/distro.js +1 -0
- package/distTs/src/utils.js +18 -4
- package/package.json +1 -1
|
@@ -8,21 +8,16 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxEndpointGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_GET);
|
|
11
|
-
|
|
12
|
-
commandSandboxEndpointGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointGet);
|
|
13
12
|
commandSandboxEndpointGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
13
|
commandSandboxEndpointGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxEndpointGet.argument('<endpoint-name>', texts_1.OPTION_SANDBOX_ENDPOINT_NAME_ARG);
|
|
16
15
|
commandSandboxEndpointGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET}`);
|
|
17
16
|
commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
25
|
-
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
20
|
+
const sandbox = await client.getSandbox(workspace, sandboxId);
|
|
26
21
|
const endpoints = sandbox.endpoints || [];
|
|
27
22
|
const endpoint = endpoints.find((ep) => ep.name === endpointName);
|
|
28
23
|
if (!endpoint) {
|
|
@@ -46,18 +41,27 @@ commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
|
|
|
46
41
|
data.push(['Whitelist', endpoint.whitelist?.join(', ')]);
|
|
47
42
|
}
|
|
48
43
|
if (endpoint.http) {
|
|
49
|
-
data.push([
|
|
44
|
+
data.push([
|
|
45
|
+
'HTTP2',
|
|
46
|
+
endpoint.http.http2 ? output_1.default.getOkSign() : output_1.default.getCancelSign(),
|
|
47
|
+
]);
|
|
50
48
|
data.push([
|
|
51
49
|
'Verify certificate',
|
|
52
|
-
endpoint.http.verify_certificate
|
|
50
|
+
endpoint.http.verify_certificate
|
|
51
|
+
? output_1.default.getOkSign()
|
|
52
|
+
: output_1.default.getCancelSign(),
|
|
53
53
|
]);
|
|
54
54
|
data.push([
|
|
55
55
|
'Compression',
|
|
56
|
-
endpoint.http.compression
|
|
56
|
+
endpoint.http.compression
|
|
57
|
+
? output_1.default.getOkSign()
|
|
58
|
+
: output_1.default.getCancelSign(),
|
|
57
59
|
]);
|
|
58
60
|
data.push([
|
|
59
61
|
'Log requests',
|
|
60
|
-
endpoint.http.log_requests
|
|
62
|
+
endpoint.http.log_requests
|
|
63
|
+
? output_1.default.getOkSign()
|
|
64
|
+
: output_1.default.getCancelSign(),
|
|
61
65
|
]);
|
|
62
66
|
data.push(['Auth type', endpoint.http.auth_type]);
|
|
63
67
|
if (endpoint.http.serve_path) {
|
|
@@ -9,20 +9,15 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_LIST);
|
|
11
11
|
commandSandboxEndpointList.alias('ls');
|
|
12
|
-
|
|
13
|
-
commandSandboxEndpointList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointList);
|
|
14
13
|
commandSandboxEndpointList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
14
|
commandSandboxEndpointList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
15
|
commandSandboxEndpointList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST}`);
|
|
17
16
|
commandSandboxEndpointList.action(async (identifier, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
25
|
-
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
20
|
+
const sandbox = await client.getSandbox(workspace, sandboxId);
|
|
26
21
|
const endpoints = sandbox.endpoints || [];
|
|
27
22
|
if (options.format === 'json') {
|
|
28
23
|
output_1.default.json(endpoints);
|
|
@@ -9,8 +9,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxExecCommand = (0, utils_1.newCommand)('command', texts_1.DESC_COMMAND_SANDBOX_EXEC);
|
|
11
11
|
commandSandboxExecCommand.alias('cmd');
|
|
12
|
-
|
|
13
|
-
commandSandboxExecCommand.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxExecCommand);
|
|
14
13
|
commandSandboxExecCommand.option('--runtime <runtime>', texts_1.OPTION_SANDBOX_RUNTIME);
|
|
15
14
|
commandSandboxExecCommand.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
|
|
16
15
|
commandSandboxExecCommand.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -19,14 +18,10 @@ commandSandboxExecCommand.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SAN
|
|
|
19
18
|
commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
20
19
|
output_1.default.handleSignals();
|
|
21
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
-
const project = input_1.default.restApiProject(options.project);
|
|
23
21
|
const client = input_1.default.restApiTokenClient();
|
|
24
22
|
const runtime = input_1.default.restApiSandboxExecRuntime(options.runtime);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
28
|
-
}
|
|
29
|
-
const cmdResult = await client.executeSandboxCommand(workspace, sandbox_id, {
|
|
23
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
24
|
+
const cmdResult = await client.executeSandboxCommand(workspace, sandboxId, {
|
|
30
25
|
command,
|
|
31
26
|
runtime,
|
|
32
27
|
});
|
|
@@ -35,7 +30,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
35
30
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_BACKGROUND)(identifier, cmdResult.id));
|
|
36
31
|
}
|
|
37
32
|
else {
|
|
38
|
-
const body = await client.streamSandboxCommandLogs(workspace,
|
|
33
|
+
const body = await client.streamSandboxCommandLogs(workspace, sandboxId, cmdResult.id);
|
|
39
34
|
body.on('data', (data) => {
|
|
40
35
|
if (data) {
|
|
41
36
|
try {
|
|
@@ -52,7 +47,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
52
47
|
}
|
|
53
48
|
});
|
|
54
49
|
body.on('close', async () => {
|
|
55
|
-
const cmdExit = await client.getSandboxCommand(workspace,
|
|
50
|
+
const cmdExit = await client.getSandboxCommand(workspace, sandboxId, cmdResult.id);
|
|
56
51
|
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
57
52
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(identifier, cmdResult.id));
|
|
58
53
|
}
|
|
@@ -8,25 +8,20 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandSandboxExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_SANDBOX_EXEC_KILL);
|
|
11
|
-
|
|
12
|
-
commandSandboxExecKill.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxExecKill);
|
|
13
12
|
commandSandboxExecKill.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
14
13
|
commandSandboxExecKill.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxExecKill.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
16
15
|
commandSandboxExecKill.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_KILL}`);
|
|
17
16
|
commandSandboxExecKill.action(async (identifier, commandId, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
if (!sandbox_id) {
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
25
20
|
const confirmed = options.force ||
|
|
26
21
|
(await output_1.default.confirm((0, texts_1.OPTION_SANDBOX_COMMAND_KILL_CONFIRM)(identifier, commandId)));
|
|
27
22
|
if (!confirmed)
|
|
28
23
|
output_1.default.exitNormal();
|
|
29
|
-
await client.terminateSandboxCommand(workspace,
|
|
24
|
+
await client.terminateSandboxCommand(workspace, sandboxId, commandId);
|
|
30
25
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_COMMAND_KILLED)(commandId));
|
|
31
26
|
});
|
|
32
27
|
exports.default = commandSandboxExecKill;
|
|
@@ -9,20 +9,15 @@ const input_1 = __importDefault(require("../../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_EXEC_LIST);
|
|
11
11
|
commandSandboxExecList.alias('ls');
|
|
12
|
-
|
|
13
|
-
commandSandboxExecList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxExecList);
|
|
14
13
|
commandSandboxExecList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
14
|
commandSandboxExecList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
15
|
commandSandboxExecList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_LIST}`);
|
|
17
16
|
commandSandboxExecList.action(async (identifier, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
25
|
-
const commandsResult = await client.listSandboxCommands(workspace, sandbox_id);
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
20
|
+
const commandsResult = await client.listSandboxCommands(workspace, sandboxId);
|
|
26
21
|
const commands = commandsResult.commands || [];
|
|
27
22
|
commands.sort((a, b) => (b.id || '').localeCompare(a.id || ''));
|
|
28
23
|
if (options.format === 'json') {
|
|
@@ -8,8 +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 commandSandboxExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_EXEC_LOGS);
|
|
11
|
-
|
|
12
|
-
commandSandboxExecLogs.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxExecLogs);
|
|
13
12
|
commandSandboxExecLogs.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
|
|
14
13
|
commandSandboxExecLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxExecLogs.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
@@ -17,13 +16,9 @@ commandSandboxExecLogs.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBO
|
|
|
17
16
|
commandSandboxExecLogs.action(async (identifier, commandId, options) => {
|
|
18
17
|
output_1.default.handleSignals();
|
|
19
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
-
const project = input_1.default.restApiProject(options.project);
|
|
21
19
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
|
-
}
|
|
26
|
-
const body = await client.streamSandboxCommandLogs(workspace, sandbox_id, commandId, !!options.wait);
|
|
20
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
21
|
+
const body = await client.streamSandboxCommandLogs(workspace, sandboxId, commandId, !!options.wait);
|
|
27
22
|
body.on('data', (data) => {
|
|
28
23
|
if (data) {
|
|
29
24
|
try {
|
|
@@ -40,7 +35,7 @@ commandSandboxExecLogs.action(async (identifier, commandId, options) => {
|
|
|
40
35
|
}
|
|
41
36
|
});
|
|
42
37
|
body.on('close', async () => {
|
|
43
|
-
const cmdExit = await client.getSandboxCommand(workspace,
|
|
38
|
+
const cmdExit = await client.getSandboxCommand(workspace, sandboxId, commandId);
|
|
44
39
|
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
45
40
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(identifier, commandId));
|
|
46
41
|
}
|
|
@@ -8,21 +8,16 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
10
|
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS);
|
|
11
|
-
|
|
12
|
-
commandSandboxExecStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxExecStatus);
|
|
13
12
|
commandSandboxExecStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
13
|
commandSandboxExecStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxExecStatus.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
16
15
|
commandSandboxExecStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_STATUS}`);
|
|
17
16
|
commandSandboxExecStatus.action(async (identifier, commandId, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
25
|
-
const cmd = await client.getSandboxCommand(workspace, sandbox_id, commandId);
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
20
|
+
const cmd = await client.getSandboxCommand(workspace, sandboxId, commandId);
|
|
26
21
|
if (options.format === 'json') {
|
|
27
22
|
output_1.default.json(cmd);
|
|
28
23
|
}
|
|
@@ -8,19 +8,14 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_GET);
|
|
11
|
-
|
|
12
|
-
commandSandboxGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxGet);
|
|
13
12
|
commandSandboxGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
13
|
commandSandboxGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxGet.action(async (identifier, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
17
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
+
const sandbox = await client.getSandbox(workspace, sandboxId);
|
|
24
19
|
if (options.format === 'json') {
|
|
25
20
|
output_1.default.json(sandbox);
|
|
26
21
|
}
|
|
@@ -44,7 +39,10 @@ commandSandboxGet.action(async (identifier, options) => {
|
|
|
44
39
|
? `ssh ${sandbox.ssh_host} -p ${sandbox.ssh_port}`
|
|
45
40
|
: '-',
|
|
46
41
|
],
|
|
47
|
-
[
|
|
42
|
+
[
|
|
43
|
+
'SSH via CLI',
|
|
44
|
+
sandbox.identifier ? `bdy sb ssh ${sandbox.identifier}` : '-',
|
|
45
|
+
],
|
|
48
46
|
];
|
|
49
47
|
if (sandbox.endpoints && sandbox.endpoints.length > 0) {
|
|
50
48
|
data.push([
|
|
@@ -9,14 +9,15 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_LIST);
|
|
11
11
|
commandSandboxList.alias('ls');
|
|
12
|
-
|
|
13
|
-
commandSandboxList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxList);
|
|
14
13
|
commandSandboxList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
14
|
commandSandboxList.action(async (options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
|
|
17
|
+
// One scope per call - the endpoint has no "every sandbox in the workspace"
|
|
18
|
+
// mode, so an unfiltered listing returns the workspace-scoped ones only.
|
|
19
|
+
const { project, environmentId } = await input_1.default.sandboxScope(client, workspace, options);
|
|
20
|
+
const result = await client.listSandboxes(workspace, project, environmentId);
|
|
20
21
|
const sandboxes = result.sandboxes || [];
|
|
21
22
|
if (options.format === 'json') {
|
|
22
23
|
output_1.default.json(sandboxes);
|
|
@@ -9,18 +9,13 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandSandboxLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_LOGS);
|
|
11
11
|
commandSandboxLogs.hideVersionUpdate = true;
|
|
12
|
-
|
|
13
|
-
commandSandboxLogs.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxLogs);
|
|
14
13
|
commandSandboxLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxLogs.action(async (identifier, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
const { boot_logs } = await client.getSandbox(workspace, sandbox_id);
|
|
17
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
+
const { boot_logs } = await client.getSandbox(workspace, sandboxId);
|
|
24
19
|
output_1.default.exitNormal((boot_logs || []).join('\n'));
|
|
25
20
|
});
|
|
26
21
|
exports.default = commandSandboxLogs;
|
|
@@ -8,24 +8,19 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxRestart = (0, utils_1.newCommand)('restart', texts_1.DESC_COMMAND_SANDBOX_RESTART);
|
|
11
|
-
|
|
12
|
-
commandSandboxRestart.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxRestart);
|
|
13
12
|
commandSandboxRestart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
14
13
|
commandSandboxRestart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxRestart.action(async (identifier, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
await client.restartSandbox(workspace, sandbox_id);
|
|
17
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
+
await client.restartSandbox(workspace, sandboxId);
|
|
24
19
|
if (options.wait) {
|
|
25
20
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
26
21
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
27
22
|
try {
|
|
28
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
23
|
+
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
29
24
|
if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
30
25
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
|
|
31
26
|
}
|
|
@@ -9,8 +9,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxSnapshotCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE);
|
|
11
11
|
commandSandboxSnapshotCreate.alias('add');
|
|
12
|
-
|
|
13
|
-
commandSandboxSnapshotCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotCreate);
|
|
14
13
|
commandSandboxSnapshotCreate.option('-n, --name <name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME);
|
|
15
14
|
commandSandboxSnapshotCreate.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
15
|
commandSandboxSnapshotCreate.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
@@ -18,24 +17,20 @@ commandSandboxSnapshotCreate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_
|
|
|
18
17
|
commandSandboxSnapshotCreate.action(async (identifier, options) => {
|
|
19
18
|
const humanId = require('human-id').default;
|
|
20
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
|
-
const project = input_1.default.restApiProject(options.project);
|
|
22
20
|
const client = input_1.default.restApiTokenClient();
|
|
23
|
-
const
|
|
24
|
-
if (!sandbox_id) {
|
|
25
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
26
|
-
}
|
|
21
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
27
22
|
const defaultName = 'snapshot-' + humanId({ separator: '-', capitalize: false });
|
|
28
23
|
const snapshotName = options.name || defaultName;
|
|
29
24
|
const body = {
|
|
30
25
|
name: snapshotName,
|
|
31
26
|
};
|
|
32
|
-
const snapshot = await client.createSandboxSnapshot(workspace,
|
|
27
|
+
const snapshot = await client.createSandboxSnapshot(workspace, sandboxId, body);
|
|
33
28
|
const snapshotId = snapshot.id;
|
|
34
29
|
if (options.wait) {
|
|
35
30
|
output_1.default.normal(texts_1.TXT_SANDBOX_SNAPSHOT_WAITING);
|
|
36
31
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
37
32
|
try {
|
|
38
|
-
const status = await client.sandboxWaitForSnapshot(workspace,
|
|
33
|
+
const status = await client.sandboxWaitForSnapshot(workspace, sandboxId, snapshotId, timeout);
|
|
39
34
|
if (status !== utils_1.SANDBOX_SNAPSHOT_STATUS.CREATED) {
|
|
40
35
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_FAILED);
|
|
41
36
|
}
|
|
@@ -9,21 +9,16 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxSnapshotDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE);
|
|
11
11
|
commandSandboxSnapshotDelete.alias('rm');
|
|
12
|
-
|
|
13
|
-
commandSandboxSnapshotDelete.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotDelete);
|
|
14
13
|
commandSandboxSnapshotDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
15
14
|
commandSandboxSnapshotDelete.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
15
|
commandSandboxSnapshotDelete.argument('<snapshot-name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME_ARG);
|
|
17
16
|
commandSandboxSnapshotDelete.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_DELETE}`);
|
|
18
17
|
commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) => {
|
|
19
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
-
const project = input_1.default.restApiProject(options.project);
|
|
21
19
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
|
-
}
|
|
26
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
20
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
21
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandboxId);
|
|
27
22
|
const snapshots = snapshotsResult.snapshots || [];
|
|
28
23
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
29
24
|
if (!foundSnapshot) {
|
|
@@ -33,7 +28,7 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
|
|
|
33
28
|
(await output_1.default.confirm((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM)(identifier, snapshotName)));
|
|
34
29
|
if (!confirmed)
|
|
35
30
|
output_1.default.exitNormal();
|
|
36
|
-
await client.deleteSandboxSnapshot(workspace,
|
|
31
|
+
await client.deleteSandboxSnapshot(workspace, sandboxId, foundSnapshot.id);
|
|
37
32
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETED)(snapshotName));
|
|
38
33
|
});
|
|
39
34
|
exports.default = commandSandboxSnapshotDelete;
|
|
@@ -8,27 +8,22 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxSnapshotGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_GET);
|
|
11
|
-
|
|
12
|
-
commandSandboxSnapshotGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotGet);
|
|
13
12
|
commandSandboxSnapshotGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
13
|
commandSandboxSnapshotGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxSnapshotGet.argument('<snapshot-name>', texts_1.OPTION_SANDBOX_SNAPSHOT_NAME_ARG);
|
|
16
15
|
commandSandboxSnapshotGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_GET}`);
|
|
17
16
|
commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
|
-
}
|
|
25
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
19
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
20
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandboxId);
|
|
26
21
|
const snapshots = snapshotsResult.snapshots || [];
|
|
27
22
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
28
23
|
if (!foundSnapshot) {
|
|
29
24
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
|
|
30
25
|
}
|
|
31
|
-
const snapshot = await client.getSandboxSnapshot(workspace,
|
|
26
|
+
const snapshot = await client.getSandboxSnapshot(workspace, sandboxId, foundSnapshot.id);
|
|
32
27
|
if (options.format === 'json') {
|
|
33
28
|
output_1.default.json(snapshot);
|
|
34
29
|
}
|
|
@@ -9,26 +9,24 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const commandSandboxSnapshotList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST);
|
|
11
11
|
commandSandboxSnapshotList.alias('ls');
|
|
12
|
-
|
|
13
|
-
commandSandboxSnapshotList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
12
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxSnapshotList);
|
|
14
13
|
commandSandboxSnapshotList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
14
|
commandSandboxSnapshotList.argument('[identifier]', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
15
|
commandSandboxSnapshotList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_SNAPSHOT_LIST}`);
|
|
17
16
|
commandSandboxSnapshotList.action(async (identifier, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
18
|
const client = input_1.default.restApiTokenClient();
|
|
21
19
|
let snapshots;
|
|
22
20
|
if (identifier) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
26
|
-
}
|
|
27
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
21
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
22
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandboxId);
|
|
28
23
|
snapshots = snapshotsResult.snapshots || [];
|
|
29
24
|
}
|
|
30
25
|
else {
|
|
31
|
-
|
|
26
|
+
// Exact-scope listing, same as `sandbox list`: project_name, environment_id
|
|
27
|
+
// or neither for the workspace.
|
|
28
|
+
const { project, environmentId } = await input_1.default.sandboxScope(client, workspace, options);
|
|
29
|
+
const result = await client.listSnapshots(workspace, project, environmentId);
|
|
32
30
|
snapshots = result.snapshots || [];
|
|
33
31
|
}
|
|
34
32
|
if (options.format === 'json') {
|
|
@@ -10,8 +10,7 @@ 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
12
|
commandSandboxSsh.alias('connect');
|
|
13
|
-
|
|
14
|
-
commandSandboxSsh.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxSsh);
|
|
15
14
|
commandSandboxSsh.option('-i, --identity <path>', texts_1.OPTION_SANDBOX_SSH_IDENTITY);
|
|
16
15
|
commandSandboxSsh.option('--print', texts_1.OPTION_SANDBOX_SSH_PRINT);
|
|
17
16
|
commandSandboxSsh.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
@@ -51,23 +50,21 @@ const buildSshArgs = (host, port, identity, extra) => {
|
|
|
51
50
|
args.push(host, ...extra);
|
|
52
51
|
return args;
|
|
53
52
|
};
|
|
54
|
-
const quoteArg = (arg) => /[\s'"\\$`*?[\]{}();&|<>#~]/.test(arg)
|
|
53
|
+
const quoteArg = (arg) => /[\s'"\\$`*?[\]{}();&|<>#~]/.test(arg)
|
|
54
|
+
? `'${arg.replace(/'/g, "'\\''")}'`
|
|
55
|
+
: arg;
|
|
55
56
|
commandSandboxSsh.action(async (identifier, args, options) => {
|
|
56
57
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
57
|
-
const project = input_1.default.restApiProject(options.project);
|
|
58
58
|
const client = input_1.default.restApiTokenClient();
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
62
|
-
}
|
|
63
|
-
let sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
59
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
60
|
+
let sandbox = await client.getSandbox(workspace, sandboxId);
|
|
64
61
|
if (sandbox.status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
65
62
|
output_1.default.exitError((0, texts_1.ERR_SANDBOX_NOT_RUNNING)(identifier, sandbox.status || 'UNKNOWN'));
|
|
66
63
|
}
|
|
67
64
|
if (!sandbox.ssh_host || !sandbox.ssh_port) {
|
|
68
65
|
// A sandbox that just became RUNNING may not have its forward port registered yet
|
|
69
66
|
try {
|
|
70
|
-
sandbox = await client.sandboxWaitForPorts(workspace,
|
|
67
|
+
sandbox = await client.sandboxWaitForPorts(workspace, sandboxId, 30);
|
|
71
68
|
}
|
|
72
69
|
catch {
|
|
73
70
|
output_1.default.exitError((0, texts_1.ERR_SANDBOX_SSH_NO_ACCESS)(identifier));
|
|
@@ -8,24 +8,19 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_SANDBOX_START);
|
|
11
|
-
|
|
12
|
-
commandSandboxStart.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxStart);
|
|
13
12
|
commandSandboxStart.option('--wait [seconds]', texts_1.OPTION_SANDBOX_WAIT);
|
|
14
13
|
commandSandboxStart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxStart.action(async (identifier, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
await client.startSandbox(workspace, sandbox_id);
|
|
17
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
+
await client.startSandbox(workspace, sandboxId);
|
|
24
19
|
if (options.wait) {
|
|
25
20
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
26
21
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
27
22
|
try {
|
|
28
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
23
|
+
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
29
24
|
if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
30
25
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
|
|
31
26
|
}
|
|
@@ -8,19 +8,14 @@ const texts_1 = require("../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const commandSandboxStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_STATUS);
|
|
11
|
-
|
|
12
|
-
commandSandboxStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
11
|
+
(0, utils_1.sandboxScopeOptions)(commandSandboxStatus);
|
|
13
12
|
commandSandboxStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
13
|
commandSandboxStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
14
|
commandSandboxStatus.action(async (identifier, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
16
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
17
|
+
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
18
|
+
const sandbox = await client.getSandbox(workspace, sandboxId);
|
|
24
19
|
if (options.format === 'json') {
|
|
25
20
|
output_1.default.json(sandbox);
|
|
26
21
|
}
|