@heroku-cli/plugin-mtls 1.0.2 → 2.0.1
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 +66 -27
- package/dist/base.d.ts +8 -8
- package/dist/base.js +4 -7
- package/dist/commands/data/mtls/certificates/create.d.ts +3 -3
- package/dist/commands/data/mtls/certificates/create.js +16 -18
- package/dist/commands/data/mtls/certificates/delete.d.ts +4 -4
- package/dist/commands/data/mtls/certificates/delete.js +15 -18
- package/dist/commands/data/mtls/certificates/download.d.ts +6 -6
- package/dist/commands/data/mtls/certificates/download.js +58 -62
- package/dist/commands/data/mtls/certificates/get.d.ts +4 -4
- package/dist/commands/data/mtls/certificates/get.js +14 -16
- package/dist/commands/data/mtls/certificates/index.d.ts +3 -3
- package/dist/commands/data/mtls/certificates/index.js +22 -25
- package/dist/commands/data/mtls/create.d.ts +3 -3
- package/dist/commands/data/mtls/create.js +21 -23
- package/dist/commands/data/mtls/destroy.d.ts +3 -3
- package/dist/commands/data/mtls/destroy.js +14 -17
- package/dist/commands/data/mtls/index.d.ts +3 -3
- package/dist/commands/data/mtls/index.js +31 -40
- package/dist/commands/data/mtls/ip-rules/create.d.ts +5 -5
- package/dist/commands/data/mtls/ip-rules/create.js +19 -21
- package/dist/commands/data/mtls/ip-rules/delete.d.ts +5 -5
- package/dist/commands/data/mtls/ip-rules/delete.js +18 -21
- package/dist/commands/data/mtls/ip-rules/get.d.ts +4 -4
- package/dist/commands/data/mtls/ip-rules/get.js +12 -15
- package/dist/commands/data/mtls/ip-rules/index.d.ts +3 -3
- package/dist/commands/data/mtls/ip-rules/index.js +12 -15
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/lib/addon-fetcher.d.ts +7 -0
- package/dist/lib/addon-fetcher.js +23 -0
- package/dist/utils/file-helper.d.ts +1 -1
- package/dist/utils/file-helper.js +4 -11
- package/dist/utils/is-error-http.js +1 -4
- package/dist/utils/is-error-message.js +1 -4
- package/dist/utils/table.d.ts +1 -1
- package/dist/utils/table.js +11 -16
- package/oclif.manifest.json +123 -38
- package/package.json +34 -39
- package/CHANGELOG.md +0 -1
- package/dist/lib/fetcher.d.ts +0 -1
- package/dist/lib/fetcher.js +0 -70
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,120 +1,116 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
1
|
/* eslint-disable complexity */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { flags } from '@heroku-cli/command';
|
|
3
|
+
import * as color from '@heroku/heroku-cli-util/color';
|
|
4
|
+
import { confirm } from '@heroku/heroku-cli-util/hux';
|
|
5
|
+
import { select } from '@inquirer/prompts';
|
|
6
|
+
import { Args } from '@oclif/core';
|
|
7
|
+
import { ux } from '@oclif/core/ux';
|
|
8
|
+
import { homedir } from 'node:os';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import Command from '../../../../base.js';
|
|
11
|
+
import { fetcher } from '../../../../lib/addon-fetcher.js';
|
|
12
|
+
import { existsSync, mkdirSync, writeFile } from '../../../../utils/file-helper.js';
|
|
13
|
+
import { isErrorHttp } from '../../../../utils/is-error-http.js';
|
|
14
|
+
import { isErrorMessage } from '../../../../utils/is-error-message.js';
|
|
15
15
|
const write = (path, data, options = null) => new Promise((resolve, reject) => {
|
|
16
|
-
|
|
16
|
+
writeFile(path, data, options, (err) => {
|
|
17
17
|
if (err)
|
|
18
18
|
reject(err);
|
|
19
19
|
resolve();
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
class MTLSCertificateDownload extends
|
|
22
|
+
export default class MTLSCertificateDownload extends Command {
|
|
23
23
|
static args = {
|
|
24
|
-
addon:
|
|
24
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
25
25
|
};
|
|
26
26
|
static description = 'download your certificate bundle for your mTLS add-on';
|
|
27
27
|
static examples = [
|
|
28
28
|
'$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" -a example-app',
|
|
29
29
|
'$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" --dir "./folder" -a example-app',
|
|
30
|
-
'$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f --prefix "prefix_" -a example-app'
|
|
30
|
+
'$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f --prefix "prefix_" -a example-app',
|
|
31
31
|
];
|
|
32
32
|
static flags = {
|
|
33
|
-
app:
|
|
34
|
-
dir:
|
|
35
|
-
id:
|
|
36
|
-
prefix:
|
|
33
|
+
app: flags.app({ required: true }),
|
|
34
|
+
dir: flags.string({ required: false, description: 'directory to download files to. defaults to HOME:/.postgresql' }),
|
|
35
|
+
id: flags.string({ required: false, description: 'ID of certificate to download' }),
|
|
36
|
+
prefix: flags.string({ required: true, description: 'prefix to put in front of downloaded file names', default: '' }),
|
|
37
37
|
};
|
|
38
38
|
async run() {
|
|
39
39
|
try {
|
|
40
40
|
const { args, flags } = await this.parse(MTLSCertificateDownload);
|
|
41
|
-
const addon = await (
|
|
41
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
42
42
|
if (addon.kind === 'kafka') {
|
|
43
|
-
|
|
43
|
+
ux.error('Kafka certificates are available in your app\'s config vars');
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
ux.action.start(`Downloading certificates for ${color.addon(addon.name)}`);
|
|
46
46
|
const [{ body: mtls }, { body: certs }] = await Promise.all([
|
|
47
47
|
this.shogun.get(addon.endpoint, this.shogun.defaults),
|
|
48
|
-
this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults)
|
|
48
|
+
this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults),
|
|
49
49
|
]);
|
|
50
50
|
let baseCert = certs[0];
|
|
51
51
|
const readyCerts = certs.filter(cert => cert.status === 'ready');
|
|
52
52
|
if (flags.id) {
|
|
53
53
|
const certById = certs.find(cert => cert.id === flags.id);
|
|
54
54
|
if (!certById) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
ux.action.stop();
|
|
56
|
+
ux.error(`No Certificate found with id ${color.cyan(flags.id)}`, { exit: 0 });
|
|
57
57
|
}
|
|
58
58
|
else if (certById.status === 'ready') {
|
|
59
59
|
baseCert = certById;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
ux.action.stop();
|
|
63
|
+
ux.error('This certificate is not ready to download', { exit: 0 });
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
else if (readyCerts.length === 0) {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
ux.action.stop();
|
|
68
|
+
ux.error('There are no certificates to download', { exit: 0 });
|
|
69
69
|
}
|
|
70
70
|
else if (readyCerts.length > 1) {
|
|
71
|
-
await
|
|
72
|
-
const
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
type: 'list'
|
|
81
|
-
}
|
|
82
|
-
]);
|
|
83
|
-
baseCert = readyCerts.find(cert => cert.id === answers.cert);
|
|
71
|
+
await ux.action.pauseAsync(async () => {
|
|
72
|
+
const certId = await select({
|
|
73
|
+
choices: readyCerts.map(cert => ({
|
|
74
|
+
name: `${cert.id} (expires ${cert.expires_at})`,
|
|
75
|
+
value: cert.id,
|
|
76
|
+
})),
|
|
77
|
+
message: 'There is more than one certificate available to download, which would you like to download?',
|
|
78
|
+
});
|
|
79
|
+
baseCert = readyCerts.find(cert => cert.id === certId);
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
82
|
const { body: cert } = await this.shogun.get(`${addon.endpoint}/certificates/${baseCert.id}`, this.shogun.defaults);
|
|
87
|
-
const
|
|
88
|
-
!
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
83
|
+
const dir = flags.dir || join(homedir(), '.postgresql');
|
|
84
|
+
if (!existsSync(dir))
|
|
85
|
+
mkdirSync(dir);
|
|
86
|
+
const key = join(dir, `${flags.prefix}postgresql.key`);
|
|
87
|
+
const crt = join(dir, `${flags.prefix}postgresql.crt`);
|
|
88
|
+
const root = join(dir, `${flags.prefix}root.crt`);
|
|
92
89
|
let download = true;
|
|
93
|
-
if (
|
|
94
|
-
download = await
|
|
90
|
+
if (existsSync(root) || existsSync(key) || existsSync(crt)) {
|
|
91
|
+
download = await confirm('One of these files already exists. Would you like to overwrite them? (yes/no)');
|
|
95
92
|
}
|
|
96
93
|
if (download) {
|
|
97
94
|
await Promise.all([
|
|
98
95
|
write(root, mtls?.certificate_authority_chain ?? ''),
|
|
99
96
|
write(key, cert?.private_key ?? '', { mode: '0600' }),
|
|
100
|
-
write(crt, cert?.certificate_with_chain ?? '')
|
|
97
|
+
write(crt, cert?.certificate_with_chain ?? ''),
|
|
101
98
|
]);
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
ux.action.stop();
|
|
100
|
+
ux.stdout(`your certs are now located in ${color.cyan(dir)}`);
|
|
104
101
|
}
|
|
105
102
|
else {
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
ux.action.stop();
|
|
104
|
+
ux.stdout('you did not download the certs');
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
|
-
catch (
|
|
111
|
-
if (
|
|
112
|
-
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
|
|
109
|
+
ux.warn('mTLS is not setup yet for this add-on');
|
|
113
110
|
}
|
|
114
|
-
else if (
|
|
115
|
-
|
|
111
|
+
else if (isErrorMessage(error)) {
|
|
112
|
+
ux.error(error.message);
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
|
-
exports.default = MTLSCertificateDownload;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSCertificateGet extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
addon: import("@oclif/core/
|
|
4
|
+
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
app: import("@oclif/core/
|
|
10
|
-
id: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
};
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class MTLSCertificateGet extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import { styledObject } from '@heroku/heroku-cli-util/hux';
|
|
3
|
+
import { Args } from '@oclif/core';
|
|
4
|
+
import { ux } from '@oclif/core/ux';
|
|
5
|
+
import Command from '../../../../base.js';
|
|
6
|
+
import { fetcher } from '../../../../lib/addon-fetcher.js';
|
|
7
|
+
export default class MTLSCertificateGet extends Command {
|
|
9
8
|
static args = {
|
|
10
|
-
addon:
|
|
9
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
11
10
|
};
|
|
12
11
|
static description = 'get a specific certificate for your mTLS enabled add-on';
|
|
13
12
|
static examples = [
|
|
14
|
-
'$ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
|
|
13
|
+
'$ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
|
|
15
14
|
];
|
|
16
15
|
static flags = {
|
|
17
|
-
app:
|
|
18
|
-
id:
|
|
16
|
+
app: flags.app({ required: true }),
|
|
17
|
+
id: flags.string({ required: true, description: 'id of IP Rule' }),
|
|
19
18
|
};
|
|
20
19
|
async run() {
|
|
21
20
|
const { args, flags } = await this.parse(MTLSCertificateGet);
|
|
22
|
-
const addon = await (
|
|
21
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
23
22
|
if (addon.kind === 'kafka') {
|
|
24
|
-
|
|
23
|
+
ux.error('Kafka certificates are available in your app\'s config vars');
|
|
25
24
|
}
|
|
26
25
|
const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates/${flags.id}`, this.shogun.defaults);
|
|
27
26
|
delete res.private_key;
|
|
28
27
|
delete res.certificate_with_chain;
|
|
29
|
-
|
|
28
|
+
styledObject(res);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
exports.default = MTLSCertificateGet;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSCertificatesIndex extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
addon: import("@oclif/core/
|
|
4
|
+
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
app: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
run(): Promise<void>;
|
|
12
12
|
}
|
|
@@ -1,55 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const table_1 = require("../../../../utils/table");
|
|
11
|
-
class MTLSCertificatesIndex extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import { Args } from '@oclif/core';
|
|
3
|
+
import { ux } from '@oclif/core/ux';
|
|
4
|
+
import Command from '../../../../base.js';
|
|
5
|
+
import { fetcher } from '../../../../lib/addon-fetcher.js';
|
|
6
|
+
import { isErrorHttp } from '../../../../utils/is-error-http.js';
|
|
7
|
+
import { isErrorMessage } from '../../../../utils/is-error-message.js';
|
|
8
|
+
import { certificatesTable } from '../../../../utils/table.js';
|
|
9
|
+
export default class MTLSCertificatesIndex extends Command {
|
|
12
10
|
static args = {
|
|
13
|
-
addon:
|
|
11
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
14
12
|
};
|
|
15
13
|
static description = 'get the certificates for your mTLS enabled add-on';
|
|
16
14
|
static examples = [
|
|
17
15
|
'$ heroku data:mtls:certificates postgresql-sushi-12345 -a example-app',
|
|
18
16
|
];
|
|
19
17
|
static flags = {
|
|
20
|
-
app:
|
|
18
|
+
app: flags.app({ required: true }),
|
|
21
19
|
};
|
|
22
20
|
async run() {
|
|
23
21
|
try {
|
|
24
22
|
const { args, flags } = await this.parse(MTLSCertificatesIndex);
|
|
25
|
-
const addon = await (
|
|
23
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
26
24
|
if (addon.kind === 'kafka') {
|
|
27
|
-
|
|
25
|
+
ux.error('Kafka certificates are available in your app\'s config vars');
|
|
28
26
|
}
|
|
29
27
|
const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults);
|
|
30
28
|
if (res.length === 0) {
|
|
31
|
-
|
|
29
|
+
ux.stdout('You currently have no certificates setup');
|
|
32
30
|
}
|
|
33
31
|
else {
|
|
34
|
-
|
|
32
|
+
certificatesTable(res);
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
catch (
|
|
38
|
-
if (!
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (!isErrorMessage(error)) {
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
43
|
-
|
|
39
|
+
if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
|
|
40
|
+
if (error.http.body.resource === 'add_on') {
|
|
41
|
+
ux.error(error.message);
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
|
-
|
|
44
|
+
ux.warn('mTLS is not set up yet for this add-on');
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
else {
|
|
50
|
-
|
|
48
|
+
ux.error(error.message);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
|
-
exports.default = MTLSCertificatesIndex;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Command from '../../../base';
|
|
1
|
+
import Command from '../../../base.js';
|
|
2
2
|
export default class MTLSCreate extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
addon: import("@oclif/core/
|
|
4
|
+
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
app: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
run(): Promise<void>;
|
|
12
12
|
}
|
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class MTLSCreate extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
|
+
import { confirm, styledObject } from '@heroku/heroku-cli-util/hux';
|
|
4
|
+
import { Args } from '@oclif/core';
|
|
5
|
+
import { ux } from '@oclif/core/ux';
|
|
6
|
+
import Command from '../../../base.js';
|
|
7
|
+
import { fetcher } from '../../../lib/addon-fetcher.js';
|
|
8
|
+
export default class MTLSCreate extends Command {
|
|
10
9
|
static args = {
|
|
11
|
-
addon:
|
|
10
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
12
11
|
};
|
|
13
12
|
static description = 'enable MTLS for your addon';
|
|
14
13
|
static examples = [
|
|
15
|
-
'$ heroku data:mtls:create postgresql-sushi-12345 -a example-app'
|
|
14
|
+
'$ heroku data:mtls:create postgresql-sushi-12345 -a example-app',
|
|
16
15
|
];
|
|
17
16
|
static flags = {
|
|
18
|
-
app:
|
|
17
|
+
app: flags.app({ required: true }),
|
|
19
18
|
};
|
|
20
19
|
async run() {
|
|
21
20
|
const { args, flags } = await this.parse(MTLSCreate);
|
|
22
|
-
const addon = await (
|
|
21
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
23
22
|
if (addon.kind === 'kafka') {
|
|
24
|
-
|
|
23
|
+
ux.error('Kafka has mTLS enabled by default');
|
|
25
24
|
}
|
|
26
|
-
if (await
|
|
27
|
-
|
|
25
|
+
if (await confirm('Enabling Mutual TLS will allow external access to this restricted data service. This action will be logged. Continue?')) {
|
|
26
|
+
ux.action.start(`Enabling MTLS on ${color.addon(addon.name)}`);
|
|
28
27
|
try {
|
|
29
28
|
const { body: res } = await this.shogun.post(addon.endpoint, { ...this.shogun.defaults, body: {} });
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
styledObject(res);
|
|
30
|
+
ux.action.stop();
|
|
32
31
|
}
|
|
33
|
-
catch (
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
catch (error) {
|
|
33
|
+
ux.action.stop('failed!');
|
|
34
|
+
ux.stdout(error.body.message);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
|
-
|
|
38
|
+
ux.warn('You did not enable mTLS');
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
exports.default = MTLSCreate;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Command from '../../../base';
|
|
1
|
+
import Command from '../../../base.js';
|
|
2
2
|
export default class MTLSDestroy extends Command {
|
|
3
3
|
static aliases: string[];
|
|
4
4
|
static args: {
|
|
5
|
-
addon: import("@oclif/core/
|
|
5
|
+
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
6
|
};
|
|
7
7
|
static description: string;
|
|
8
8
|
static examples: string[];
|
|
9
9
|
static flags: {
|
|
10
|
-
app: import("@oclif/core/
|
|
10
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
};
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
|
|
9
|
-
class MTLSDestroy extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
|
+
import { Args } from '@oclif/core';
|
|
4
|
+
import { ux } from '@oclif/core/ux';
|
|
5
|
+
import Command from '../../../base.js';
|
|
6
|
+
import { fetcher } from '../../../lib/addon-fetcher.js';
|
|
7
|
+
export default class MTLSDestroy extends Command {
|
|
10
8
|
static aliases = ['data:mtls:delete'];
|
|
11
9
|
static args = {
|
|
12
|
-
addon:
|
|
10
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
13
11
|
};
|
|
14
12
|
static description = 'disable mTLS for your add-on';
|
|
15
13
|
static examples = [
|
|
16
|
-
'$ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app'
|
|
14
|
+
'$ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app',
|
|
17
15
|
];
|
|
18
16
|
static flags = {
|
|
19
|
-
app:
|
|
17
|
+
app: flags.app({ required: true }),
|
|
20
18
|
};
|
|
21
19
|
async run() {
|
|
22
20
|
const { args, flags } = await this.parse(MTLSDestroy);
|
|
23
|
-
const addon = await (
|
|
21
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
24
22
|
if (addon.kind === 'kafka') {
|
|
25
|
-
|
|
23
|
+
ux.error('Kafka has mTLS enabled by default and you cannot disable it');
|
|
26
24
|
}
|
|
27
|
-
|
|
25
|
+
ux.action.start(`Disabling MTLS on ${color.addon(addon.name)}`);
|
|
28
26
|
await this.shogun.delete(addon.endpoint, this.shogun.defaults);
|
|
29
|
-
|
|
27
|
+
ux.action.stop();
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
exports.default = MTLSDestroy;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Command from '../../../base';
|
|
1
|
+
import Command from '../../../base.js';
|
|
2
2
|
export default class MTLSIndex extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
addon: import("@oclif/core/
|
|
4
|
+
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
app: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
run(): Promise<void>;
|
|
12
12
|
}
|