Comparing version 10.0.0-alpha.0 to 10.0.0-alpha.1
@@ -7,3 +7,3 @@ import { Command } from '@heroku-cli/command'; | ||
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
dyno: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'dyno-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'force-colors': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
@@ -16,5 +16,5 @@ 'no-color': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
tail: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
type: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'process-type': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
}; | ||
run(): Promise<void>; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
const { flags } = await this.parse(Logs); | ||
const { app, dyno, 'force-colors': forceColors, num, ps, source, tail, type } = flags; | ||
const { app, 'dyno-name': dyno, 'force-colors': forceColors, num, ps, source, tail, 'process-type': type } = flags; | ||
if (forceColors) | ||
@@ -33,4 +33,4 @@ color_1.default.enabled = true; | ||
'heroku logs --num=50 --app=my-app', | ||
'heroku logs --dyno=web-123-456 --app=my-app', | ||
'heroku logs --type=web --app=my-app', | ||
'heroku logs --dyno-name=web-123-456 --app=my-app', | ||
'heroku logs --process-type=web --app=my-app', | ||
'heroku logs --app=my-app --tail', | ||
@@ -40,3 +40,4 @@ ]; | ||
app: command_1.flags.app({ required: true }), | ||
dyno: command_1.flags.string({ | ||
'dyno-name': command_1.flags.string({ | ||
aliases: ['dyno'], | ||
char: 'd', | ||
@@ -66,3 +67,3 @@ description: 'only show output from this dyno (such as "web-123-456" or "worker.2")', | ||
relationships: [ | ||
{ type: 'none', flags: ['dyno'] }, | ||
{ type: 'none', flags: ['dyno-name'] }, | ||
], | ||
@@ -81,6 +82,7 @@ completion: completions_1.ProcessTypeCompletion, | ||
}), | ||
type: command_1.flags.string({ | ||
'process-type': command_1.flags.string({ | ||
char: 'p', | ||
description: 'only show output from this process type (such as "web" or "worker")', | ||
relationships: [ | ||
{ type: 'none', flags: ['dyno', 'ps'] }, | ||
{ type: 'none', flags: ['dyno-name', 'ps'] }, | ||
], | ||
@@ -87,0 +89,0 @@ completion: completions_1.ProcessTypeCompletion, |
@@ -8,3 +8,2 @@ import { Command } from '@heroku-cli/command'; | ||
static examples: string[]; | ||
static help: string; | ||
static args: { | ||
@@ -16,4 +15,6 @@ dyno: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>; | ||
remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'dyno-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'process-type': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
}; | ||
run(): Promise<void>; | ||
} |
@@ -6,2 +6,4 @@ "use strict"; | ||
const core_1 = require("@oclif/core"); | ||
const completions_1 = require("@heroku-cli/command/lib/completions"); | ||
const tsheredoc_1 = require("tsheredoc"); | ||
class Restart extends command_1.Command { | ||
@@ -11,10 +13,28 @@ async run() { | ||
const app = flags.app; | ||
const dyno = args.dyno; | ||
const dyno = flags['dyno-name'] || args.dyno; | ||
const type = flags['process-type']; | ||
let msg = 'Restarting'; | ||
if (dyno) | ||
msg += ` ${color_1.default.cyan(dyno)}`; | ||
msg += (dyno && dyno.includes('.')) ? ' dyno' : ' dynos'; | ||
let restartUrl; | ||
if (type) { | ||
msg += ` all ${color_1.default.cyan(type)} dynos`; | ||
restartUrl = `/apps/${app}/formations/${encodeURIComponent(type)}`; | ||
} | ||
else if (dyno) { | ||
if (args.dyno) { | ||
core_1.ux.warn(`DYNO is a deprecated argument. Use ${color_1.default.cmd('--dyno-name')} or ${color_1.default.cmd('--process-type')} instead.`); | ||
} | ||
msg += ` dyno ${color_1.default.cyan(dyno)}`; | ||
restartUrl = `/apps/${app}/dynos/${encodeURIComponent(dyno)}`; | ||
} | ||
else { | ||
msg += ' all dynos'; | ||
restartUrl = `/apps/${app}/dynos`; | ||
} | ||
msg += ` on ${color_1.default.app(app)}`; | ||
core_1.ux.action.start(msg); | ||
await this.heroku.delete(dyno ? `/apps/${app}/dynos/${encodeURIComponent(dyno)}` : `/apps/${app}/dynos`); | ||
await this.heroku.delete(restartUrl, { | ||
headers: { | ||
Accept: 'application/vnd.heroku+json; version=3.sdk', | ||
}, | ||
}); | ||
core_1.ux.action.stop(); | ||
@@ -24,3 +44,6 @@ } | ||
exports.default = Restart; | ||
Restart.description = 'restart app dynos'; | ||
Restart.description = (0, tsheredoc_1.default)(` | ||
restart an app dyno or process type | ||
if neither --dyno nor --type are specified, restarts all dynos on app | ||
`); | ||
Restart.topic = 'ps'; | ||
@@ -30,9 +53,8 @@ Restart.aliases = ['dyno:restart']; | ||
Restart.examples = [ | ||
'$ heroku ps:restart web.1', | ||
'$ heroku ps:restart web', | ||
'$ heroku ps:restart', | ||
'$ heroku ps:restart --app myapp --dyno-name web.1', | ||
'$ heroku ps:restart --app myapp --process-type web', | ||
'$ heroku ps:restart --app myapp', | ||
]; | ||
Restart.help = 'if DYNO is not specified, restarts all dynos on app'; | ||
Restart.args = { | ||
dyno: core_1.Args.string({ required: false }), | ||
dyno: core_1.Args.string({ description: 'name of the dyno to restart', required: false, deprecated: true }), | ||
}; | ||
@@ -42,2 +64,12 @@ Restart.flags = { | ||
remote: command_1.flags.remote(), | ||
'dyno-name': command_1.flags.string({ | ||
char: 'd', | ||
description: 'name of the dyno to restart', | ||
}), | ||
'process-type': command_1.flags.string({ | ||
char: 'p', | ||
description: 'name of the process type to restart', | ||
completion: completions_1.ProcessTypeCompletion, | ||
exclusive: ['dyno-name'], | ||
}), | ||
}; |
@@ -8,5 +8,4 @@ import { Command } from '@heroku-cli/command'; | ||
static examples: string[]; | ||
static help: string; | ||
static args: { | ||
dyno: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>; | ||
dyno: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>; | ||
}; | ||
@@ -16,4 +15,6 @@ static flags: { | ||
remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'dyno-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
'process-type': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
}; | ||
run(): Promise<void>; | ||
} |
@@ -6,2 +6,4 @@ "use strict"; | ||
const core_1 = require("@oclif/core"); | ||
const completions_1 = require("@heroku-cli/command/lib/completions"); | ||
const tsheredoc_1 = require("tsheredoc"); | ||
class Stop extends command_1.Command { | ||
@@ -11,6 +13,26 @@ async run() { | ||
const app = flags.app; | ||
const dyno = args.dyno; | ||
const type = dyno.includes('.') ? 'ps' : 'type'; | ||
core_1.ux.action.start(`Stopping ${color_1.default.cyan(dyno)} ${type === 'ps' ? 'dyno' : 'dynos'} on ${color_1.default.app(app)}`); | ||
await this.heroku.post(`/apps/${app}/dynos/${dyno}/actions/stop`); | ||
const dyno = flags['dyno-name'] || args.dyno; | ||
const type = flags['process-type']; | ||
let msg = 'Stopping'; | ||
let stopUrl = ''; | ||
if (type) { | ||
msg += ` all ${color_1.default.cyan(type)} dynos`; | ||
stopUrl = `/apps/${app}/formations/${encodeURIComponent(type)}/actions/stop`; | ||
} | ||
else if (dyno) { | ||
if (args.dyno) { | ||
core_1.ux.warn(`DYNO is a deprecated argument. Use ${color_1.default.cmd('--dyno-name')} or ${color_1.default.cmd('--process-type')} instead.`); | ||
} | ||
msg += ` dyno ${color_1.default.cyan(dyno)}`; | ||
stopUrl = `/apps/${app}/dynos/${encodeURIComponent(dyno)}/actions/stop`; | ||
} | ||
else { | ||
core_1.ux.error((0, tsheredoc_1.default)(` | ||
Please specify a process type or dyno name to stop. | ||
See more help with --help | ||
`)); | ||
} | ||
msg += ` on ${color_1.default.app(app)}`; | ||
core_1.ux.action.start(msg); | ||
await this.heroku.post(stopUrl, { headers: { Accept: 'application/vnd.heroku+json; version=3.sdk' } }); | ||
core_1.ux.action.stop(); | ||
@@ -20,3 +42,3 @@ } | ||
exports.default = Stop; | ||
Stop.description = 'stop app dyno'; | ||
Stop.description = 'stop an app dyno or process type'; | ||
Stop.topic = 'ps'; | ||
@@ -26,8 +48,7 @@ Stop.aliases = ['dyno:stop', 'ps:kill', 'dyno:kill']; | ||
Stop.examples = [ | ||
'$ heroku ps:stop run.1828', | ||
'$ heroku ps:stop run', | ||
'$ heroku ps:stop --app myapp --dyno-name run.1828', | ||
'$ heroku ps:stop --app myapp --process-type run', | ||
]; | ||
Stop.help = 'stop app dyno or dyno type'; | ||
Stop.args = { | ||
dyno: core_1.Args.string({ required: true }), | ||
dyno: core_1.Args.string({ description: 'name of the dyno to stop', required: false, deprecated: true }), | ||
}; | ||
@@ -37,2 +58,12 @@ Stop.flags = { | ||
remote: command_1.flags.remote(), | ||
'dyno-name': command_1.flags.string({ | ||
char: 'd', | ||
description: 'name of the dyno to stop', | ||
}), | ||
'process-type': command_1.flags.string({ | ||
char: 'p', | ||
description: 'name of the process type to stop', | ||
completion: completions_1.ProcessTypeCompletion, | ||
exclusive: ['dyno-name'], | ||
}), | ||
}; |
@@ -75,3 +75,3 @@ "use strict"; | ||
} | ||
core_1.ux.styledHeader('Dyno Types'); | ||
core_1.ux.styledHeader('Process Types'); | ||
core_1.ux.table(formationTableData, { | ||
@@ -84,2 +84,3 @@ type: {}, | ||
}); | ||
core_1.ux.log(); | ||
core_1.ux.styledHeader('Dyno Totals'); | ||
@@ -86,0 +87,0 @@ core_1.ux.table(dynoTotalsTableData, { |
@@ -10,2 +10,3 @@ import { Command } from '@heroku-cli/command'; | ||
'data-cidr': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
features: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
generation: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>; | ||
@@ -12,0 +13,0 @@ 'kpi-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const completions_1 = require("../../lib/autocomplete/completions"); | ||
const parsers_1 = require("../../lib/spaces/parsers"); | ||
class Create extends command_1.Command { | ||
@@ -33,3 +34,3 @@ async run() { | ||
data_cidr: dataCidr, | ||
// features: splitCsv(features), | ||
features: (0, parsers_1.splitCsv)(features), | ||
generation, | ||
@@ -70,2 +71,3 @@ kpi_url: kpiUrl, | ||
State: allocating | ||
Generation: fir | ||
Created at: 2016-01-06T03:23:13Z | ||
@@ -77,3 +79,3 @@ `]; | ||
'data-cidr': command_1.flags.string({ description: 'RFC-1918 CIDR used by Heroku Data resources for the space' }), | ||
// features: flags.string({hidden: true, description: 'a list of features separated by commas'}), | ||
features: command_1.flags.string({ hidden: true, description: 'a list of features separated by commas' }), | ||
generation: command_1.flags.string({ description: 'generation for space', default: 'cedar', options: ['cedar', 'fir'] }), | ||
@@ -80,0 +82,0 @@ 'kpi-url': command_1.flags.string({ hidden: true, description: 'self-managed KPI endpoint to use' }), |
@@ -16,4 +16,3 @@ import { Command } from '@heroku-cli/command'; | ||
static example: string; | ||
private getTypeAndName; | ||
run(): Promise<void>; | ||
} |
@@ -8,11 +8,2 @@ "use strict"; | ||
class Add extends command_1.Command { | ||
constructor() { | ||
super(...arguments); | ||
this.getTypeAndName = function (app, space) { | ||
if (app) { | ||
return { type: 'app', name: app }; | ||
} | ||
return { type: 'space', name: space }; | ||
}; | ||
} | ||
async run() { | ||
@@ -22,7 +13,17 @@ const { flags, args } = await this.parse(Add); | ||
const { headers } = args; | ||
const typeAndName = this.getTypeAndName(app, space); | ||
let id; | ||
if (app) { | ||
const { body: herokuApp } = await this.heroku.get(`/apps/${app}`, { | ||
headers: { Accept: 'application/vnd.heroku+json; version=3.sdk' }, | ||
}); | ||
id = herokuApp.id; | ||
} | ||
else { | ||
const { body: herokuSpace } = await this.heroku.get(`/spaces/${space}`); | ||
id = herokuSpace.id; | ||
} | ||
const drainConfig = { | ||
owner: { | ||
type: typeAndName.type, | ||
id: typeAndName.name, | ||
type: app ? 'app' : 'space', | ||
id, | ||
}, | ||
@@ -36,20 +37,9 @@ signals: (0, util_1.validateAndFormatSignals)(signals), | ||
}; | ||
if (app) { | ||
const { body: drain } = await this.heroku.post(`/apps/${app}/telemetry-drains`, { | ||
body: drainConfig, | ||
headers: { | ||
Accept: 'application/vnd.heroku+json; version=3.sdk', | ||
}, | ||
}); | ||
core_1.ux.log(`successfully added drain ${drain.exporter.endpoint}`); | ||
} | ||
else if (space) { | ||
const { body: drain } = await this.heroku.post(`/spaces/${space}/telemetry-drains`, { | ||
body: drainConfig, | ||
headers: { | ||
Accept: 'application/vnd.heroku+json; version=3.sdk', | ||
}, | ||
}); | ||
core_1.ux.log(`successfully added drain ${drain.exporter.endpoint}`); | ||
} | ||
const { body: drain } = await this.heroku.post('/telemetry-drains', { | ||
body: drainConfig, | ||
headers: { | ||
Accept: 'application/vnd.heroku+json; version=3.sdk', | ||
}, | ||
}); | ||
core_1.ux.log(`successfully added drain ${drain.exporter.endpoint}`); | ||
} | ||
@@ -72,3 +62,3 @@ } | ||
Add a telemetry drain to an app to collect logs and traces: | ||
$ heroku telemetry:add --signals logs,traces --endpoint https://my-endpoint.com --transport http 'x-drain-example-team: API_KEY x-drain-example-dataset: METRICS_DATASET' | ||
$ heroku telemetry:add --app myapp --signals logs,traces --endpoint https://my-endpoint.com --transport http '{"x-drain-example-team": "API_KEY", "x-drain-example-dataset": "METRICS_DATASET"}' | ||
`); |
@@ -12,3 +12,3 @@ import { Command } from '@heroku-cli/command'; | ||
run(): Promise<void>; | ||
protected display(telemetryDrains: TelemetryDrains, ownerType: 'App' | 'Space'): void; | ||
protected display(telemetryDrains: TelemetryDrains, owner: string | undefined): void; | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
const { app, space } = flags; | ||
let drains = []; | ||
if (app) { | ||
@@ -16,3 +17,3 @@ const { body: appTelemetryDrains } = await this.heroku.get(`/apps/${app}/telemetry-drains`, { | ||
}); | ||
this.display(appTelemetryDrains, 'App'); | ||
drains = appTelemetryDrains; | ||
} | ||
@@ -25,13 +26,18 @@ else if (space) { | ||
}); | ||
this.display(spaceTelemetryDrains, 'Space'); | ||
drains = spaceTelemetryDrains; | ||
} | ||
this.display(drains, app || space); | ||
} | ||
display(telemetryDrains, ownerType) { | ||
core_1.ux.styledHeader(`${ownerType} Telemetry Drains`); | ||
core_1.ux.table(telemetryDrains, { | ||
ID: { get: telemetryDrain => telemetryDrain.id }, | ||
Signals: { get: telemetryDrain => telemetryDrain.signals }, | ||
Endpoint: { get: telemetryDrain => telemetryDrain.exporter.endpoint }, | ||
[ownerType]: { get: telemetryDrain => telemetryDrain.owner.name }, | ||
}); | ||
display(telemetryDrains, owner) { | ||
if (telemetryDrains.length === 0) { | ||
core_1.ux.log(`There are no telemetry drains in ${owner}`); | ||
} | ||
else { | ||
core_1.ux.styledHeader(`${owner} Telemetry Drains`); | ||
core_1.ux.table(telemetryDrains, { | ||
ID: { get: telemetryDrain => telemetryDrain.id }, | ||
Signals: { get: telemetryDrain => telemetryDrain.signals }, | ||
Endpoint: { get: telemetryDrain => telemetryDrain.exporter.endpoint }, | ||
}); | ||
} | ||
} | ||
@@ -38,0 +44,0 @@ } |
@@ -18,4 +18,4 @@ "use strict"; | ||
if (telemetry_drain_id) { | ||
const telemetryDrain = await this.removeDrain(telemetry_drain_id); | ||
core_1.ux.action.start(`Removing telemetry drain ${telemetry_drain_id}, which was configured for ${telemetryDrain.owner.type} ${telemetryDrain.owner.name}`); | ||
core_1.ux.action.start(`Removing telemetry drain ${telemetry_drain_id}`); | ||
await this.removeDrain(telemetry_drain_id); | ||
} | ||
@@ -22,0 +22,0 @@ else if (app) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const core_1 = require("@oclif/core"); | ||
const color_1 = require("@heroku-cli/color"); | ||
const colorize_1 = require("./colorize"); | ||
@@ -58,3 +59,4 @@ const generation_1 = require("../apps/generation"); | ||
}; | ||
if (firApp) | ||
if (firApp) { | ||
process.stderr.write(color_1.default.cyan.bold('Fetching logs...\n\n')); | ||
Object.assign(requestBodyParameters, { | ||
@@ -64,3 +66,4 @@ dyno: options.dyno, | ||
}); | ||
else | ||
} | ||
else { | ||
Object.assign(requestBodyParameters, { | ||
@@ -71,2 +74,3 @@ dyno: options.dyno || options.type, | ||
}); | ||
} | ||
let recreateLogSession = false; | ||
@@ -73,0 +77,0 @@ do { |
{ | ||
"name": "heroku", | ||
"description": "CLI to interact with Heroku", | ||
"version": "10.0.0-alpha.0", | ||
"version": "10.0.0-alpha.1", | ||
"author": "Heroku", | ||
@@ -320,2 +320,5 @@ "bin": "./bin/run", | ||
], | ||
"plugins:preinstall": [ | ||
"./lib/hooks/plugins/preinstall/disclaimers" | ||
], | ||
"prerun": [ | ||
@@ -392,3 +395,3 @@ "./lib/hooks/prerun/analytics" | ||
"types": "lib/index.d.ts", | ||
"gitHead": "0c489e559070678dff8057432917e8bffa0462eb" | ||
"gitHead": "1b4bc39a86afe951a9ceb20c40a884431fb1e86a" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1618261
834
42866