heroku 9.3.2 → 10.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/commands/access/index.js +1 -1
- package/lib/commands/apps/errors.js +1 -1
- package/lib/commands/apps/favorites/add.js +1 -1
- package/lib/commands/buildpacks/add.js +1 -1
- package/lib/commands/buildpacks/info.js +1 -1
- package/lib/commands/buildpacks/set.js +1 -1
- package/lib/commands/buildpacks/versions.js +1 -1
- package/lib/commands/logs.d.ts +5 -3
- package/lib/commands/logs.js +61 -22
- package/lib/commands/members/index.js +1 -1
- package/lib/commands/orgs/open.js +1 -1
- package/lib/commands/pg/copy.js +1 -1
- package/lib/commands/pipelines/promote.js +3 -3
- package/lib/commands/ps/type.js +2 -3
- package/lib/commands/spaces/create.d.ts +6 -6
- package/lib/commands/spaces/create.js +24 -12
- package/lib/commands/spaces/index.d.ts +2 -2
- package/lib/commands/spaces/index.js +6 -1
- package/lib/commands/spaces/info.js +5 -3
- package/lib/commands/spaces/wait.js +5 -3
- package/lib/commands/telemetry/add.d.ts +18 -0
- package/lib/commands/telemetry/add.js +70 -0
- package/lib/commands/telemetry/index.d.ts +13 -0
- package/lib/commands/telemetry/index.js +43 -0
- package/lib/commands/telemetry/info.d.ts +10 -0
- package/lib/commands/telemetry/info.js +24 -0
- package/lib/commands/telemetry/remove.d.ts +15 -0
- package/lib/commands/telemetry/remove.js +63 -0
- package/lib/commands/telemetry/update.d.ts +16 -0
- package/lib/commands/telemetry/update.js +60 -0
- package/lib/file.js +0 -2
- package/lib/lib/apps/generation.d.ts +4 -0
- package/lib/lib/apps/generation.js +24 -0
- package/lib/lib/run/colorize.js +1 -1
- package/lib/lib/run/log-displayer.d.ts +3 -2
- package/lib/lib/run/log-displayer.js +41 -33
- package/lib/lib/spaces/spaces.d.ts +4 -2
- package/lib/lib/spaces/spaces.js +2 -1
- package/lib/lib/telemetry/util.d.ts +3 -0
- package/lib/lib/telemetry/util.js +29 -0
- package/oclif.manifest.json +348 -53
- package/package.json +6 -6
- package/lib/lib/run/line-transform.d.ts +0 -4
- package/lib/lib/run/line-transform.js +0 -26
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const util_1 = require("../../lib/telemetry/util");
|
|
6
|
+
class Info extends command_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { args } = await this.parse(Info);
|
|
9
|
+
const { telemetry_drain_id } = args;
|
|
10
|
+
const { body: telemetryDrain } = await this.heroku.get(`/telemetry-drains/${telemetry_drain_id}`, {
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: 'application/vnd.heroku+json; version=3.sdk',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
(0, util_1.displayTelemetryDrain)(telemetryDrain);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = Info;
|
|
19
|
+
Info.topic = 'telemetry';
|
|
20
|
+
Info.description = 'show a telemetry drain\'s info';
|
|
21
|
+
Info.args = {
|
|
22
|
+
telemetry_drain_id: core_1.Args.string({ required: true, description: 'ID of the drain to show info for' }),
|
|
23
|
+
};
|
|
24
|
+
Info.example = '$ heroku telemetry:info 022e2e2e-2e2e-2e2e-2e2e-2e2e2e2e2e2e';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
import { TelemetryDrain } from '../../lib/types/telemetry';
|
|
3
|
+
export default class Remove extends Command {
|
|
4
|
+
static topic: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
telemetry_drain_id: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
protected removeDrain(telemetry_drain_id: string): Promise<TelemetryDrain>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
6
|
+
class Remove extends command_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { args, flags } = await this.parse(Remove);
|
|
9
|
+
const { app, space } = flags;
|
|
10
|
+
const { telemetry_drain_id } = args;
|
|
11
|
+
if (!(app || space || telemetry_drain_id)) {
|
|
12
|
+
core_1.ux.error((0, tsheredoc_1.default)(`
|
|
13
|
+
Requires either --app or --space or a TELEMETRY_DRAIN_ID to be provided.
|
|
14
|
+
See more help with --help
|
|
15
|
+
`));
|
|
16
|
+
}
|
|
17
|
+
if (telemetry_drain_id) {
|
|
18
|
+
const telemetryDrain = await this.removeDrain(telemetry_drain_id);
|
|
19
|
+
core_1.ux.action.start(`Removing telemetry drain ${telemetry_drain_id}, which was configured for ${telemetryDrain.owner.type} ${telemetryDrain.owner.name}`);
|
|
20
|
+
}
|
|
21
|
+
else if (app) {
|
|
22
|
+
core_1.ux.action.start(`Removing all telemetry drains from app ${app}`);
|
|
23
|
+
const { body: telemetryDrains } = await this.heroku.get(`/apps/${app}/telemetry-drains`, {
|
|
24
|
+
headers: {
|
|
25
|
+
Accept: 'application/vnd.heroku+json; version=3.sdk',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
for (const telemetryDrain of telemetryDrains) {
|
|
29
|
+
await this.removeDrain(telemetryDrain.id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (space) {
|
|
33
|
+
core_1.ux.action.start(`Removing all telemetry drains from space ${space}`);
|
|
34
|
+
const { body: telemetryDrains } = await this.heroku.get(`/spaces/${space}/telemetry-drains`, {
|
|
35
|
+
headers: {
|
|
36
|
+
Accept: 'application/vnd.heroku+json; version=3.sdk',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
for (const telemetryDrain of telemetryDrains) {
|
|
40
|
+
await this.removeDrain(telemetryDrain.id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
core_1.ux.action.stop();
|
|
44
|
+
}
|
|
45
|
+
async removeDrain(telemetry_drain_id) {
|
|
46
|
+
const { body: telemetryDrain } = await this.heroku.delete(`/telemetry-drains/${telemetry_drain_id}`, {
|
|
47
|
+
headers: {
|
|
48
|
+
Accept: 'application/vnd.heroku+json; version=3.sdk',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return telemetryDrain;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = Remove;
|
|
55
|
+
Remove.topic = 'telemetry';
|
|
56
|
+
Remove.description = 'remove a telemetry drain';
|
|
57
|
+
Remove.args = {
|
|
58
|
+
telemetry_drain_id: core_1.Args.string({ description: 'ID of the drain to remove' }),
|
|
59
|
+
};
|
|
60
|
+
Remove.flags = {
|
|
61
|
+
app: command_1.flags.app({ description: 'name of the app to remove all drains from' }),
|
|
62
|
+
space: command_1.flags.string({ char: 's', description: 'name of the space to remove all drains from' }),
|
|
63
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@heroku-cli/command';
|
|
2
|
+
export default class Update extends Command {
|
|
3
|
+
static topic: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
telemetry_drain_id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
|
+
headers: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
signals: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
endpoint: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
transport: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
static example: string;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const tsheredoc_1 = require("tsheredoc");
|
|
6
|
+
const util_1 = require("../../lib/telemetry/util");
|
|
7
|
+
class Update extends command_1.Command {
|
|
8
|
+
async run() {
|
|
9
|
+
const { args, flags } = await this.parse(Update);
|
|
10
|
+
const { telemetry_drain_id, headers } = args;
|
|
11
|
+
const { signals, endpoint, transport } = flags;
|
|
12
|
+
if (!(headers || signals || endpoint || transport)) {
|
|
13
|
+
core_1.ux.error((0, tsheredoc_1.default)(`
|
|
14
|
+
Requires either --signals, --endpoint, --transport or HEADERS to be provided.
|
|
15
|
+
See more help with --help
|
|
16
|
+
`));
|
|
17
|
+
}
|
|
18
|
+
const drainConfig = {};
|
|
19
|
+
if (signals) {
|
|
20
|
+
drainConfig.signals = (0, util_1.validateAndFormatSignals)(signals);
|
|
21
|
+
}
|
|
22
|
+
if (headers || endpoint || transport) {
|
|
23
|
+
const exporter = {};
|
|
24
|
+
if (headers) {
|
|
25
|
+
exporter.headers = JSON.parse(headers);
|
|
26
|
+
}
|
|
27
|
+
if (endpoint) {
|
|
28
|
+
exporter.endpoint = endpoint;
|
|
29
|
+
}
|
|
30
|
+
if (transport) {
|
|
31
|
+
exporter.type = `otlp${transport}`;
|
|
32
|
+
}
|
|
33
|
+
drainConfig.exporter = exporter;
|
|
34
|
+
}
|
|
35
|
+
core_1.ux.action.start(`Updating telemetry drain ${telemetry_drain_id}`);
|
|
36
|
+
const { body: telemetryDrain } = await this.heroku.patch(`/telemetry-drains/${telemetry_drain_id}`, {
|
|
37
|
+
headers: {
|
|
38
|
+
Accept: 'application/vnd.heroku+json; version=3.sdk',
|
|
39
|
+
},
|
|
40
|
+
body: drainConfig,
|
|
41
|
+
});
|
|
42
|
+
core_1.ux.action.stop();
|
|
43
|
+
(0, util_1.displayTelemetryDrain)(telemetryDrain);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = Update;
|
|
47
|
+
Update.topic = 'telemetry';
|
|
48
|
+
Update.description = 'updates a telemetry drain with provided attributes (attributes not provided remain unchanged)';
|
|
49
|
+
Update.args = {
|
|
50
|
+
telemetry_drain_id: core_1.Args.string({ required: true, description: 'ID of the drain to update' }),
|
|
51
|
+
headers: core_1.Args.string({ description: 'custom headers to configure the drain in json format' }),
|
|
52
|
+
};
|
|
53
|
+
Update.flags = {
|
|
54
|
+
signals: command_1.flags.string({ description: 'comma-delimited list of signals to collect (traces, metrics, logs). Use "all" to collect all signals.' }),
|
|
55
|
+
endpoint: command_1.flags.string({ description: 'drain url' }),
|
|
56
|
+
transport: command_1.flags.string({ options: ['http', 'grpc'], description: 'transport protocol for the drain' }),
|
|
57
|
+
};
|
|
58
|
+
Update.example = (0, tsheredoc_1.default)(`
|
|
59
|
+
$ heroku telemetry:update acde070d-8c4c-4f0d-9d8a-162843c10333 --signals logs,metrics --endpoint https://my-new-endpoint.com
|
|
60
|
+
`);
|
package/lib/file.js
CHANGED
|
@@ -9,7 +9,6 @@ function exists(f) {
|
|
|
9
9
|
}
|
|
10
10
|
exports.exists = exists;
|
|
11
11
|
async function stat(file) {
|
|
12
|
-
// debug('stat', file)
|
|
13
12
|
return deps_1.default.fs.stat(file);
|
|
14
13
|
}
|
|
15
14
|
exports.stat = stat;
|
|
@@ -42,7 +41,6 @@ async function removeEmptyDirs(dir) {
|
|
|
42
41
|
throw error;
|
|
43
42
|
}
|
|
44
43
|
const dirs = files.filter(f => f.stat.isDirectory()).map(f => f.path);
|
|
45
|
-
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
46
44
|
for (const p of dirs.map(removeEmptyDirs))
|
|
47
45
|
await p;
|
|
48
46
|
files = await ls(dir);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { APIClient } from '@heroku-cli/command';
|
|
2
|
+
import { App } from '../types/fir';
|
|
3
|
+
export declare function isFirApp(appOrName: App | string, herokuApi?: APIClient): Promise<boolean>;
|
|
4
|
+
export declare function isCedarApp(appOrName: App | string, herokuApi?: APIClient): Promise<boolean>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCedarApp = exports.isFirApp = void 0;
|
|
4
|
+
async function getApp(appOrName, herokuApi) {
|
|
5
|
+
if (typeof appOrName === 'string') {
|
|
6
|
+
if (herokuApi === undefined)
|
|
7
|
+
throw new Error('herokuApi parameter is required when passing an app name');
|
|
8
|
+
const { body: app } = await herokuApi.get(`/apps/${appOrName}`, {
|
|
9
|
+
headers: { Accept: 'application/vnd.heroku+json; version=3.sdk' },
|
|
10
|
+
});
|
|
11
|
+
return app;
|
|
12
|
+
}
|
|
13
|
+
return appOrName;
|
|
14
|
+
}
|
|
15
|
+
async function isFirApp(appOrName, herokuApi) {
|
|
16
|
+
const app = await getApp(appOrName, herokuApi);
|
|
17
|
+
return app.generation === 'fir';
|
|
18
|
+
}
|
|
19
|
+
exports.isFirApp = isFirApp;
|
|
20
|
+
async function isCedarApp(appOrName, herokuApi) {
|
|
21
|
+
const app = await getApp(appOrName, herokuApi);
|
|
22
|
+
return app.generation === 'cedar';
|
|
23
|
+
}
|
|
24
|
+
exports.isCedarApp = isCedarApp;
|
package/lib/lib/run/colorize.js
CHANGED
|
@@ -267,7 +267,7 @@ function colorizePG(body) {
|
|
|
267
267
|
return body;
|
|
268
268
|
}
|
|
269
269
|
function colorize(line) {
|
|
270
|
-
if (process.env.HEROKU_LOGS_COLOR === '0')
|
|
270
|
+
if (process.env.HEROKU_LOGS_COLOR === '0' || process.env.HEROKU_COLOR === '0')
|
|
271
271
|
return line;
|
|
272
272
|
const parsed = line.match(lineRegex);
|
|
273
273
|
if (!parsed)
|
|
@@ -3,8 +3,9 @@ interface LogDisplayerOptions {
|
|
|
3
3
|
app: string;
|
|
4
4
|
dyno?: string;
|
|
5
5
|
lines?: number;
|
|
6
|
-
tail: boolean;
|
|
7
6
|
source?: string;
|
|
7
|
+
tail: boolean;
|
|
8
|
+
type?: string;
|
|
8
9
|
}
|
|
9
|
-
declare function logDisplayer(heroku: APIClient, options: LogDisplayerOptions): Promise<
|
|
10
|
+
declare function logDisplayer(heroku: APIClient, options: LogDisplayerOptions): Promise<void>;
|
|
10
11
|
export default logDisplayer;
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const http_call_1 = require("http-call");
|
|
5
|
-
const url_1 = require("url");
|
|
6
4
|
const colorize_1 = require("./colorize");
|
|
7
|
-
const
|
|
5
|
+
const generation_1 = require("../apps/generation");
|
|
8
6
|
const EventSource = require('@heroku/eventsource');
|
|
9
|
-
|
|
10
|
-
const { response } = await http_call_1.default.stream(logplexURL);
|
|
7
|
+
function readLogs(logplexURL, isTail, recreateSessionTimeout) {
|
|
11
8
|
return new Promise(function (resolve, reject) {
|
|
12
|
-
response.setEncoding('utf8');
|
|
13
|
-
line_transform_1.default.setEncoding('utf8');
|
|
14
|
-
response.pipe(line_transform_1.default);
|
|
15
|
-
line_transform_1.default.on('data', line => core_1.ux.log((0, colorize_1.default)(line)));
|
|
16
|
-
response.on('end', resolve);
|
|
17
|
-
response.on('error', reject);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function readLogsV2(logplexURL) {
|
|
21
|
-
return new Promise(function (resolve, reject) {
|
|
22
|
-
const u = new url_1.URL(logplexURL);
|
|
23
|
-
const isTail = u.searchParams.get('tail') === 'true';
|
|
24
9
|
const userAgent = process.env.HEROKU_DEBUG_USER_AGENT || 'heroku-run';
|
|
25
10
|
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY;
|
|
26
11
|
const es = new EventSource(logplexURL, {
|
|
@@ -33,8 +18,8 @@ function readLogsV2(logplexURL) {
|
|
|
33
18
|
if (err && (err.status || err.message)) {
|
|
34
19
|
const msg = (isTail && (err.status === 404 || err.status === 403)) ?
|
|
35
20
|
'Log stream timed out. Please try again.' :
|
|
36
|
-
`Logs eventsource failed with: ${err.status} ${err.message}`;
|
|
37
|
-
reject(msg);
|
|
21
|
+
`Logs eventsource failed with: ${err.status}${err.message ? ` ${err.message}` : ''}`;
|
|
22
|
+
reject(new Error(msg));
|
|
38
23
|
es.close();
|
|
39
24
|
}
|
|
40
25
|
if (!isTail) {
|
|
@@ -48,15 +33,14 @@ function readLogsV2(logplexURL) {
|
|
|
48
33
|
core_1.ux.log((0, colorize_1.default)(line));
|
|
49
34
|
});
|
|
50
35
|
});
|
|
36
|
+
if (isTail && recreateSessionTimeout) {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
reject(new Error('Fir log stream timeout'));
|
|
39
|
+
es.close();
|
|
40
|
+
}, recreateSessionTimeout);
|
|
41
|
+
}
|
|
51
42
|
});
|
|
52
43
|
}
|
|
53
|
-
function readLogs(logplexURL) {
|
|
54
|
-
const u = new url_1.URL(logplexURL);
|
|
55
|
-
if (u.searchParams.has('srv')) {
|
|
56
|
-
return readLogsV1(logplexURL);
|
|
57
|
-
}
|
|
58
|
-
return readLogsV2(logplexURL);
|
|
59
|
-
}
|
|
60
44
|
async function logDisplayer(heroku, options) {
|
|
61
45
|
process.stdout.on('error', err => {
|
|
62
46
|
if (err.code === 'EPIPE') {
|
|
@@ -66,14 +50,38 @@ async function logDisplayer(heroku, options) {
|
|
|
66
50
|
core_1.ux.error(err.stack, { exit: 1 });
|
|
67
51
|
}
|
|
68
52
|
});
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
const firApp = await (0, generation_1.isFirApp)(options.app, heroku);
|
|
54
|
+
const isTail = firApp || options.tail;
|
|
55
|
+
const requestBodyParameters = {
|
|
56
|
+
source: options.source,
|
|
57
|
+
};
|
|
58
|
+
if (firApp)
|
|
59
|
+
Object.assign(requestBodyParameters, {
|
|
72
60
|
dyno: options.dyno,
|
|
73
|
-
|
|
61
|
+
type: options.type,
|
|
62
|
+
});
|
|
63
|
+
else
|
|
64
|
+
Object.assign(requestBodyParameters, {
|
|
65
|
+
dyno: options.dyno || options.type,
|
|
74
66
|
lines: options.lines,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
tail: options.tail,
|
|
68
|
+
});
|
|
69
|
+
let recreateLogSession = false;
|
|
70
|
+
do {
|
|
71
|
+
const { body: logSession } = await heroku.post(`/apps/${options.app}/log-sessions`, {
|
|
72
|
+
body: requestBodyParameters,
|
|
73
|
+
headers: { Accept: 'application/vnd.heroku+json; version=3.sdk' },
|
|
74
|
+
});
|
|
75
|
+
try {
|
|
76
|
+
await readLogs(logSession.logplex_url, isTail, firApp ? Number(process.env.HEROKU_LOG_STREAM_TIMEOUT || '15') * 60 * 1000 : undefined);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const { message } = error;
|
|
80
|
+
if (message === 'Fir log stream timeout')
|
|
81
|
+
recreateLogSession = true;
|
|
82
|
+
else
|
|
83
|
+
core_1.ux.error(message, { exit: 1 });
|
|
84
|
+
}
|
|
85
|
+
} while (recreateLogSession);
|
|
78
86
|
}
|
|
79
87
|
exports.default = logDisplayer;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as Heroku from '@heroku-cli/schema';
|
|
2
|
+
import { SpaceNat } from '../types/fir';
|
|
3
|
+
import { SpaceWithOutboundIps } from '../types/spaces';
|
|
2
4
|
export declare function displayShieldState(space: Heroku.Space): "on" | "off";
|
|
3
|
-
export declare function displayNat(nat?: Required<
|
|
4
|
-
export declare function renderInfo(space:
|
|
5
|
+
export declare function displayNat(nat?: Required<SpaceNat>): string | undefined;
|
|
6
|
+
export declare function renderInfo(space: SpaceWithOutboundIps, json: boolean): void;
|
package/lib/lib/spaces/spaces.js
CHANGED
|
@@ -30,8 +30,9 @@ function renderInfo(space, json) {
|
|
|
30
30
|
State: space.state,
|
|
31
31
|
Shield: displayShieldState(space),
|
|
32
32
|
'Outbound IPs': displayNat(space.outbound_ips),
|
|
33
|
+
Generation: space.generation,
|
|
33
34
|
'Created at': space.created_at,
|
|
34
|
-
}, ['ID', 'Team', 'Region', 'CIDR', 'Data CIDR', 'State', 'Shield', 'Outbound IPs', 'Created at']);
|
|
35
|
+
}, ['ID', 'Team', 'Region', 'CIDR', 'Data CIDR', 'State', 'Shield', 'Outbound IPs', 'Generation', 'Created at']);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
exports.renderInfo = renderInfo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayTelemetryDrain = exports.validateAndFormatSignals = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
function validateAndFormatSignals(signalInput) {
|
|
6
|
+
const signalOptions = ['traces', 'metrics', 'logs'];
|
|
7
|
+
if (!signalInput || signalInput === 'all')
|
|
8
|
+
return signalOptions;
|
|
9
|
+
const signalArray = signalInput.split(',');
|
|
10
|
+
signalArray.forEach(signal => {
|
|
11
|
+
if (!signalOptions.includes(signal)) {
|
|
12
|
+
core_1.ux.error(`Invalid signal option: ${signalArray}. Run heroku telemetry:add --help to see signal options.`, { exit: 1 });
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return signalArray;
|
|
16
|
+
}
|
|
17
|
+
exports.validateAndFormatSignals = validateAndFormatSignals;
|
|
18
|
+
function displayTelemetryDrain(telemetryDrain) {
|
|
19
|
+
core_1.ux.styledHeader(telemetryDrain.id);
|
|
20
|
+
const drainType = telemetryDrain.owner.type.charAt(0).toUpperCase() + telemetryDrain.owner.type.slice(1);
|
|
21
|
+
core_1.ux.styledObject({
|
|
22
|
+
[drainType]: telemetryDrain.owner.name,
|
|
23
|
+
Signals: telemetryDrain.signals.join(', '),
|
|
24
|
+
Endpoint: telemetryDrain.exporter.endpoint,
|
|
25
|
+
Kind: telemetryDrain.exporter.type,
|
|
26
|
+
Headers: telemetryDrain.exporter.headers,
|
|
27
|
+
}, ['App', 'Space', 'Signals', 'Endpoint', 'Kind', 'Headers']);
|
|
28
|
+
}
|
|
29
|
+
exports.displayTelemetryDrain = displayTelemetryDrain;
|