@heroku-cli/plugin-mtls 0.9.1 → 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +207 -110
- package/dist/README.md +347 -0
- package/{base.d.ts → dist/base.d.ts} +2 -2
- package/{base.js → dist/base.js} +5 -1
- package/dist/commands/data/mtls/certificates/create.d.ts +12 -0
- package/dist/commands/data/mtls/certificates/create.js +32 -0
- package/dist/commands/data/mtls/certificates/delete.d.ts +13 -0
- package/dist/commands/data/mtls/certificates/delete.js +32 -0
- package/dist/commands/data/mtls/certificates/download.d.ts +15 -0
- package/{commands → dist/commands}/data/mtls/certificates/download.js +41 -40
- package/dist/commands/data/mtls/certificates/get.d.ts +13 -0
- package/dist/commands/data/mtls/certificates/get.js +32 -0
- package/dist/commands/data/mtls/certificates/index.d.ts +12 -0
- package/{commands → dist/commands}/data/mtls/certificates/index.js +17 -16
- package/dist/commands/data/mtls/create.d.ts +12 -0
- package/dist/commands/data/mtls/create.js +43 -0
- package/dist/commands/data/mtls/destroy.d.ts +13 -0
- package/dist/commands/data/mtls/destroy.js +32 -0
- package/dist/commands/data/mtls/index.d.ts +12 -0
- package/{commands → dist/commands}/data/mtls/index.js +17 -16
- package/dist/commands/data/mtls/ip-rules/create.d.ts +14 -0
- package/dist/commands/data/mtls/ip-rules/create.js +37 -0
- package/dist/commands/data/mtls/ip-rules/delete.d.ts +14 -0
- package/dist/commands/data/mtls/ip-rules/delete.js +49 -0
- package/dist/commands/data/mtls/ip-rules/get.d.ts +13 -0
- package/dist/commands/data/mtls/ip-rules/get.js +27 -0
- package/dist/commands/data/mtls/ip-rules/index.d.ts +12 -0
- package/dist/commands/data/mtls/ip-rules/index.js +32 -0
- package/{lib → dist/lib}/fetcher.js +6 -6
- package/dist/oclif.manifest.json +575 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/file-helper.d.ts +4 -0
- package/dist/utils/file-helper.js +11 -0
- package/{utils → dist/utils}/is-error-http.js +1 -2
- package/{utils → dist/utils}/is-error-message.js +1 -2
- package/dist/utils/table.js +42 -0
- package/package.json +47 -11
- package/commands/data/mtls/certificates/create.d.ts +0 -13
- package/commands/data/mtls/certificates/create.js +0 -31
- package/commands/data/mtls/certificates/delete.d.ts +0 -14
- package/commands/data/mtls/certificates/delete.js +0 -31
- package/commands/data/mtls/certificates/download.d.ts +0 -16
- package/commands/data/mtls/certificates/get.d.ts +0 -14
- package/commands/data/mtls/certificates/get.js +0 -31
- package/commands/data/mtls/certificates/index.d.ts +0 -13
- package/commands/data/mtls/create.d.ts +0 -13
- package/commands/data/mtls/create.js +0 -42
- package/commands/data/mtls/destroy.d.ts +0 -14
- package/commands/data/mtls/destroy.js +0 -31
- package/commands/data/mtls/index.d.ts +0 -13
- package/commands/data/mtls/ip-rules/create.d.ts +0 -15
- package/commands/data/mtls/ip-rules/create.js +0 -33
- package/commands/data/mtls/ip-rules/delete.d.ts +0 -15
- package/commands/data/mtls/ip-rules/delete.js +0 -48
- package/commands/data/mtls/ip-rules/get.d.ts +0 -14
- package/commands/data/mtls/ip-rules/get.js +0 -26
- package/commands/data/mtls/ip-rules/index.d.ts +0 -13
- package/commands/data/mtls/ip-rules/index.js +0 -31
- package/oclif.manifest.json +0 -1
- package/utils/table.js +0 -18
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{lib → dist/lib}/fetcher.d.ts +0 -0
- /package/{utils → dist/utils}/is-error-http.d.ts +0 -0
- /package/{utils → dist/utils}/is-error-message.d.ts +0 -0
- /package/{utils → dist/utils}/table.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,34 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku-cli/plugin-mtls",
|
|
3
3
|
"description": "heroku mtls cli",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
5
5
|
"author": "Heroku",
|
|
6
6
|
"bugs": "https://github.com/heroku/heroku-cli-plugin-mtls/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@heroku-cli/color": "^
|
|
9
|
-
"@heroku-cli/command": "^
|
|
10
|
-
"@
|
|
11
|
-
"@oclif/
|
|
8
|
+
"@heroku-cli/color": "^2",
|
|
9
|
+
"@heroku-cli/command": "^11.5.0",
|
|
10
|
+
"@heroku-cli/schema": "^1.0.25",
|
|
11
|
+
"@oclif/core": "^2.16.0",
|
|
12
|
+
"@oclif/plugin-help": "^5",
|
|
12
13
|
"@types/inquirer": "^6.0.3",
|
|
13
14
|
"@types/supports-color": "^5.3.0",
|
|
14
|
-
"cli-ux": "^5.3.0",
|
|
15
15
|
"inquirer": "^6.5.0",
|
|
16
16
|
"tslib": "~2.6.2"
|
|
17
17
|
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@heroku-cli/schema": "^1.0.25",
|
|
20
|
+
"@oclif/test": "^3.2.15",
|
|
21
|
+
"@types/chai": "^4",
|
|
22
|
+
"@types/mocha": "^10.0.6",
|
|
23
|
+
"@types/node": "^20.10.4",
|
|
24
|
+
"@types/sinon": "^17.0.2",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
26
|
+
"@typescript-eslint/parser": "6.x",
|
|
27
|
+
"chai": "^4",
|
|
28
|
+
"eslint": "8.x",
|
|
29
|
+
"eslint-config-oclif": "^5.0.0",
|
|
30
|
+
"eslint-config-oclif-typescript": "^3.0.26",
|
|
31
|
+
"mocha": "10.x",
|
|
32
|
+
"nock": "^13.5.1",
|
|
33
|
+
"np": "^10.2.0",
|
|
34
|
+
"nyc": "^15.1.0",
|
|
35
|
+
"oclif": "^4.14.36",
|
|
36
|
+
"sinon": "^19",
|
|
37
|
+
"ts-node": "10.x",
|
|
38
|
+
"typescript": "^5"
|
|
39
|
+
},
|
|
18
40
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
41
|
+
"node": ">= 20.x"
|
|
20
42
|
},
|
|
43
|
+
"files": [
|
|
44
|
+
"/dist"
|
|
45
|
+
],
|
|
21
46
|
"homepage": "https://github.com/heroku/heroku-cli-plugin-mtls",
|
|
22
47
|
"keywords": [
|
|
23
|
-
"
|
|
48
|
+
"heroku-plugin",
|
|
49
|
+
"oclif"
|
|
24
50
|
],
|
|
25
51
|
"license": "MIT",
|
|
26
52
|
"oclif": {
|
|
27
|
-
"commands": "./commands",
|
|
28
53
|
"bin": "heroku",
|
|
54
|
+
"commands": "./dist/commands",
|
|
29
55
|
"devPlugins": [
|
|
30
56
|
"@oclif/plugin-help"
|
|
31
57
|
]
|
|
32
58
|
},
|
|
33
|
-
"repository": "heroku/heroku-cli-plugin-mtls"
|
|
34
|
-
|
|
59
|
+
"repository": "heroku/heroku-cli-plugin-mtls",
|
|
60
|
+
"scripts": {
|
|
61
|
+
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
62
|
+
"lint:fix": "yarn run lint -- --fix",
|
|
63
|
+
"posttest": "yarn run lint",
|
|
64
|
+
"prepack": "yarn run build",
|
|
65
|
+
"build": "rm -rf dist && tsc -b && oclif manifest && oclif readme && mv oclif.manifest.json ./dist/oclif.manifest.json && cp README.md ./dist/README.md",
|
|
66
|
+
"test": "nyc --extension .ts mocha --config test/mocharc.json --forbid-only \"test/**/*.test.ts\"",
|
|
67
|
+
"test:local": "nyc --extension .ts mocha --config test/mocharc.json \"test/**/*.test.ts\"",
|
|
68
|
+
"version": "oclif readme && git add README.md"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSCertificateCreate extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
8
|
-
class MTLSCertificateCreate extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSCertificateCreate);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
if (addon.kind === 'kafka') {
|
|
13
|
-
cli_ux_1.cli.error('Kafka certificates are availabe in your app\'s config vars');
|
|
14
|
-
}
|
|
15
|
-
cli_ux_1.cli.action.start(`Creating new certificate for ${color_1.color.cyan(addon.name)}`);
|
|
16
|
-
const { body: res } = await this.shogun.post(`${addon.endpoint}/certificates`, this.shogun.defaults);
|
|
17
|
-
cli_ux_1.cli.action.stop();
|
|
18
|
-
cli_ux_1.cli.styledObject(res);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.default = MTLSCertificateCreate;
|
|
22
|
-
MTLSCertificateCreate.args = [
|
|
23
|
-
{ name: 'addon' }
|
|
24
|
-
];
|
|
25
|
-
MTLSCertificateCreate.description = 'create a new certificate for your MTLS enabled addon';
|
|
26
|
-
MTLSCertificateCreate.examples = [
|
|
27
|
-
'$ heroku data:mtls:certificates:create postgresql-sushi-12345'
|
|
28
|
-
];
|
|
29
|
-
MTLSCertificateCreate.flags = {
|
|
30
|
-
app: command_1.flags.app({ required: true })
|
|
31
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSCertificateDelete extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
id: flags.IOptionFlag<string>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
8
|
-
class MTLSCertificateDelete extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSCertificateDelete);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
if (addon.kind === 'kafka') {
|
|
13
|
-
cli_ux_1.cli.error('Kafka certificates are availabe in your app\'s config vars');
|
|
14
|
-
}
|
|
15
|
-
cli_ux_1.cli.action.start(`Deleting certificate for ${color_1.color.cyan(addon.name)}`);
|
|
16
|
-
await this.shogun.delete(`${addon.endpoint}/certificates/${flags.id}`, this.shogun.defaults);
|
|
17
|
-
cli_ux_1.cli.action.stop();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.default = MTLSCertificateDelete;
|
|
21
|
-
MTLSCertificateDelete.args = [
|
|
22
|
-
{ name: 'addon' }
|
|
23
|
-
];
|
|
24
|
-
MTLSCertificateDelete.description = 'delete a specific certificate for your MTLS enabled addon';
|
|
25
|
-
MTLSCertificateDelete.examples = [
|
|
26
|
-
'$ heroku data:mtls:certificates:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"'
|
|
27
|
-
];
|
|
28
|
-
MTLSCertificateDelete.flags = {
|
|
29
|
-
app: command_1.flags.app({ required: true }),
|
|
30
|
-
id: command_1.flags.string({ required: true, description: 'id of certificate' })
|
|
31
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSCertificateDownload extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
dir: flags.IOptionFlag<string | undefined>;
|
|
12
|
-
id: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
prefix: flags.IOptionFlag<string>;
|
|
14
|
-
};
|
|
15
|
-
run(): Promise<void>;
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSCertificateGet extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
id: flags.IOptionFlag<string>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@heroku-cli/command");
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const base_1 = require("../../../../base");
|
|
6
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
7
|
-
class MTLSCertificateGet extends base_1.default {
|
|
8
|
-
async run() {
|
|
9
|
-
const { args, flags } = this.parse(MTLSCertificateGet);
|
|
10
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
11
|
-
if (addon.kind === 'kafka') {
|
|
12
|
-
cli_ux_1.cli.error('Kafka certificates are availabe in your app\'s config vars');
|
|
13
|
-
}
|
|
14
|
-
const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates/${flags.id}`, this.shogun.defaults);
|
|
15
|
-
delete res.private_key;
|
|
16
|
-
delete res.certificate_with_chain;
|
|
17
|
-
cli_ux_1.cli.styledObject(res);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.default = MTLSCertificateGet;
|
|
21
|
-
MTLSCertificateGet.args = [
|
|
22
|
-
{ name: 'addon' }
|
|
23
|
-
];
|
|
24
|
-
MTLSCertificateGet.description = 'get a specific certificate for your MTLS enabled addon';
|
|
25
|
-
MTLSCertificateGet.examples = [
|
|
26
|
-
'$ heroku data:mtls:certificates:create postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"'
|
|
27
|
-
];
|
|
28
|
-
MTLSCertificateGet.flags = {
|
|
29
|
-
app: command_1.flags.app({ required: true }),
|
|
30
|
-
id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
|
|
31
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSCertificatesIndex extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../base';
|
|
3
|
-
export default class MTLSCreate extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../lib/fetcher");
|
|
8
|
-
class MTLSCreate extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSCreate);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
if (addon.kind === 'kafka') {
|
|
13
|
-
cli_ux_1.cli.error('Kafka has mTLS enabled by default');
|
|
14
|
-
}
|
|
15
|
-
if (await cli_ux_1.cli.confirm('Enabling Mutual TLS will allow external access to this restricted data service. This action will be logged. Continue?')) {
|
|
16
|
-
cli_ux_1.cli.action.start(`Enabling MTLS on ${color_1.color.cyan(addon.name)}`);
|
|
17
|
-
try {
|
|
18
|
-
const { body: res } = await this.shogun.post(addon.endpoint, Object.assign(Object.assign({}, this.shogun.defaults), { body: {} }));
|
|
19
|
-
cli_ux_1.cli.styledObject(res);
|
|
20
|
-
cli_ux_1.cli.action.stop();
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
cli_ux_1.cli.action.stop('failed!');
|
|
24
|
-
cli_ux_1.cli.log(err.body.message);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
cli_ux_1.cli.warn('You did not enable mTLS');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = MTLSCreate;
|
|
33
|
-
MTLSCreate.args = [
|
|
34
|
-
{ name: 'addon' },
|
|
35
|
-
];
|
|
36
|
-
MTLSCreate.description = 'enable MTLS for your addon';
|
|
37
|
-
MTLSCreate.examples = [
|
|
38
|
-
'$ heroku data:mtls:create postgresql-sushi-12345'
|
|
39
|
-
];
|
|
40
|
-
MTLSCreate.flags = {
|
|
41
|
-
app: command_1.flags.app({ required: true })
|
|
42
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../base';
|
|
3
|
-
export default class MTLSDestroy extends BaseCommand {
|
|
4
|
-
static aliases: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
name: string;
|
|
7
|
-
}[];
|
|
8
|
-
static description: string;
|
|
9
|
-
static examples: string[];
|
|
10
|
-
static flags: {
|
|
11
|
-
app: flags.IOptionFlag<string>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../lib/fetcher");
|
|
8
|
-
class MTLSDestroy extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSDestroy);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
if (addon.kind === 'kafka') {
|
|
13
|
-
cli_ux_1.cli.error('Kafka has mTLS enabled by default and you cannot disable it');
|
|
14
|
-
}
|
|
15
|
-
cli_ux_1.cli.action.start(`Disabling MTLS on ${color_1.color.cyan(addon.name)}`);
|
|
16
|
-
await this.shogun.delete(addon.endpoint, this.shogun.defaults);
|
|
17
|
-
cli_ux_1.cli.action.stop();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.default = MTLSDestroy;
|
|
21
|
-
MTLSDestroy.aliases = ['data:mtls:delete'];
|
|
22
|
-
MTLSDestroy.args = [
|
|
23
|
-
{ name: 'addon' },
|
|
24
|
-
];
|
|
25
|
-
MTLSDestroy.description = 'destroy MTLS configuration on your addon';
|
|
26
|
-
MTLSDestroy.examples = [
|
|
27
|
-
'$ heroku data:mtls:destroy postgresql-sushi-12345'
|
|
28
|
-
];
|
|
29
|
-
MTLSDestroy.flags = {
|
|
30
|
-
app: command_1.flags.app({ required: true })
|
|
31
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../base';
|
|
3
|
-
export default class MTLSIndex extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSIPCreate extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
cidr: flags.IOptionFlag<string>;
|
|
12
|
-
description: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
8
|
-
class MTLSIPCreate extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSIPCreate);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
cli_ux_1.cli.action.start(`Creating IP Rule for ${color_1.color.cyan(addon.name)}`);
|
|
13
|
-
const { body: res } = await this.shogun.post(`${addon.endpoint}/ip-rules`, Object.assign(Object.assign({}, this.shogun.defaults), { body: {
|
|
14
|
-
cidr: flags.cidr,
|
|
15
|
-
description: flags.description
|
|
16
|
-
} }));
|
|
17
|
-
cli_ux_1.cli.action.stop();
|
|
18
|
-
cli_ux_1.cli.styledObject(res);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.default = MTLSIPCreate;
|
|
22
|
-
MTLSIPCreate.args = [
|
|
23
|
-
{ name: 'addon' }
|
|
24
|
-
];
|
|
25
|
-
MTLSIPCreate.description = 'create an IP Rule for your MTLS enabled addon';
|
|
26
|
-
MTLSIPCreate.examples = [
|
|
27
|
-
'$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address"'
|
|
28
|
-
];
|
|
29
|
-
MTLSIPCreate.flags = {
|
|
30
|
-
app: command_1.flags.app({ required: true }),
|
|
31
|
-
cidr: command_1.flags.string({ required: true }),
|
|
32
|
-
description: command_1.flags.string({ required: false })
|
|
33
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSIPDelete extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
cidr: flags.IOptionFlag<string | undefined>;
|
|
12
|
-
id: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const color_1 = require("@heroku-cli/color");
|
|
4
|
-
const command_1 = require("@heroku-cli/command");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
|
-
const base_1 = require("../../../../base");
|
|
7
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
8
|
-
class MTLSIPDelete extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSIPDelete);
|
|
11
|
-
if (!flags.cidr && !flags.id) {
|
|
12
|
-
cli_ux_1.cli.error('You need at least pass in the id or cidr of the IP Rule');
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
16
|
-
cli_ux_1.cli.action.start(`Deleting IP Rule for ${color_1.color.cyan(addon.name)}`);
|
|
17
|
-
let id = '';
|
|
18
|
-
if (flags.id) {
|
|
19
|
-
id = flags.id;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
|
|
23
|
-
const ipRule = ipRules.find(ipRule => ipRule.cidr === flags.cidr);
|
|
24
|
-
if (ipRule) {
|
|
25
|
-
id = ipRule.id;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
cli_ux_1.cli.error('No IP Rule found with that cidr');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
await this.shogun.delete(`${addon.endpoint}/ip-rules/${id}`, this.shogun.defaults);
|
|
32
|
-
cli_ux_1.cli.action.stop();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.default = MTLSIPDelete;
|
|
37
|
-
MTLSIPDelete.args = [
|
|
38
|
-
{ name: 'addon' }
|
|
39
|
-
];
|
|
40
|
-
MTLSIPDelete.description = 'delete a specific IP Rule for your MTLS enabled addon';
|
|
41
|
-
MTLSIPDelete.examples = [
|
|
42
|
-
'$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"'
|
|
43
|
-
];
|
|
44
|
-
MTLSIPDelete.flags = {
|
|
45
|
-
app: command_1.flags.app({ required: true }),
|
|
46
|
-
cidr: command_1.flags.string({ description: 'cidr of IP Rule' }),
|
|
47
|
-
id: command_1.flags.string({ description: 'id of IP Rule' })
|
|
48
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSIPGet extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
id: flags.IOptionFlag<string>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@heroku-cli/command");
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const base_1 = require("../../../../base");
|
|
6
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
7
|
-
class MTLSIPGet extends base_1.default {
|
|
8
|
-
async run() {
|
|
9
|
-
const { args, flags } = this.parse(MTLSIPGet);
|
|
10
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
11
|
-
const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules/${flags.id}`, this.shogun.defaults);
|
|
12
|
-
cli_ux_1.cli.styledObject(res);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = MTLSIPGet;
|
|
16
|
-
MTLSIPGet.args = [
|
|
17
|
-
{ name: 'addon' }
|
|
18
|
-
];
|
|
19
|
-
MTLSIPGet.description = 'get a specific IP Rule for your MTLS enabled addon';
|
|
20
|
-
MTLSIPGet.examples = [
|
|
21
|
-
'$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"'
|
|
22
|
-
];
|
|
23
|
-
MTLSIPGet.flags = {
|
|
24
|
-
app: command_1.flags.app({ required: true }),
|
|
25
|
-
id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
|
|
26
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { flags } from '@heroku-cli/command';
|
|
2
|
-
import BaseCommand from '../../../../base';
|
|
3
|
-
export default class MTLSIPIndex extends BaseCommand {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
}[];
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
app: flags.IOptionFlag<string>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@heroku-cli/command");
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const base_1 = require("../../../../base");
|
|
6
|
-
const fetcher_1 = require("../../../../lib/fetcher");
|
|
7
|
-
const table_1 = require("../../../../utils/table");
|
|
8
|
-
class MTLSIPIndex extends base_1.default {
|
|
9
|
-
async run() {
|
|
10
|
-
const { args, flags } = this.parse(MTLSIPIndex);
|
|
11
|
-
const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
|
|
12
|
-
const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
|
|
13
|
-
if (res.length === 0) {
|
|
14
|
-
cli_ux_1.cli.log('You currently have no IP Rules setup');
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
(0, table_1.ipRulesTable)(res);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.default = MTLSIPIndex;
|
|
22
|
-
MTLSIPIndex.args = [
|
|
23
|
-
{ name: 'addon' }
|
|
24
|
-
];
|
|
25
|
-
MTLSIPIndex.description = 'get the IP Rules for your MTLS enabled addon';
|
|
26
|
-
MTLSIPIndex.examples = [
|
|
27
|
-
'$ heroku data:mtls:ip-rules postgresql-sushi-12345',
|
|
28
|
-
];
|
|
29
|
-
MTLSIPIndex.flags = {
|
|
30
|
-
app: command_1.flags.app({ required: true })
|
|
31
|
-
};
|
package/oclif.manifest.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"0.9.1","commands":{"data:mtls:create":{"id":"data:mtls:create","description":"enable MTLS for your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:create postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:destroy":{"id":"data:mtls:destroy","description":"destroy MTLS configuration on your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":["data:mtls:delete"],"examples":["$ heroku data:mtls:destroy postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls":{"id":"data:mtls","description":"get the status of MTLS for your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:create":{"id":"data:mtls:certificates:create","description":"create a new certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:create postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:delete":{"id":"data:mtls:certificates:delete","description":"delete a specific certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:delete postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of certificate","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:download":{"id":"data:mtls:certificates:download","description":"download your certificate bundle for your mTLS addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f\"","$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f\" --dir \"./folder\"","$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f --prefix \"prefix_\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"dir":{"name":"dir","type":"option","description":"directory to download files to. defaults to HOME:/.postgresql","required":false},"id":{"name":"id","type":"option","description":"ID of certificate to download","required":false},"prefix":{"name":"prefix","type":"option","description":"prefix to put in front of downloaded file names","required":true,"default":""}},"args":[{"name":"addon"}]},"data:mtls:certificates:get":{"id":"data:mtls:certificates:get","description":"get a specific certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:create postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of IP Rule","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates":{"id":"data:mtls:certificates","description":"get the certificates for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:create":{"id":"data:mtls:ip-rules:create","description":"create an IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr \"1.2.3.4/32\" --description \"home IP address\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"cidr":{"name":"cidr","type":"option","required":true},"description":{"name":"description","type":"option","required":false}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:delete":{"id":"data:mtls:ip-rules:delete","description":"delete a specific IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"cidr":{"name":"cidr","type":"option","description":"cidr of IP Rule"},"id":{"name":"id","type":"option","description":"id of IP Rule"}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:get":{"id":"data:mtls:ip-rules:get","description":"get a specific IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of IP Rule","required":true}},"args":[{"name":"addon"}]},"data:mtls:ip-rules":{"id":"data:mtls:ip-rules","description":"get the IP Rules for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]}}}
|
package/utils/table.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ipRulesTable = exports.certificatesTable = void 0;
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const certificatesTable = (data) => cli_ux_1.cli.table(data, {
|
|
6
|
-
id: { header: 'id' },
|
|
7
|
-
created_at: { header: 'Created At' },
|
|
8
|
-
status: { header: 'Status' }
|
|
9
|
-
});
|
|
10
|
-
exports.certificatesTable = certificatesTable;
|
|
11
|
-
const ipRulesTable = (data) => cli_ux_1.cli.table(data, {
|
|
12
|
-
id: { header: 'id' },
|
|
13
|
-
cidr: { header: 'CIDR' },
|
|
14
|
-
description: { header: 'Description' },
|
|
15
|
-
created_at: { header: 'Created At' },
|
|
16
|
-
status: { header: 'Status' }
|
|
17
|
-
});
|
|
18
|
-
exports.ipRulesTable = ipRulesTable;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|