@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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +207 -110
  3. package/dist/README.md +347 -0
  4. package/{base.d.ts → dist/base.d.ts} +2 -2
  5. package/{base.js → dist/base.js} +5 -1
  6. package/dist/commands/data/mtls/certificates/create.d.ts +12 -0
  7. package/dist/commands/data/mtls/certificates/create.js +32 -0
  8. package/dist/commands/data/mtls/certificates/delete.d.ts +13 -0
  9. package/dist/commands/data/mtls/certificates/delete.js +32 -0
  10. package/dist/commands/data/mtls/certificates/download.d.ts +15 -0
  11. package/{commands → dist/commands}/data/mtls/certificates/download.js +41 -40
  12. package/dist/commands/data/mtls/certificates/get.d.ts +13 -0
  13. package/dist/commands/data/mtls/certificates/get.js +32 -0
  14. package/dist/commands/data/mtls/certificates/index.d.ts +12 -0
  15. package/{commands → dist/commands}/data/mtls/certificates/index.js +17 -16
  16. package/dist/commands/data/mtls/create.d.ts +12 -0
  17. package/dist/commands/data/mtls/create.js +43 -0
  18. package/dist/commands/data/mtls/destroy.d.ts +13 -0
  19. package/dist/commands/data/mtls/destroy.js +32 -0
  20. package/dist/commands/data/mtls/index.d.ts +12 -0
  21. package/{commands → dist/commands}/data/mtls/index.js +17 -16
  22. package/dist/commands/data/mtls/ip-rules/create.d.ts +14 -0
  23. package/dist/commands/data/mtls/ip-rules/create.js +37 -0
  24. package/dist/commands/data/mtls/ip-rules/delete.d.ts +14 -0
  25. package/dist/commands/data/mtls/ip-rules/delete.js +49 -0
  26. package/dist/commands/data/mtls/ip-rules/get.d.ts +13 -0
  27. package/dist/commands/data/mtls/ip-rules/get.js +27 -0
  28. package/dist/commands/data/mtls/ip-rules/index.d.ts +12 -0
  29. package/dist/commands/data/mtls/ip-rules/index.js +32 -0
  30. package/{lib → dist/lib}/fetcher.js +6 -6
  31. package/dist/oclif.manifest.json +575 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -0
  33. package/dist/utils/file-helper.d.ts +4 -0
  34. package/dist/utils/file-helper.js +11 -0
  35. package/{utils → dist/utils}/is-error-http.js +1 -2
  36. package/{utils → dist/utils}/is-error-message.js +1 -2
  37. package/dist/utils/table.js +42 -0
  38. package/package.json +47 -11
  39. package/commands/data/mtls/certificates/create.d.ts +0 -13
  40. package/commands/data/mtls/certificates/create.js +0 -31
  41. package/commands/data/mtls/certificates/delete.d.ts +0 -14
  42. package/commands/data/mtls/certificates/delete.js +0 -31
  43. package/commands/data/mtls/certificates/download.d.ts +0 -16
  44. package/commands/data/mtls/certificates/get.d.ts +0 -14
  45. package/commands/data/mtls/certificates/get.js +0 -31
  46. package/commands/data/mtls/certificates/index.d.ts +0 -13
  47. package/commands/data/mtls/create.d.ts +0 -13
  48. package/commands/data/mtls/create.js +0 -42
  49. package/commands/data/mtls/destroy.d.ts +0 -14
  50. package/commands/data/mtls/destroy.js +0 -31
  51. package/commands/data/mtls/index.d.ts +0 -13
  52. package/commands/data/mtls/ip-rules/create.d.ts +0 -15
  53. package/commands/data/mtls/ip-rules/create.js +0 -33
  54. package/commands/data/mtls/ip-rules/delete.d.ts +0 -15
  55. package/commands/data/mtls/ip-rules/delete.js +0 -48
  56. package/commands/data/mtls/ip-rules/get.d.ts +0 -14
  57. package/commands/data/mtls/ip-rules/get.js +0 -26
  58. package/commands/data/mtls/ip-rules/index.d.ts +0 -13
  59. package/commands/data/mtls/ip-rules/index.js +0 -31
  60. package/oclif.manifest.json +0 -1
  61. package/utils/table.js +0 -18
  62. /package/{index.d.ts → dist/index.d.ts} +0 -0
  63. /package/{index.js → dist/index.js} +0 -0
  64. /package/{lib → dist/lib}/fetcher.d.ts +0 -0
  65. /package/{utils → dist/utils}/is-error-http.d.ts +0 -0
  66. /package/{utils → dist/utils}/is-error-message.d.ts +0 -0
  67. /package/{utils → dist/utils}/table.d.ts +0 -0
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
8
+ class MTLSCertificateGet extends base_1.default {
9
+ static args = {
10
+ addon: core_1.Args.string({ required: true, description: 'addon' })
11
+ };
12
+ static description = 'get a specific certificate for your MTLS enabled addon';
13
+ static examples = [
14
+ '$ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
15
+ ];
16
+ static flags = {
17
+ app: command_1.flags.app({ required: true }),
18
+ id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
19
+ };
20
+ async run() {
21
+ const { args, flags } = await this.parse(MTLSCertificateGet);
22
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
23
+ if (addon.kind === 'kafka') {
24
+ core_1.ux.error('Kafka certificates are availabe in your app\'s config vars');
25
+ }
26
+ const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates/${flags.id}`, this.shogun.defaults);
27
+ delete res.private_key;
28
+ delete res.certificate_with_chain;
29
+ core_1.ux.styledObject(res);
30
+ }
31
+ }
32
+ exports.default = MTLSCertificateGet;
@@ -0,0 +1,12 @@
1
+ import Command from '../../../../base';
2
+ export default class MTLSCertificatesIndex extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -1,23 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
3
4
  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");
5
+ const core_1 = require("@oclif/core");
6
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
7
8
  const is_error_http_1 = require("../../../../utils/is-error-http");
8
9
  const is_error_message_1 = require("../../../../utils/is-error-message");
9
10
  const table_1 = require("../../../../utils/table");
10
11
  class MTLSCertificatesIndex extends base_1.default {
12
+ static args = {
13
+ addon: core_1.Args.string({ required: true, description: 'addon' })
14
+ };
15
+ static description = 'get the certificates for your MTLS enabled addon';
16
+ static examples = [
17
+ '$ heroku data:mtls:certificates postgresql-sushi-12345 -a example-app',
18
+ ];
19
+ static flags = {
20
+ app: command_1.flags.app({ required: true })
21
+ };
11
22
  async run() {
12
23
  try {
13
- const { args, flags } = this.parse(MTLSCertificatesIndex);
24
+ const { args, flags } = await this.parse(MTLSCertificatesIndex);
14
25
  const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
15
26
  if (addon.kind === 'kafka') {
16
- cli_ux_1.cli.error('Kafka certificates are availabe in your app\'s config vars');
27
+ core_1.ux.error('Kafka certificates are availabe in your app\'s config vars');
17
28
  }
18
29
  const { body: res } = await this.shogun.get(`${addon.endpoint}/certificates`, this.shogun.defaults);
19
30
  if (res.length === 0) {
20
- cli_ux_1.cli.log('You currently have no certificates setup');
31
+ core_1.ux.log('You currently have no certificates setup');
21
32
  }
22
33
  else {
23
34
  (0, table_1.certificatesTable)(res);
@@ -42,13 +53,3 @@ class MTLSCertificatesIndex extends base_1.default {
42
53
  }
43
54
  }
44
55
  exports.default = MTLSCertificatesIndex;
45
- MTLSCertificatesIndex.args = [
46
- { name: 'addon' }
47
- ];
48
- MTLSCertificatesIndex.description = 'get the certificates for your MTLS enabled addon';
49
- MTLSCertificatesIndex.examples = [
50
- '$ heroku data:mtls:ip-rules postgresql-sushi-12345',
51
- ];
52
- MTLSCertificatesIndex.flags = {
53
- app: command_1.flags.app({ required: true })
54
- };
@@ -0,0 +1,12 @@
1
+ import Command from '../../../base';
2
+ export default class MTLSCreate extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const color_1 = require("@heroku-cli/color");
5
+ const command_1 = require("@heroku-cli/command");
6
+ const core_1 = require("@oclif/core");
7
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
8
+ const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
9
+ class MTLSCreate extends base_1.default {
10
+ static args = {
11
+ addon: core_1.Args.string({ required: true, description: 'addon' })
12
+ };
13
+ static description = 'enable MTLS for your addon';
14
+ static examples = [
15
+ '$ heroku data:mtls:create postgresql-sushi-12345 -a example-app'
16
+ ];
17
+ static flags = {
18
+ app: command_1.flags.app({ required: true })
19
+ };
20
+ async run() {
21
+ const { args, flags } = await this.parse(MTLSCreate);
22
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
23
+ if (addon.kind === 'kafka') {
24
+ core_1.ux.error('Kafka has mTLS enabled by default');
25
+ }
26
+ if (await core_1.ux.confirm('Enabling Mutual TLS will allow external access to this restricted data service. This action will be logged. Continue?')) {
27
+ core_1.ux.action.start(`Enabling MTLS on ${color_1.color.cyan(addon.name)}`);
28
+ try {
29
+ const { body: res } = await this.shogun.post(addon.endpoint, { ...this.shogun.defaults, body: {} });
30
+ core_1.ux.styledObject(res);
31
+ core_1.ux.action.stop();
32
+ }
33
+ catch (err) {
34
+ core_1.ux.action.stop('failed!');
35
+ core_1.ux.log(err.body.message);
36
+ }
37
+ }
38
+ else {
39
+ core_1.ux.warn('You did not enable mTLS');
40
+ }
41
+ }
42
+ }
43
+ exports.default = MTLSCreate;
@@ -0,0 +1,13 @@
1
+ import Command from '../../../base';
2
+ export default class MTLSDestroy extends Command {
3
+ static aliases: string[];
4
+ static args: {
5
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const color_1 = require("@heroku-cli/color");
5
+ const command_1 = require("@heroku-cli/command");
6
+ const core_1 = require("@oclif/core");
7
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
8
+ const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
9
+ class MTLSDestroy extends base_1.default {
10
+ static aliases = ['data:mtls:delete'];
11
+ static args = {
12
+ addon: core_1.Args.string({ required: true, description: 'addon' })
13
+ };
14
+ static description = 'destroy MTLS configuration on your addon';
15
+ static examples = [
16
+ '$ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app'
17
+ ];
18
+ static flags = {
19
+ app: command_1.flags.app({ required: true })
20
+ };
21
+ async run() {
22
+ const { args, flags } = await this.parse(MTLSDestroy);
23
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
24
+ if (addon.kind === 'kafka') {
25
+ core_1.ux.error('Kafka has mTLS enabled by default and you cannot disable it');
26
+ }
27
+ core_1.ux.action.start(`Disabling MTLS on ${color_1.color.cyan(addon.name)}`);
28
+ await this.shogun.delete(addon.endpoint, this.shogun.defaults);
29
+ core_1.ux.action.stop();
30
+ }
31
+ }
32
+ exports.default = MTLSDestroy;
@@ -0,0 +1,12 @@
1
+ import Command from '../../../base';
2
+ export default class MTLSIndex extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -1,21 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
3
4
  const color_1 = require("@heroku-cli/color");
4
5
  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");
6
+ const core_1 = require("@oclif/core");
7
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
8
+ const fetcher_1 = tslib_1.__importDefault(require("../../../lib/fetcher"));
8
9
  const is_error_http_1 = require("../../../utils/is-error-http");
9
10
  const is_error_message_1 = require("../../../utils/is-error-message");
10
11
  const table_1 = require("../../../utils/table");
11
12
  class MTLSIndex extends base_1.default {
13
+ static args = {
14
+ addon: core_1.Args.string({ required: true, description: 'addon' })
15
+ };
16
+ static description = 'get the status of MTLS for your addon';
17
+ static examples = [
18
+ '$ heroku data:mtls postgresql-sushi-12345 -a example-app',
19
+ ];
20
+ static flags = {
21
+ app: command_1.flags.app({ required: true })
22
+ };
12
23
  async run() {
13
24
  try {
14
- const { args, flags } = this.parse(MTLSIndex);
25
+ const { args, flags } = await this.parse(MTLSIndex);
15
26
  const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
16
27
  if (addon.kind === 'kafka') {
17
28
  const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
18
- cli_ux_1.cli.styledObject({
29
+ core_1.ux.styledObject({
19
30
  addon: addon.name,
20
31
  'TLS-status': 'Available'
21
32
  });
@@ -33,7 +44,7 @@ class MTLSIndex extends base_1.default {
33
44
  this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults)
34
45
  ]);
35
46
  delete mtls.certificate_authority_chain;
36
- cli_ux_1.cli.styledObject({
47
+ core_1.ux.styledObject({
37
48
  addon: mtls.addon,
38
49
  app: mtls.app,
39
50
  'TLS-status': mtls.status
@@ -71,13 +82,3 @@ class MTLSIndex extends base_1.default {
71
82
  }
72
83
  }
73
84
  exports.default = MTLSIndex;
74
- MTLSIndex.args = [
75
- { name: 'addon' }
76
- ];
77
- MTLSIndex.description = 'get the status of MTLS for your addon';
78
- MTLSIndex.examples = [
79
- '$ heroku data:mtls postgresql-sushi-12345',
80
- ];
81
- MTLSIndex.flags = {
82
- app: command_1.flags.app({ required: true })
83
- };
@@ -0,0 +1,14 @@
1
+ import Command from '../../../../base';
2
+ export default class MTLSIPCreate extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ cidr: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const color_1 = require("@heroku-cli/color");
5
+ const command_1 = require("@heroku-cli/command");
6
+ const core_1 = require("@oclif/core");
7
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
8
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
9
+ class MTLSIPCreate extends base_1.default {
10
+ static args = {
11
+ addon: core_1.Args.string({ required: true, description: 'addon' })
12
+ };
13
+ static description = 'create an IP Rule for your MTLS enabled addon';
14
+ 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'
16
+ ];
17
+ static flags = {
18
+ app: command_1.flags.app({ required: true }),
19
+ cidr: command_1.flags.string({ required: true }),
20
+ description: command_1.flags.string({ required: false })
21
+ };
22
+ async run() {
23
+ const { args, flags } = await this.parse(MTLSIPCreate);
24
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
25
+ core_1.ux.action.start(`Creating IP Rule for ${color_1.color.cyan(addon.name)}`);
26
+ const { body: res } = await this.shogun.post(`${addon.endpoint}/ip-rules`, {
27
+ ...this.shogun.defaults,
28
+ body: {
29
+ cidr: flags.cidr,
30
+ description: flags.description
31
+ }
32
+ });
33
+ core_1.ux.action.stop();
34
+ core_1.ux.styledObject(res);
35
+ }
36
+ }
37
+ exports.default = MTLSIPCreate;
@@ -0,0 +1,14 @@
1
+ import Command from '../../../../base';
2
+ export default class MTLSIPDelete extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ cidr: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const color_1 = require("@heroku-cli/color");
5
+ const command_1 = require("@heroku-cli/command");
6
+ const core_1 = require("@oclif/core");
7
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
8
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
9
+ class MTLSIPDelete extends base_1.default {
10
+ static args = {
11
+ addon: core_1.Args.string({ required: true, description: 'addon' })
12
+ };
13
+ static description = 'delete a specific IP Rule for your MTLS enabled addon';
14
+ static examples = [
15
+ '$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
16
+ ];
17
+ static flags = {
18
+ app: command_1.flags.app({ required: true }),
19
+ cidr: command_1.flags.string({ description: 'cidr of IP Rule' }),
20
+ id: command_1.flags.string({ description: 'id of IP Rule' })
21
+ };
22
+ async run() {
23
+ const { args, flags } = await this.parse(MTLSIPDelete);
24
+ if (!flags.cidr && !flags.id) {
25
+ core_1.ux.error('You need at least pass in the id or cidr of the IP Rule');
26
+ }
27
+ else {
28
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
29
+ core_1.ux.action.start(`Deleting IP Rule for ${color_1.color.cyan(addon.name)}`);
30
+ let id = '';
31
+ if (flags.id) {
32
+ id = flags.id;
33
+ }
34
+ else {
35
+ const { body: ipRules } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
36
+ const ipRule = ipRules.find(ipRule => ipRule.cidr === flags.cidr);
37
+ if (ipRule) {
38
+ id = ipRule.id;
39
+ }
40
+ else {
41
+ core_1.ux.error('No IP Rule found with that cidr');
42
+ }
43
+ }
44
+ await this.shogun.delete(`${addon.endpoint}/ip-rules/${id}`, this.shogun.defaults);
45
+ core_1.ux.action.stop();
46
+ }
47
+ }
48
+ }
49
+ exports.default = MTLSIPDelete;
@@ -0,0 +1,13 @@
1
+ import Command from '../../../../base';
2
+ export default class MTLSIPGet extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
8
+ class MTLSIPGet extends base_1.default {
9
+ static args = {
10
+ addon: core_1.Args.string({ required: true, description: 'addon' })
11
+ };
12
+ static description = 'get a specific IP Rule for your MTLS enabled addon';
13
+ static examples = [
14
+ '$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app'
15
+ ];
16
+ static flags = {
17
+ app: command_1.flags.app({ required: true }),
18
+ id: command_1.flags.string({ required: true, description: 'id of IP Rule' })
19
+ };
20
+ async run() {
21
+ const { args, flags } = await this.parse(MTLSIPGet);
22
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
23
+ const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules/${flags.id}`, this.shogun.defaults);
24
+ core_1.ux.styledObject(res);
25
+ }
26
+ }
27
+ exports.default = MTLSIPGet;
@@ -0,0 +1,12 @@
1
+ import Command from '../../../../base';
2
+ export default class MTLSIPIndex extends Command {
3
+ static args: {
4
+ addon: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const command_1 = require("@heroku-cli/command");
5
+ const core_1 = require("@oclif/core");
6
+ const base_1 = tslib_1.__importDefault(require("../../../../base"));
7
+ const fetcher_1 = tslib_1.__importDefault(require("../../../../lib/fetcher"));
8
+ const table_1 = require("../../../../utils/table");
9
+ class MTLSIPIndex extends base_1.default {
10
+ static args = {
11
+ addon: core_1.Args.string({ required: true, description: 'addon' })
12
+ };
13
+ static description = 'get the IP Rules for your MTLS enabled addon';
14
+ static examples = [
15
+ '$ heroku data:mtls:ip-rules postgresql-sushi-12345 -a example-app',
16
+ ];
17
+ static flags = {
18
+ app: command_1.flags.app({ required: true })
19
+ };
20
+ async run() {
21
+ const { args, flags } = await this.parse(MTLSIPIndex);
22
+ const addon = await (0, fetcher_1.default)(this.heroku, args.addon, flags.app);
23
+ const { body: res } = await this.shogun.get(`${addon.endpoint}/ip-rules`, this.shogun.defaults);
24
+ if (res.length === 0) {
25
+ core_1.ux.log('You currently have no IP Rules setup');
26
+ }
27
+ else {
28
+ (0, table_1.ipRulesTable)(res);
29
+ }
30
+ }
31
+ }
32
+ exports.default = MTLSIPIndex;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_ux_1 = require("cli-ux");
3
+ exports.default = default_1;
4
+ const core_1 = require("@oclif/core");
4
5
  async function default_1(heroku, addon_attachment, app) {
5
6
  const filteredAddon = addon_attachment
6
7
  ? await findAddonGivenAttachment(heroku, addon_attachment, app)
@@ -23,7 +24,6 @@ async function default_1(heroku, addon_attachment, app) {
23
24
  }
24
25
  }
25
26
  }
26
- exports.default = default_1;
27
27
  async function findAllAddons(heroku, app) {
28
28
  const { body: addon_list } = await heroku.get(`/apps/${app}/addons`);
29
29
  const filtered_list = addon_list.filter((addon) => {
@@ -35,13 +35,13 @@ async function findAllAddons(heroku, app) {
35
35
  return false;
36
36
  });
37
37
  if (filtered_list.length === 0) {
38
- cli_ux_1.cli.error('No addons found');
38
+ core_1.ux.error('No addons found');
39
39
  }
40
40
  else if (filtered_list.length === 1) {
41
41
  return filtered_list[0];
42
42
  }
43
43
  else {
44
- cli_ux_1.cli.error("No addon specified. Here's the list of addons:" + filtered_list.map((addon) => addon.name));
44
+ core_1.ux.error("No addon specified. Here's the list of addons:" + filtered_list.map((addon) => addon.name));
45
45
  }
46
46
  }
47
47
  async function findAddonGivenAttachment(heroku, addon_attachment, app) {
@@ -53,7 +53,7 @@ async function findAddonGivenAttachment(heroku, addon_attachment, app) {
53
53
  }
54
54
  });
55
55
  if (res.id === 'not_found') {
56
- cli_ux_1.cli.error(res.message);
56
+ core_1.ux.error(res.message);
57
57
  }
58
58
  const addon = res.find((addon) => {
59
59
  if (addon.addon_service) {
@@ -66,5 +66,5 @@ async function findAddonGivenAttachment(heroku, addon_attachment, app) {
66
66
  if (addon) {
67
67
  return addon;
68
68
  }
69
- cli_ux_1.cli.error('No addons found');
69
+ core_1.ux.error('No addons found');
70
70
  }