bdy 1.22.43-dev → 1.22.44-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 +3 -2
- package/distTs/src/api/client.js +73 -2
- package/distTs/src/cliIndex.js +2 -0
- package/distTs/src/command/artifact/get.js +16 -9
- package/distTs/src/command/artifact/list.js +23 -8
- package/distTs/src/command/artifact/version/get.js +20 -13
- package/distTs/src/command/artifact/version/list.js +19 -12
- package/distTs/src/command/distro/create.js +40 -0
- package/distTs/src/command/distro/delete.js +38 -0
- package/distTs/src/command/distro/list.js +42 -0
- package/distTs/src/command/distro/route/create.js +50 -0
- package/distTs/src/command/distro/route/delete.js +39 -0
- package/distTs/src/command/distro/route/list.js +54 -0
- package/distTs/src/command/distro/route.js +18 -0
- package/distTs/src/command/distro.js +23 -0
- package/distTs/src/command/domain/buy.js +27 -8
- package/distTs/src/command/domain/get.js +17 -11
- package/distTs/src/command/domain/list.js +13 -6
- package/distTs/src/command/login.js +1 -0
- package/distTs/src/command/pipeline/list.js +1 -1
- package/distTs/src/command/project/list.js +13 -6
- package/distTs/src/command/sandbox/app/list.js +13 -7
- package/distTs/src/command/sandbox/app/status.js +10 -4
- package/distTs/src/command/sandbox/endpoint/get.js +61 -52
- package/distTs/src/command/sandbox/endpoint/list.js +18 -12
- package/distTs/src/command/sandbox/exec/list.js +22 -16
- package/distTs/src/command/sandbox/exec/status.js +18 -9
- package/distTs/src/command/sandbox/get.js +26 -18
- package/distTs/src/command/sandbox/list.js +21 -15
- package/distTs/src/command/sandbox/snapshot/get.js +19 -13
- package/distTs/src/command/sandbox/snapshot/list.js +17 -11
- package/distTs/src/command/sandbox/status.js +11 -5
- package/distTs/src/command/whoami.js +17 -8
- package/distTs/src/command/workspace/list.js +14 -8
- package/distTs/src/input.js +180 -1
- package/distTs/src/output.js +16 -6
- package/distTs/src/texts.js +86 -6
- package/distTs/src/types/distro.js +232 -0
- package/package.json +3 -2
|
@@ -43,20 +43,41 @@ commandDomainBuy.action(async (text, options) => {
|
|
|
43
43
|
}
|
|
44
44
|
output_1.default.exitNormal();
|
|
45
45
|
});
|
|
46
|
+
const outputRouteExample = (domain) => {
|
|
47
|
+
output_1.default.normal('\nRoute this zone to an artifact:');
|
|
48
|
+
output_1.default.dim('bdy distro route create <distro-identifier> \\');
|
|
49
|
+
output_1.default.dim(` --domain="${domain}" \\`);
|
|
50
|
+
output_1.default.dim(' --target "artifact=<artifact-identifier>:<version>"');
|
|
51
|
+
output_1.default.normal(`\nRoute a NEW sub-name within the zone (e.g. api.${domain}):`);
|
|
52
|
+
output_1.default.dim('bdy distro route create <distro-identifier> \\');
|
|
53
|
+
output_1.default.dim(' --subdomain="api" \\');
|
|
54
|
+
output_1.default.dim(` --domain="${domain}" \\`);
|
|
55
|
+
output_1.default.dim(' --target "artifact=<artifact-identifier>:<version>"');
|
|
56
|
+
};
|
|
57
|
+
const outputClaimed = (domain) => {
|
|
58
|
+
output_1.default.okSign();
|
|
59
|
+
output_1.default.cyan(domain, false);
|
|
60
|
+
output_1.default.normal(' claimed');
|
|
61
|
+
outputRouteExample(domain);
|
|
62
|
+
};
|
|
63
|
+
const outputBought = (domain) => {
|
|
64
|
+
output_1.default.okSign();
|
|
65
|
+
output_1.default.cyan(domain, false);
|
|
66
|
+
output_1.default.normal(' bought');
|
|
67
|
+
outputRouteExample(domain);
|
|
68
|
+
};
|
|
46
69
|
const claimNonInteractive = async (client, workspace, domain, onOwnerBehalf) => {
|
|
47
70
|
output_1.default.arrowSign();
|
|
48
71
|
output_1.default.normal(`Matched: ${output_1.default.formatDomainClaim(domain, true)}`);
|
|
49
72
|
await client.domainClaim(workspace, domain, onOwnerBehalf);
|
|
50
|
-
|
|
51
|
-
output_1.default.normal(`${domain} claimed`);
|
|
73
|
+
outputClaimed(domain);
|
|
52
74
|
};
|
|
53
75
|
const buyNonInteractive = async (client, workspace, domain, onOwnerBehalf) => {
|
|
54
76
|
output_1.default.arrowSign();
|
|
55
77
|
output_1.default.normal(`Matched: ${output_1.default.formatDomain(domain)}`);
|
|
56
78
|
if (domain.available && !domain.premium) {
|
|
57
79
|
await client.domainBuy(workspace, domain.name, onOwnerBehalf, true);
|
|
58
|
-
|
|
59
|
-
output_1.default.normal(`${domain.name} bought`);
|
|
80
|
+
outputBought(domain.name);
|
|
60
81
|
}
|
|
61
82
|
};
|
|
62
83
|
const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf, onlyAvailable, sort) => {
|
|
@@ -235,13 +256,11 @@ const interactive = async (client, workspace, prompt, tlds, onOwnerBehalf, onlyA
|
|
|
235
256
|
}
|
|
236
257
|
else if (type === 'claim') {
|
|
237
258
|
await client.domainClaim(workspace, name, onOwnerBehalf);
|
|
238
|
-
|
|
239
|
-
output_1.default.normal(`${name} claimed`);
|
|
259
|
+
outputClaimed(name);
|
|
240
260
|
}
|
|
241
261
|
else {
|
|
242
262
|
await client.domainBuy(workspace, name, onOwnerBehalf);
|
|
243
|
-
|
|
244
|
-
output_1.default.normal(`${name} bought`);
|
|
263
|
+
outputBought(name);
|
|
245
264
|
}
|
|
246
265
|
};
|
|
247
266
|
const nonInteractive = async (client, workspace, prompt, tlds, onOwnerBehalf) => {
|
|
@@ -9,6 +9,7 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const commandDomainGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_DOMAIN_GET);
|
|
11
11
|
commandDomainGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandDomainGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
12
13
|
commandDomainGet.argument('<id|name>', texts_1.OPTION_COMMAND_DOMAIN_IDENTIFIER);
|
|
13
14
|
commandDomainGet.action(async (name, options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -27,19 +28,24 @@ commandDomainGet.action(async (name, options) => {
|
|
|
27
28
|
if (!domain) {
|
|
28
29
|
output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NOT_FOUND);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
if (options.format === 'json') {
|
|
32
|
+
output_1.default.json(domain);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const props = {
|
|
36
|
+
Name: domain.name,
|
|
37
|
+
ID: domain.id,
|
|
38
|
+
Type: domain.type,
|
|
39
|
+
};
|
|
40
|
+
if (domain.type === 'REGISTERED') {
|
|
41
|
+
if (domain.expiry_date) {
|
|
42
|
+
props.Expires = domain.expiry_date;
|
|
43
|
+
}
|
|
44
|
+
props.Renew = domain.auto_renew ? 'Auto' : 'Manual';
|
|
38
45
|
}
|
|
39
|
-
props.
|
|
46
|
+
props.URL = domain.html_url;
|
|
47
|
+
output_1.default.object(props);
|
|
40
48
|
}
|
|
41
|
-
props.URL = domain.html_url;
|
|
42
|
-
output_1.default.object(props);
|
|
43
49
|
output_1.default.exitNormal();
|
|
44
50
|
});
|
|
45
51
|
exports.default = commandDomainGet;
|
|
@@ -10,18 +10,25 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const commandDomainList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_DOMAIN_LIST);
|
|
11
11
|
commandDomainList.alias('ls');
|
|
12
12
|
commandDomainList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandDomainList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandDomainList.action(async (options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
15
16
|
const client = input_1.default.restApiTokenClient();
|
|
16
17
|
const response = await client.getDomains(workspace);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const domains = response.domains || [];
|
|
19
|
+
if (options.format === 'json') {
|
|
20
|
+
output_1.default.json(domains);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
else {
|
|
23
|
+
if (domains.length === 0) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_DOMAIN_NO_DOMAINS);
|
|
25
|
+
}
|
|
26
|
+
const data = [['NAME', 'ID', 'URL']];
|
|
27
|
+
for (const d of domains) {
|
|
28
|
+
data.push([d.name, d.id, d.html_url]);
|
|
29
|
+
}
|
|
30
|
+
output_1.default.table(data);
|
|
23
31
|
}
|
|
24
|
-
output_1.default.table(data);
|
|
25
32
|
output_1.default.exitNormal();
|
|
26
33
|
});
|
|
27
34
|
exports.default = commandDomainList;
|
|
@@ -23,7 +23,7 @@ commandPipelineList.action(async (options) => {
|
|
|
23
23
|
const client = input_1.default.restApiTokenClient();
|
|
24
24
|
const r = await client.getPipelines(workspace, project, page, perPage);
|
|
25
25
|
if (!r.pipelines.length) {
|
|
26
|
-
output_1.default.
|
|
26
|
+
output_1.default.exitNormal(texts_1.TXT_PIPELINES_NOT_FOUND);
|
|
27
27
|
}
|
|
28
28
|
if (options.format === 'json') {
|
|
29
29
|
output_1.default.json(r.pipelines);
|
|
@@ -10,18 +10,25 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const commandProjectList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PROJECT_LIST);
|
|
11
11
|
commandProjectList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandProjectList.alias('ls');
|
|
13
|
+
commandProjectList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandProjectList.action(async (options) => {
|
|
14
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
15
16
|
const client = input_1.default.restApiTokenClient();
|
|
16
17
|
const response = await client.getProjects(workspace);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const projects = response.projects || [];
|
|
19
|
+
if (options.format === 'json') {
|
|
20
|
+
output_1.default.json(projects);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
else {
|
|
23
|
+
if (projects.length === 0) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
|
|
25
|
+
}
|
|
26
|
+
const data = [['NAME', 'DISPLAY NAME', 'STATUS', 'URL']];
|
|
27
|
+
for (const proj of projects) {
|
|
28
|
+
data.push([proj.name, proj.display_name, proj.status, proj.html_url]);
|
|
29
|
+
}
|
|
30
|
+
output_1.default.table(data);
|
|
23
31
|
}
|
|
24
|
-
output_1.default.table(data);
|
|
25
32
|
output_1.default.exitNormal();
|
|
26
33
|
});
|
|
27
34
|
exports.default = commandProjectList;
|
|
@@ -11,6 +11,7 @@ const commandSandboxAppList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMA
|
|
|
11
11
|
commandSandboxAppList.alias('ls');
|
|
12
12
|
commandSandboxAppList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandSandboxAppList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandSandboxAppList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandSandboxAppList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
16
|
commandSandboxAppList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_LIST}`);
|
|
16
17
|
commandSandboxAppList.action(async (identifier, options) => {
|
|
@@ -22,14 +23,19 @@ commandSandboxAppList.action(async (identifier, options) => {
|
|
|
22
23
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
24
|
}
|
|
24
25
|
const { apps } = await client.getSandbox(workspace, sandbox_id);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (options.format === 'json') {
|
|
27
|
+
output_1.default.json(apps);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const table = [['ID', 'COMMAND', 'STATUS']];
|
|
31
|
+
for (const app of apps) {
|
|
32
|
+
let command = app.command;
|
|
33
|
+
if (command.length > 20)
|
|
34
|
+
command = `${command.substring(0, 20)}...`;
|
|
35
|
+
table.push([app.id, command, app.app_status]);
|
|
36
|
+
}
|
|
37
|
+
output_1.default.table(table);
|
|
31
38
|
}
|
|
32
|
-
output_1.default.table(table);
|
|
33
39
|
output_1.default.exitNormal();
|
|
34
40
|
});
|
|
35
41
|
exports.default = commandSandboxAppList;
|
|
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
10
10
|
const commandSandboxAppStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_APP_STATUS);
|
|
11
11
|
commandSandboxAppStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandSandboxAppStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandSandboxAppStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxAppStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxAppStatus.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
15
16
|
commandSandboxAppStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_STATUS}`);
|
|
@@ -26,10 +27,15 @@ commandSandboxAppStatus.action(async (identifier, appId, options) => {
|
|
|
26
27
|
if (!app) {
|
|
27
28
|
output_1.default.exitError(texts_1.ERR_SANDBOX_APP_NOT_FOUND);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
if (options.format === 'json') {
|
|
31
|
+
output_1.default.json(app);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
output_1.default.object({
|
|
35
|
+
Command: app.command,
|
|
36
|
+
Status: app.app_status,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
33
39
|
output_1.default.exitNormal();
|
|
34
40
|
});
|
|
35
41
|
exports.default = commandSandboxAppStatus;
|
|
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../../input"));
|
|
|
10
10
|
const commandSandboxEndpointGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_GET);
|
|
11
11
|
commandSandboxEndpointGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandSandboxEndpointGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandSandboxEndpointGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxEndpointGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxEndpointGet.argument('<endpoint-name>', texts_1.OPTION_SANDBOX_ENDPOINT_NAME_ARG);
|
|
15
16
|
commandSandboxEndpointGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET}`);
|
|
@@ -27,68 +28,76 @@ commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
|
|
|
27
28
|
if (!endpoint) {
|
|
28
29
|
output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINT_NOT_FOUND);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
['Name', endpoint.name || '-'],
|
|
33
|
-
['Endpoint', endpoint.endpoint || '-'],
|
|
34
|
-
['Type', endpoint.type || '-'],
|
|
35
|
-
['Region', endpoint.region || '-'],
|
|
36
|
-
['URL', endpoint.endpoint_url || '-'],
|
|
37
|
-
['Timeout', endpoint.timeout?.toString() || '-'],
|
|
38
|
-
];
|
|
39
|
-
if (endpoint.whitelist?.length) {
|
|
40
|
-
data.push(['Whitelist', endpoint.whitelist?.join(', ')]);
|
|
31
|
+
if (options.format === 'json') {
|
|
32
|
+
output_1.default.json(endpoint);
|
|
41
33
|
}
|
|
42
|
-
|
|
43
|
-
data
|
|
44
|
-
|
|
45
|
-
'
|
|
46
|
-
endpoint.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (endpoint.http.serve_path) {
|
|
55
|
-
data.push(['Serve path', endpoint.http.serve_path]);
|
|
34
|
+
else {
|
|
35
|
+
const data = [
|
|
36
|
+
['Field', 'Value'],
|
|
37
|
+
['Name', endpoint.name || '-'],
|
|
38
|
+
['Endpoint', endpoint.endpoint || '-'],
|
|
39
|
+
['Type', endpoint.type || '-'],
|
|
40
|
+
['Region', endpoint.region || '-'],
|
|
41
|
+
['URL', endpoint.endpoint_url || '-'],
|
|
42
|
+
['Timeout', endpoint.timeout?.toString() || '-'],
|
|
43
|
+
];
|
|
44
|
+
if (endpoint.whitelist?.length) {
|
|
45
|
+
data.push(['Whitelist', endpoint.whitelist?.join(', ')]);
|
|
56
46
|
}
|
|
57
|
-
if (endpoint.http
|
|
58
|
-
data.push(['
|
|
59
|
-
}
|
|
60
|
-
if (endpoint.http.whitelist_user_agents?.length) {
|
|
47
|
+
if (endpoint.http) {
|
|
48
|
+
data.push(['HTTP2', endpoint.http.http2 ? 'TRUE' : 'FALSE']);
|
|
61
49
|
data.push([
|
|
62
|
-
'
|
|
63
|
-
endpoint.http.
|
|
50
|
+
'Verify certificate',
|
|
51
|
+
endpoint.http.verify_certificate ? 'TRUE' : 'FALSE',
|
|
64
52
|
]);
|
|
65
|
-
}
|
|
66
|
-
if (endpoint.http.rewrite_host_header) {
|
|
67
|
-
data.push(['Rewrite host header', endpoint.http.rewrite_host_header]);
|
|
68
|
-
}
|
|
69
|
-
let headers = Object.keys(endpoint.http.request_headers || {});
|
|
70
|
-
if (headers.length) {
|
|
71
53
|
data.push([
|
|
72
|
-
'
|
|
73
|
-
|
|
74
|
-
.map((key) => `${key}: ${endpoint.http.request_headers[key]}`)
|
|
75
|
-
.join('\n '),
|
|
54
|
+
'Compression',
|
|
55
|
+
endpoint.http.compression ? 'TRUE' : 'FALSE',
|
|
76
56
|
]);
|
|
77
|
-
}
|
|
78
|
-
headers = Object.keys(endpoint.http.response_headers || {});
|
|
79
|
-
if (headers.length) {
|
|
80
57
|
data.push([
|
|
81
|
-
'
|
|
82
|
-
|
|
83
|
-
.map((key) => `${key}: ${endpoint.http.response_headers[key]}`)
|
|
84
|
-
.join('\n '),
|
|
58
|
+
'Log requests',
|
|
59
|
+
endpoint.http.log_requests ? 'TRUE' : 'FALSE',
|
|
85
60
|
]);
|
|
61
|
+
data.push(['Auth type', endpoint.http.auth_type]);
|
|
62
|
+
if (endpoint.http.serve_path) {
|
|
63
|
+
data.push(['Serve path', endpoint.http.serve_path]);
|
|
64
|
+
}
|
|
65
|
+
if (endpoint.http.circuit_breaker) {
|
|
66
|
+
data.push(['Circuit breaker', String(endpoint.http.circuit_breaker)]);
|
|
67
|
+
}
|
|
68
|
+
if (endpoint.http.whitelist_user_agents?.length) {
|
|
69
|
+
data.push([
|
|
70
|
+
'Whitelist user agents',
|
|
71
|
+
endpoint.http.whitelist_user_agents.join('\n'),
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
if (endpoint.http.rewrite_host_header) {
|
|
75
|
+
data.push(['Rewrite host header', endpoint.http.rewrite_host_header]);
|
|
76
|
+
}
|
|
77
|
+
let headers = Object.keys(endpoint.http.request_headers || {});
|
|
78
|
+
if (headers.length) {
|
|
79
|
+
data.push([
|
|
80
|
+
'Request headers',
|
|
81
|
+
headers
|
|
82
|
+
.map((key) => `${key}: ${endpoint.http.request_headers[key]}`)
|
|
83
|
+
.join('\n '),
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
headers = Object.keys(endpoint.http.response_headers || {});
|
|
87
|
+
if (headers.length) {
|
|
88
|
+
data.push([
|
|
89
|
+
'Request headers',
|
|
90
|
+
headers
|
|
91
|
+
.map((key) => `${key}: ${endpoint.http.response_headers[key]}`)
|
|
92
|
+
.join('\n '),
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
86
95
|
}
|
|
96
|
+
else if (endpoint.tls) {
|
|
97
|
+
data.push(['Terminate at', endpoint.tls.terminate_at]);
|
|
98
|
+
}
|
|
99
|
+
output_1.default.table(data);
|
|
87
100
|
}
|
|
88
|
-
else if (endpoint.tls) {
|
|
89
|
-
data.push(['Terminate at', endpoint.tls.terminate_at]);
|
|
90
|
-
}
|
|
91
|
-
output_1.default.table(data);
|
|
92
101
|
output_1.default.exitNormal();
|
|
93
102
|
});
|
|
94
103
|
exports.default = commandSandboxEndpointGet;
|
|
@@ -11,6 +11,7 @@ const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_
|
|
|
11
11
|
commandSandboxEndpointList.alias('ls');
|
|
12
12
|
commandSandboxEndpointList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandSandboxEndpointList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandSandboxEndpointList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandSandboxEndpointList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
16
|
commandSandboxEndpointList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST}`);
|
|
16
17
|
commandSandboxEndpointList.action(async (identifier, options) => {
|
|
@@ -23,20 +24,25 @@ commandSandboxEndpointList.action(async (identifier, options) => {
|
|
|
23
24
|
}
|
|
24
25
|
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
25
26
|
const endpoints = sandbox.endpoints || [];
|
|
26
|
-
if (
|
|
27
|
-
output_1.default.
|
|
27
|
+
if (options.format === 'json') {
|
|
28
|
+
output_1.default.json(endpoints);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
else {
|
|
31
|
+
if (endpoints.length === 0) {
|
|
32
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINTS_NOT_FOUND);
|
|
33
|
+
}
|
|
34
|
+
const data = [['Name', 'Endpoint', 'Type', 'Region', 'URL']];
|
|
35
|
+
for (const ep of endpoints) {
|
|
36
|
+
data.push([
|
|
37
|
+
ep.name || '-',
|
|
38
|
+
ep.endpoint || '-',
|
|
39
|
+
ep.type || '-',
|
|
40
|
+
ep.region || '-',
|
|
41
|
+
ep.endpoint_url || '-',
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
output_1.default.table(data);
|
|
38
45
|
}
|
|
39
|
-
output_1.default.table(data);
|
|
40
46
|
output_1.default.exitNormal();
|
|
41
47
|
});
|
|
42
48
|
exports.default = commandSandboxEndpointList;
|
|
@@ -11,6 +11,7 @@ const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMM
|
|
|
11
11
|
commandSandboxExecList.alias('ls');
|
|
12
12
|
commandSandboxExecList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
13
|
commandSandboxExecList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandSandboxExecList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
15
|
commandSandboxExecList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
16
|
commandSandboxExecList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_LIST}`);
|
|
16
17
|
commandSandboxExecList.action(async (identifier, options) => {
|
|
@@ -23,24 +24,29 @@ commandSandboxExecList.action(async (identifier, options) => {
|
|
|
23
24
|
}
|
|
24
25
|
const commandsResult = await client.listSandboxCommands(workspace, sandbox_id);
|
|
25
26
|
const commands = commandsResult.commands || [];
|
|
26
|
-
if (commands.length === 0) {
|
|
27
|
-
output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
|
|
28
|
-
}
|
|
29
27
|
commands.sort((a, b) => (b.id || '').localeCompare(a.id || ''));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
if (options.format === 'json') {
|
|
29
|
+
output_1.default.json(commands);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (commands.length === 0) {
|
|
33
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
|
|
34
|
+
}
|
|
35
|
+
const data = [
|
|
36
|
+
['ID', 'COMMAND', 'STATUS', 'EXIT CODE', 'RUNTIME'],
|
|
37
|
+
];
|
|
38
|
+
for (const cmd of commands) {
|
|
39
|
+
data.push([
|
|
40
|
+
cmd.id || '-',
|
|
41
|
+
(cmd.command || '-').substring(0, 40) +
|
|
42
|
+
(cmd.command?.length > 40 ? '...' : ''),
|
|
43
|
+
cmd.status || '-',
|
|
44
|
+
cmd.exit_code !== undefined ? String(cmd.exit_code) : '-',
|
|
45
|
+
cmd.runtime || 'BASH',
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
output_1.default.table(data);
|
|
42
49
|
}
|
|
43
|
-
output_1.default.table(data);
|
|
44
50
|
output_1.default.exitNormal();
|
|
45
51
|
});
|
|
46
52
|
exports.default = commandSandboxExecList;
|
|
@@ -10,6 +10,7 @@ const output_1 = __importDefault(require("../../../output"));
|
|
|
10
10
|
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS);
|
|
11
11
|
commandSandboxExecStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandSandboxExecStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandSandboxExecStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxExecStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxExecStatus.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
15
16
|
commandSandboxExecStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_STATUS}`);
|
|
@@ -22,15 +23,23 @@ commandSandboxExecStatus.action(async (identifier, commandId, options) => {
|
|
|
22
23
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
24
|
}
|
|
24
25
|
const cmd = await client.getSandboxCommand(workspace, sandbox_id, commandId);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
if (options.format === 'json') {
|
|
27
|
+
output_1.default.json(cmd);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const data = [
|
|
31
|
+
['Property', 'Value'],
|
|
32
|
+
['Command ID', cmd.id || '-'],
|
|
33
|
+
['Command', cmd.command || '-'],
|
|
34
|
+
['Runtime', cmd.runtime || 'BASH'],
|
|
35
|
+
['Status', cmd.status || '-'],
|
|
36
|
+
[
|
|
37
|
+
'Exit Code',
|
|
38
|
+
cmd.exit_code !== undefined ? String(cmd.exit_code) : '-',
|
|
39
|
+
],
|
|
40
|
+
];
|
|
41
|
+
output_1.default.table(data);
|
|
42
|
+
}
|
|
34
43
|
output_1.default.exitNormal();
|
|
35
44
|
});
|
|
36
45
|
exports.default = commandSandboxExecStatus;
|
|
@@ -10,6 +10,7 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const commandSandboxGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_GET);
|
|
11
11
|
commandSandboxGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
12
|
commandSandboxGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandSandboxGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
14
|
commandSandboxGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxGet.action(async (identifier, options) => {
|
|
15
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -20,25 +21,32 @@ commandSandboxGet.action(async (identifier, options) => {
|
|
|
20
21
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
21
22
|
}
|
|
22
23
|
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
if (options.format === 'json') {
|
|
25
|
+
output_1.default.json(sandbox);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const data = [
|
|
29
|
+
['Field', 'Value'],
|
|
30
|
+
['ID', sandbox.id || '-'],
|
|
31
|
+
['Identifier', sandbox.identifier || '-'],
|
|
32
|
+
['Name', sandbox.name || '-'],
|
|
33
|
+
['Status', sandbox.status || '-'],
|
|
34
|
+
['Setup Status', sandbox.setup_status || '-'],
|
|
35
|
+
['OS', sandbox.os || '-'],
|
|
36
|
+
['Resources', sandbox.resources || '-'],
|
|
37
|
+
['Tags', (sandbox.tags || []).join(', ') || '-'],
|
|
38
|
+
['URL', sandbox.html_url || '-'],
|
|
39
|
+
];
|
|
40
|
+
if (sandbox.endpoints && sandbox.endpoints.length > 0) {
|
|
41
|
+
data.push([
|
|
42
|
+
'Endpoints',
|
|
43
|
+
sandbox.endpoints
|
|
44
|
+
.map((e) => `${e.name}: ${e.endpoint}`)
|
|
45
|
+
.join('\n'),
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
output_1.default.table(data);
|
|
40
49
|
}
|
|
41
|
-
output_1.default.table(data);
|
|
42
50
|
output_1.default.exitNormal();
|
|
43
51
|
});
|
|
44
52
|
exports.default = commandSandboxGet;
|