@heroku-cli/plugin-mtls 1.0.1 → 2.0.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 +90 -51
- 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 +17 -19
- package/dist/commands/data/mtls/certificates/delete.d.ts +4 -4
- package/dist/commands/data/mtls/certificates/delete.js +16 -19
- package/dist/commands/data/mtls/certificates/download.d.ts +6 -6
- package/dist/commands/data/mtls/certificates/download.js +59 -63
- package/dist/commands/data/mtls/certificates/get.d.ts +4 -4
- package/dist/commands/data/mtls/certificates/get.js +15 -17
- package/dist/commands/data/mtls/certificates/index.d.ts +3 -3
- package/dist/commands/data/mtls/certificates/index.js +23 -26
- 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 +15 -18
- package/dist/commands/data/mtls/index.d.ts +3 -3
- package/dist/commands/data/mtls/index.js +32 -41
- package/dist/commands/data/mtls/ip-rules/create.d.ts +5 -5
- package/dist/commands/data/mtls/ip-rules/create.js +20 -22
- package/dist/commands/data/mtls/ip-rules/delete.d.ts +5 -5
- package/dist/commands/data/mtls/ip-rules/delete.js +19 -22
- package/dist/commands/data/mtls/ip-rules/get.d.ts +4 -4
- package/dist/commands/data/mtls/ip-rules/get.js +13 -16
- package/dist/commands/data/mtls/ip-rules/index.d.ts +3 -3
- package/dist/commands/data/mtls/ip-rules/index.js +13 -16
- 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/{dist/oclif.manifest.json → oclif.manifest.json} +134 -49
- package/package.json +36 -36
- package/dist/README.md +0 -347
- package/dist/lib/fetcher.d.ts +0 -1
- package/dist/lib/fetcher.js +0 -70
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,84 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const table_1 = require("../../../utils/table");
|
|
12
|
-
class MTLSIndex extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import { styledHeader, 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
|
+
import { isErrorHttp } from '../../../utils/is-error-http.js';
|
|
8
|
+
import { isErrorMessage } from '../../../utils/is-error-message.js';
|
|
9
|
+
import { certificatesTable, ipRulesTable } from '../../../utils/table.js';
|
|
10
|
+
export default class MTLSIndex extends Command {
|
|
13
11
|
static args = {
|
|
14
|
-
addon:
|
|
12
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
15
13
|
};
|
|
16
|
-
static description = 'get the status of
|
|
14
|
+
static description = 'get the status of mTLS for your add-on';
|
|
17
15
|
static examples = [
|
|
18
16
|
'$ heroku data:mtls postgresql-sushi-12345 -a example-app',
|
|
19
17
|
];
|
|
20
18
|
static flags = {
|
|
21
|
-
app:
|
|
19
|
+
app: flags.app({ required: true }),
|
|
22
20
|
};
|
|
23
21
|
async run() {
|
|
24
22
|
try {
|
|
25
23
|
const { args, flags } = await this.parse(MTLSIndex);
|
|
26
|
-
const addon = await (
|
|
24
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
27
25
|
if (addon.kind === 'kafka') {
|
|
28
26
|
const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
|
|
29
|
-
|
|
27
|
+
styledObject({
|
|
30
28
|
addon: addon.name,
|
|
31
|
-
'TLS-status': 'Available'
|
|
29
|
+
'TLS-status': 'Available',
|
|
32
30
|
});
|
|
33
31
|
if (ipRules.length > 0) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.log();
|
|
37
|
-
(0, table_1.ipRulesTable)(ipRules);
|
|
32
|
+
styledHeader('IP Rules');
|
|
33
|
+
ipRulesTable(ipRules);
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
else {
|
|
41
37
|
const [{ body: mtls }, { body: certs }, { body: ipRules }] = await Promise.all([
|
|
42
38
|
this.shogun.get(addon.endpoint, this.shogun.defaults),
|
|
43
39
|
this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults),
|
|
44
|
-
this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults)
|
|
40
|
+
this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults),
|
|
45
41
|
]);
|
|
46
42
|
delete mtls.certificate_authority_chain;
|
|
47
|
-
|
|
43
|
+
styledObject({
|
|
48
44
|
addon: mtls.addon,
|
|
49
45
|
app: mtls.app,
|
|
50
|
-
'TLS-status': mtls.status
|
|
46
|
+
'TLS-status': mtls.status,
|
|
51
47
|
});
|
|
52
48
|
if (certs.length > 0) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.log();
|
|
56
|
-
(0, table_1.certificatesTable)(certs);
|
|
49
|
+
styledHeader('Certificates');
|
|
50
|
+
certificatesTable(certs);
|
|
57
51
|
}
|
|
58
52
|
if (ipRules.length > 0) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.log();
|
|
62
|
-
(0, table_1.ipRulesTable)(ipRules);
|
|
53
|
+
styledHeader('IP Rules');
|
|
54
|
+
ipRulesTable(ipRules);
|
|
63
55
|
}
|
|
64
56
|
}
|
|
65
57
|
}
|
|
66
|
-
catch (
|
|
67
|
-
if (!
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (!isErrorMessage(error)) {
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
70
|
-
if (
|
|
71
|
-
if (
|
|
72
|
-
|
|
62
|
+
if (isErrorHttp(error) && error.http && error.http.statusCode === 404) {
|
|
63
|
+
if (error.http.body.resource === 'add_on') {
|
|
64
|
+
ux.error(error.message);
|
|
73
65
|
}
|
|
74
66
|
else {
|
|
75
|
-
|
|
67
|
+
ux.warn('mTLS is not set up yet for this add-on');
|
|
76
68
|
}
|
|
77
69
|
}
|
|
78
70
|
else {
|
|
79
|
-
|
|
71
|
+
ux.error(error.message);
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
|
-
exports.default = MTLSIndex;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSIPCreate 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
|
-
cidr: import("@oclif/core/
|
|
11
|
-
description: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
cidr: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class MTLSIPCreate extends base_1.default {
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
|
+
import { 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 MTLSIPCreate extends Command {
|
|
10
9
|
static args = {
|
|
11
|
-
addon:
|
|
10
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
12
11
|
};
|
|
13
|
-
static description = 'create
|
|
12
|
+
static description = 'create a new IP Rule for your mTLS enabled add-on';
|
|
14
13
|
static examples = [
|
|
15
|
-
'$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address" -a example-app'
|
|
14
|
+
'$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address" -a example-app',
|
|
16
15
|
];
|
|
17
16
|
static flags = {
|
|
18
|
-
app:
|
|
19
|
-
cidr:
|
|
20
|
-
description:
|
|
17
|
+
app: flags.app({ required: true }),
|
|
18
|
+
cidr: flags.string({ description: 'CIDR block to allow', required: true }),
|
|
19
|
+
description: flags.string({ description: 'description of the IP rule' }),
|
|
21
20
|
};
|
|
22
21
|
async run() {
|
|
23
22
|
const { args, flags } = await this.parse(MTLSIPCreate);
|
|
24
|
-
const addon = await (
|
|
25
|
-
|
|
23
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
24
|
+
ux.action.start(`Creating IP Rule for ${color.addon(addon.name)}`);
|
|
26
25
|
const { body: res } = await this.shogun.post(`${addon.endpoint}/ip-rules`, {
|
|
27
26
|
...this.shogun.defaults,
|
|
28
27
|
body: {
|
|
29
28
|
cidr: flags.cidr,
|
|
30
|
-
description: flags.description
|
|
31
|
-
}
|
|
29
|
+
description: flags.description,
|
|
30
|
+
},
|
|
32
31
|
});
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
ux.action.stop();
|
|
33
|
+
styledObject(res);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
exports.default = MTLSIPCreate;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSIPDelete 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
|
-
cidr: import("@oclif/core/
|
|
11
|
-
id: import("@oclif/core/
|
|
9
|
+
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
cidr: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
|
|
9
|
-
class MTLSIPDelete 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 MTLSIPDelete extends Command {
|
|
10
8
|
static args = {
|
|
11
|
-
addon:
|
|
9
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
12
10
|
};
|
|
13
|
-
static description = 'delete a specific IP Rule for your
|
|
11
|
+
static description = 'delete a specific IP Rule for your mTLS enabled add-on';
|
|
14
12
|
static examples = [
|
|
15
|
-
'$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
|
|
13
|
+
'$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
|
|
16
14
|
];
|
|
17
15
|
static flags = {
|
|
18
|
-
app:
|
|
19
|
-
cidr:
|
|
20
|
-
id:
|
|
16
|
+
app: flags.app({ required: true }),
|
|
17
|
+
cidr: flags.string({ description: 'cidr of IP Rule' }),
|
|
18
|
+
id: flags.string({ description: 'id of IP Rule' }),
|
|
21
19
|
};
|
|
22
20
|
async run() {
|
|
23
21
|
const { args, flags } = await this.parse(MTLSIPDelete);
|
|
24
22
|
if (!flags.cidr && !flags.id) {
|
|
25
|
-
|
|
23
|
+
ux.error('You need to provide the id or cidr of the IP Rule');
|
|
26
24
|
}
|
|
27
25
|
else {
|
|
28
|
-
const addon = await (
|
|
29
|
-
|
|
26
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
27
|
+
ux.action.start(`Deleting IP Rule for ${color.addon(addon.name)}`);
|
|
30
28
|
let id = '';
|
|
31
29
|
if (flags.id) {
|
|
32
30
|
id = flags.id;
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
35
33
|
const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
|
|
36
|
-
const ipRule = ipRules.find(
|
|
34
|
+
const ipRule = ipRules.find(rule => rule.cidr === flags.cidr);
|
|
37
35
|
if (ipRule) {
|
|
38
36
|
id = ipRule.id;
|
|
39
37
|
}
|
|
40
38
|
else {
|
|
41
|
-
|
|
39
|
+
ux.error('No IP Rule found with that cidr');
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
await this.shogun.delete(`${addon.endpoint}/ip-rules/${id}`, this.shogun.defaults);
|
|
45
|
-
|
|
43
|
+
ux.action.stop();
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
|
-
exports.default = MTLSIPDelete;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSIPGet 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,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
|
|
8
|
-
class MTLSIPGet 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 Command from '../../../../base.js';
|
|
5
|
+
import { fetcher } from '../../../../lib/addon-fetcher.js';
|
|
6
|
+
export default class MTLSIPGet extends Command {
|
|
9
7
|
static args = {
|
|
10
|
-
addon:
|
|
8
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
11
9
|
};
|
|
12
|
-
static description = 'get a specific IP Rule for your
|
|
10
|
+
static description = 'get the a specific IP Rule for your mTLS enabled add-on';
|
|
13
11
|
static examples = [
|
|
14
|
-
'$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
|
|
12
|
+
'$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app',
|
|
15
13
|
];
|
|
16
14
|
static flags = {
|
|
17
|
-
app:
|
|
18
|
-
id:
|
|
15
|
+
app: flags.app({ required: true }),
|
|
16
|
+
id: flags.string({ required: true, description: 'id of IP Rule' }),
|
|
19
17
|
};
|
|
20
18
|
async run() {
|
|
21
19
|
const { args, flags } = await this.parse(MTLSIPGet);
|
|
22
|
-
const addon = await (
|
|
20
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
23
21
|
const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules/${flags.id}`, this.shogun.defaults);
|
|
24
|
-
|
|
22
|
+
styledObject(res);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
exports.default = MTLSIPGet;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Command from '../../../../base';
|
|
1
|
+
import Command from '../../../../base.js';
|
|
2
2
|
export default class MTLSIPIndex 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,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const table_1 = require("../../../../utils/table");
|
|
9
|
-
class MTLSIPIndex 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 { ipRulesTable } from '../../../../utils/table.js';
|
|
7
|
+
export default class MTLSIPIndex extends Command {
|
|
10
8
|
static args = {
|
|
11
|
-
addon:
|
|
9
|
+
addon: Args.string({ required: true, description: 'addon' }),
|
|
12
10
|
};
|
|
13
|
-
static description = 'get the IP Rules for your
|
|
11
|
+
static description = 'get the IP Rules for your mTLS enabled add-on';
|
|
14
12
|
static examples = [
|
|
15
13
|
'$ heroku data:mtls:ip-rules postgresql-sushi-12345 -a example-app',
|
|
16
14
|
];
|
|
17
15
|
static flags = {
|
|
18
|
-
app:
|
|
16
|
+
app: flags.app({ required: true }),
|
|
19
17
|
};
|
|
20
18
|
async run() {
|
|
21
19
|
const { args, flags } = await this.parse(MTLSIPIndex);
|
|
22
|
-
const addon = await (
|
|
20
|
+
const addon = await fetcher(this.heroku, args.addon, flags.app);
|
|
23
21
|
const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
|
|
24
22
|
if (res.length === 0) {
|
|
25
|
-
|
|
23
|
+
ux.stdout('You currently have no IP Rules set up');
|
|
26
24
|
}
|
|
27
25
|
else {
|
|
28
|
-
|
|
26
|
+
ipRulesTable(res);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
exports.default = MTLSIPIndex;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default _default;
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AddonResolver, isPostgresAddon } from '@heroku/heroku-cli-util/utils/addons';
|
|
2
|
+
import { ux } from '@oclif/core/ux';
|
|
3
|
+
// Resolves an add-on argument into the concrete mTLS resource the data API ("shogun") operates on.
|
|
4
|
+
// Replaces the legacy src/lib/fetcher.ts, which is now backed by the shared AddonResolver. The
|
|
5
|
+
// Postgres-vs-Kafka endpoint/kind branching used to live in the fetcher and is reintroduced here.
|
|
6
|
+
export async function fetcher(heroku, addon, app) {
|
|
7
|
+
const resolved = await new AddonResolver(heroku).resolve(addon, app);
|
|
8
|
+
if (isPostgresAddon(resolved)) {
|
|
9
|
+
return {
|
|
10
|
+
endpoint: `/postgres/v0/databases/${resolved.id}/tls-endpoint`,
|
|
11
|
+
kind: 'postgresql',
|
|
12
|
+
name: resolved.name,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (resolved.addon_service.name.startsWith('heroku-kafka') && /private|shield/.test(resolved.plan.name)) {
|
|
16
|
+
return {
|
|
17
|
+
endpoint: `/data/kafka/v0/clusters/${resolved.id}`,
|
|
18
|
+
kind: 'kafka',
|
|
19
|
+
name: resolved.name,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
ux.error('No addons found');
|
|
23
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
export declare const existsSync: (path: string) => boolean;
|
|
3
3
|
export declare const mkdirSync: (path: string) => void;
|
|
4
|
-
export declare const writeFile: (path: string, data: string, options: fs.WriteFileOptions
|
|
4
|
+
export declare const writeFile: (path: string, data: string, options: fs.WriteFileOptions, callback: fs.NoParamCallback) => void;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
-
const existsSync = (path) => fs.existsSync(path);
|
|
7
|
-
exports.existsSync = existsSync;
|
|
8
|
-
const mkdirSync = (path) => fs.mkdirSync(path);
|
|
9
|
-
exports.mkdirSync = mkdirSync;
|
|
10
|
-
const writeFile = (path, data, options = null, err) => fs.writeFile(path, data, options, err);
|
|
11
|
-
exports.writeFile = writeFile;
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
export const existsSync = (path) => fs.existsSync(path);
|
|
3
|
+
export const mkdirSync = (path) => fs.mkdirSync(path);
|
|
4
|
+
export const writeFile = (path, data, options, callback) => fs.writeFile(path, data, options, callback);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isErrorHttp = isErrorHttp;
|
|
4
|
-
function isErrorHttp(error) {
|
|
1
|
+
export function isErrorHttp(error) {
|
|
5
2
|
return error !== null && typeof error === 'object' && Reflect.has(error, 'http');
|
|
6
3
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isErrorMessage = isErrorMessage;
|
|
4
|
-
function isErrorMessage(error) {
|
|
1
|
+
export function isErrorMessage(error) {
|
|
5
2
|
return error !== null && typeof error === 'object' && Reflect.has(error, 'message');
|
|
6
3
|
}
|
package/dist/utils/table.d.ts
CHANGED
package/dist/utils/table.js
CHANGED
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ipRulesTable = exports.certificatesTable = void 0;
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const certificatesTable = (data) => core_1.ux.table(data, {
|
|
1
|
+
import { table } from '@heroku/heroku-cli-util/hux';
|
|
2
|
+
export const certificatesTable = (data) => table(data, {
|
|
6
3
|
id: {
|
|
7
4
|
header: 'ID',
|
|
8
|
-
get: ({ id }) => id
|
|
5
|
+
get: ({ id }) => id,
|
|
9
6
|
},
|
|
10
7
|
created_at: {
|
|
11
8
|
header: 'Created At',
|
|
12
|
-
get: ({ created_at }) => created_at
|
|
9
|
+
get: ({ created_at }) => created_at,
|
|
13
10
|
},
|
|
14
11
|
status: {
|
|
15
12
|
header: 'Status',
|
|
16
|
-
get: ({ status }) => status
|
|
13
|
+
get: ({ status }) => status,
|
|
17
14
|
},
|
|
18
15
|
});
|
|
19
|
-
|
|
20
|
-
const ipRulesTable = (data) => core_1.ux.table(data, {
|
|
16
|
+
export const ipRulesTable = (data) => table(data, {
|
|
21
17
|
id: {
|
|
22
18
|
header: 'ID',
|
|
23
|
-
get: ({ id }) => id
|
|
19
|
+
get: ({ id }) => id,
|
|
24
20
|
},
|
|
25
21
|
cidr: {
|
|
26
22
|
header: 'CIDR',
|
|
27
|
-
get: ({ cidr }) => cidr
|
|
23
|
+
get: ({ cidr }) => cidr,
|
|
28
24
|
},
|
|
29
25
|
description: {
|
|
30
26
|
header: 'Description',
|
|
31
|
-
get: ({ description }) => description
|
|
27
|
+
get: ({ description }) => description,
|
|
32
28
|
},
|
|
33
29
|
created_at: {
|
|
34
30
|
header: 'Created At',
|
|
35
|
-
get: ({ created_at }) => created_at
|
|
31
|
+
get: ({ created_at }) => created_at,
|
|
36
32
|
},
|
|
37
33
|
status: {
|
|
38
34
|
header: 'Status',
|
|
39
|
-
get: ({ status }) => status
|
|
35
|
+
get: ({ status }) => status,
|
|
40
36
|
},
|
|
41
37
|
});
|
|
42
|
-
exports.ipRulesTable = ipRulesTable;
|