@heroku-cli/plugin-data-privatelink 1.3.0 → 1.3.2

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/lib/base.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { APIClient, Command } from '@heroku-cli/command';
2
- import { IConfig } from '@oclif/config';
2
+ import { Config } from '@oclif/core';
3
3
  export default abstract class extends Command {
4
4
  shogun: APIClient;
5
- protected constructor(argv: string[], config: IConfig);
5
+ constructor(argv: string[], config: Config);
6
6
  }
7
7
  export interface PrivateLinkDB {
8
8
  apps: {
package/lib/base.js CHANGED
@@ -5,8 +5,8 @@ class default_1 extends command_1.Command {
5
5
  constructor(argv, config) {
6
6
  super(argv, config);
7
7
  const client = new command_1.APIClient(this.config, {});
8
- client.defaults.host = process.env.HEROKU_DATA_HOST || 'postgres-api.heroku.com';
9
- client.defaults.headers = Object.assign({}, this.heroku.defaults.headers, { authorization: `Basic ${Buffer.from(':' + this.heroku.auth).toString('base64')}` });
8
+ client.defaults.host = process.env.HEROKU_DATA_HOST || 'api.data.heroku.com';
9
+ client.defaults.headers = Object.assign(Object.assign({}, this.heroku.defaults.headers), { authorization: `Basic ${Buffer.from(':' + this.heroku.auth).toString('base64')}` });
10
10
  this.shogun = client;
11
11
  }
12
12
  }
@@ -1,14 +1,14 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../../base';
3
- export default class EndpointsAccessAdd extends BaseCommand {
2
+ export default class Add extends BaseCommand {
4
3
  static description: string;
5
- static aliases: string[];
4
+ static hiddenAliases: string[];
6
5
  static args: {
7
- name: string;
8
- }[];
6
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
9
8
  static flags: {
10
- 'aws-account-id': flags.IOptionFlag<any>;
11
- app: flags.IOptionFlag<string>;
9
+ 'aws-account-id': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
12
  };
13
13
  static examples: string[];
14
14
  run(): Promise<void>;
@@ -1,42 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
- const cli_ux_1 = require("cli-ux");
4
+ const core_1 = require("@oclif/core");
5
5
  const base_1 = require("../../../../base");
6
6
  const fetcher_1 = require("../../../../lib/fetcher");
7
- class EndpointsAccessAdd extends base_1.default {
7
+ class Add extends base_1.default {
8
8
  async run() {
9
- const { args, flags } = this.parse(EndpointsAccessAdd);
10
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
11
- const account_ids = flags['aws-account-id'];
9
+ const { args, flags } = await this.parse(Add);
10
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, flags.app);
11
+ const { 'aws-account-id': account_ids } = flags;
12
12
  const accountFormatted = account_ids.length > 1 ? 'accounts' : 'account';
13
- cli_ux_1.cli.action.start(`Adding ${accountFormatted}`);
14
- await this.shogun.put(`/private-link/v0/databases/${database}/allowed_accounts`, Object.assign({}, this.shogun.defaults, { body: {
15
- allowed_accounts: account_ids
13
+ core_1.ux.action.start(`Adding ${accountFormatted}`);
14
+ await this.shogun.put(`/private-link/v0/databases/${database}/allowed_accounts`, Object.assign(Object.assign({}, this.shogun.defaults), { body: {
15
+ allowed_accounts: account_ids,
16
16
  } }));
17
- cli_ux_1.cli.action.stop();
17
+ core_1.ux.action.stop();
18
18
  }
19
19
  }
20
- EndpointsAccessAdd.description = 'add an allowed account to your privatelink endpoint';
21
- EndpointsAccessAdd.aliases = ['pg:privatelink:access:add', 'kafka:privatelink:access:add', 'redis:privatelink:access:add'];
22
- EndpointsAccessAdd.args = [
23
- { name: 'database' },
24
- ];
25
- EndpointsAccessAdd.flags = {
26
- 'aws-account-id': command_1.flags.build({
20
+ exports.default = Add;
21
+ Add.description = 'add one or more allowed AWS accounts to your privatelink endpoint';
22
+ Add.hiddenAliases = ['pg:privatelink:access:add', 'kafka:privatelink:access:add', 'redis:privatelink:access:add'];
23
+ Add.args = {
24
+ database: core_1.Args.string({ required: true }),
25
+ };
26
+ Add.flags = {
27
+ 'aws-account-id': command_1.flags.string({
27
28
  char: 'i',
28
29
  description: 'AWS account id to use',
29
- parse: (input, ctx) => {
30
- if (!ctx.endpoints_access_add_ids)
31
- ctx.endpoints_access_add_ids = [];
32
- ctx.endpoints_access_add_ids.push(input);
33
- return ctx.endpoints_access_add_ids;
34
- },
35
- })(),
36
- app: command_1.flags.app({ required: true })
30
+ required: true,
31
+ multiple: true,
32
+ }),
33
+ app: command_1.flags.app({ required: true }),
34
+ remote: command_1.flags.remote(),
37
35
  };
38
- EndpointsAccessAdd.examples = [
39
- '$ heroku data:privatelink:access:add postgresql-sushi-12345 --aws-account-id 123456789012:user/abc',
40
- '$ heroku data:privatelink:access:add postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --aws-account-id 123456789012:user/xyz',
36
+ Add.examples = [
37
+ '$ heroku data:privatelink:access:add postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --app my-app',
38
+ '$ heroku data:privatelink:access:add postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --aws-account-id 123456789012:user/xyz --app my-app',
41
39
  ];
42
- exports.default = EndpointsAccessAdd;
@@ -1,13 +1,14 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../../base';
3
- export default class EndpointsAccessIndex extends BaseCommand {
2
+ export default class Index extends BaseCommand {
3
+ static topic: string;
4
4
  static description: string;
5
- static aliases: string[];
5
+ static hiddenAliases: string[];
6
6
  static args: {
7
- name: string;
8
- }[];
7
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
8
+ };
9
9
  static flags: {
10
- app: flags.IOptionFlag<string>;
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  };
12
13
  static examples: string[];
13
14
  run(): Promise<void>;
@@ -1,38 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
- const cli_ux_1 = require("cli-ux");
4
+ const core_1 = require("@oclif/core");
5
5
  const base_1 = require("../../../../base");
6
6
  const fetcher_1 = require("../../../../lib/fetcher");
7
- class EndpointsAccessIndex extends base_1.default {
7
+ class Index extends base_1.default {
8
8
  async run() {
9
- const { args, flags } = this.parse(EndpointsAccessIndex);
10
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
9
+ const { args, flags } = await this.parse(Index);
10
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, flags.app);
11
11
  const { body: { allowed_accounts } } = await this.shogun.get(`/private-link/v0/databases/${database}`, this.shogun.defaults);
12
12
  if (allowed_accounts.length > 0) {
13
- cli_ux_1.cli.table(allowed_accounts, {
13
+ core_1.ux.table(allowed_accounts, {
14
14
  arn: {
15
- header: 'ARN'
15
+ header: 'ARN',
16
16
  },
17
17
  status: {
18
- header: 'Status'
19
- }
18
+ header: 'Status',
19
+ },
20
20
  });
21
21
  }
22
22
  else {
23
- cli_ux_1.cli.error('There are no allowed accounts');
23
+ core_1.ux.log('There are no allowed accounts');
24
24
  }
25
25
  }
26
26
  }
27
- EndpointsAccessIndex.description = 'list all allowed accounts for your privatelink endpoint';
28
- EndpointsAccessIndex.aliases = ['pg:privatelink:access', 'kafka:privatelink:access', 'redis:privatelink:access'];
29
- EndpointsAccessIndex.args = [
30
- { name: 'database' },
31
- ];
32
- EndpointsAccessIndex.flags = {
33
- app: command_1.flags.app({ required: true })
27
+ exports.default = Index;
28
+ Index.topic = 'data:privatelink:access';
29
+ Index.description = 'list all allowed accounts for your privatelink endpoint';
30
+ Index.hiddenAliases = ['pg:privatelink:access', 'kafka:privatelink:access', 'redis:privatelink:access'];
31
+ Index.args = {
32
+ database: core_1.Args.string({ required: true }),
33
+ };
34
+ Index.flags = {
35
+ app: command_1.flags.app({ required: true }),
36
+ remote: command_1.flags.remote(),
34
37
  };
35
- EndpointsAccessIndex.examples = [
36
- '$ heroku data:privatelink:access postgresql-sushi-12345',
38
+ Index.examples = [
39
+ '$ heroku data:privatelink:access postgresql-sushi-12345 --app my-app',
37
40
  ];
38
- exports.default = EndpointsAccessIndex;
@@ -1,14 +1,14 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../../base';
3
- export default class EndpointsAccessRemove extends BaseCommand {
2
+ export default class Remove extends BaseCommand {
4
3
  static description: string;
5
- static aliases: string[];
4
+ static hiddenAliases: string[];
6
5
  static args: {
7
- name: string;
8
- }[];
6
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
9
8
  static flags: {
10
- 'aws-account-id': flags.IOptionFlag<any>;
11
- app: flags.IOptionFlag<string>;
9
+ 'aws-account-id': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
12
  };
13
13
  static examples: string[];
14
14
  run(): Promise<void>;
@@ -1,42 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
- const cli_ux_1 = require("cli-ux");
4
+ const core_1 = require("@oclif/core");
5
5
  const base_1 = require("../../../../base");
6
6
  const fetcher_1 = require("../../../../lib/fetcher");
7
- class EndpointsAccessRemove extends base_1.default {
7
+ class Remove extends base_1.default {
8
8
  async run() {
9
- const { args, flags } = this.parse(EndpointsAccessRemove);
10
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
11
- const account_ids = flags['aws-account-id'];
9
+ const { args, flags } = await this.parse(Remove);
10
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, flags.app);
11
+ const { 'aws-account-id': account_ids } = flags;
12
12
  const accountFormatted = account_ids.length > 1 ? 'accounts' : 'account';
13
- cli_ux_1.cli.action.start(`Removing ${accountFormatted}`);
14
- await this.shogun.patch(`/private-link/v0/databases/${database}/allowed_accounts`, Object.assign({}, this.shogun.defaults, { body: {
15
- allowed_accounts: account_ids
13
+ core_1.ux.action.start(`Removing ${accountFormatted}`);
14
+ await this.shogun.patch(`/private-link/v0/databases/${database}/allowed_accounts`, Object.assign(Object.assign({}, this.shogun.defaults), { body: {
15
+ allowed_accounts: account_ids,
16
16
  } }));
17
- cli_ux_1.cli.action.stop();
17
+ core_1.ux.action.stop();
18
18
  }
19
19
  }
20
- EndpointsAccessRemove.description = 'remove an allowed account from your privatelink endpoint';
21
- EndpointsAccessRemove.aliases = ['pg:privatelink:access:remove', 'kafka:privatelink:access:remove', 'redis:privatelink:access:remove'];
22
- EndpointsAccessRemove.args = [
23
- { name: 'database' },
24
- ];
25
- EndpointsAccessRemove.flags = {
26
- 'aws-account-id': command_1.flags.build({
20
+ exports.default = Remove;
21
+ Remove.description = 'remove an allowed account from your privatelink endpoint';
22
+ Remove.hiddenAliases = ['pg:privatelink:access:remove', 'kafka:privatelink:access:remove', 'redis:privatelink:access:remove'];
23
+ Remove.args = {
24
+ database: core_1.Args.string({ required: true }),
25
+ };
26
+ Remove.flags = {
27
+ 'aws-account-id': command_1.flags.string({
27
28
  char: 'i',
28
29
  description: 'AWS account id to use',
29
- parse: (input, ctx) => {
30
- if (!ctx.endpoints_access_remove_ids)
31
- ctx.endpoints_access_remove_ids = [];
32
- ctx.endpoints_access_remove_ids.push(input);
33
- return ctx.endpoints_access_remove_ids;
34
- },
35
- })(),
36
- app: command_1.flags.app({ required: true })
30
+ required: true,
31
+ multiple: true,
32
+ }),
33
+ app: command_1.flags.app({ required: true }),
34
+ remote: command_1.flags.remote(),
37
35
  };
38
- EndpointsAccessRemove.examples = [
39
- '$ heroku data:privatelink:access:remove postgresql-sushi-12345 --aws-account-id 123456789012:user/xyz',
40
- '$ heroku data:privatelink:access:remove postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --aws-account-id 123456789012:user/xyz',
36
+ Remove.examples = [
37
+ '$ heroku data:privatelink:access:remove postgresql-sushi-12345 --aws-account-id 123456789012:user/xyz --app my-app',
38
+ '$ heroku data:privatelink:access:remove postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --aws-account-id 123456789012:user/xyz --app my-app',
41
39
  ];
42
- exports.default = EndpointsAccessRemove;
@@ -1,14 +1,14 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../base';
3
- export default class EndpointsCreate extends BaseCommand {
2
+ export default class Create extends BaseCommand {
4
3
  static description: string;
5
- static aliases: string[];
4
+ static hiddenAliases: string[];
6
5
  static args: {
7
- name: string;
8
- }[];
6
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
9
8
  static flags: {
10
- 'aws-account-id': flags.IOptionFlag<any>;
11
- app: flags.IOptionFlag<string>;
9
+ 'aws-account-id': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
12
  };
13
13
  static examples: string[];
14
14
  run(): Promise<void>;
@@ -2,50 +2,47 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
- const cli_ux_1 = require("cli-ux");
5
+ const core_1 = require("@oclif/core");
6
6
  const base_1 = require("../../../base");
7
7
  const fetcher_1 = require("../../../lib/fetcher");
8
- class EndpointsCreate extends base_1.default {
8
+ class Create extends base_1.default {
9
9
  async run() {
10
- const { args, flags } = this.parse(EndpointsCreate);
11
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
12
- const account_ids = flags['aws-account-id'];
13
- cli_ux_1.cli.action.start('Creating privatelink endpoint');
14
- const { body: res } = await this.shogun.post(`/private-link/v0/databases/${database}`, Object.assign({}, this.shogun.defaults, { body: {
15
- allowed_accounts: account_ids
10
+ const { args, flags } = await this.parse(Create);
11
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, flags.app);
12
+ const { 'aws-account-id': account_ids, app } = flags;
13
+ core_1.ux.action.start('Creating privatelink endpoint');
14
+ const { body: res } = await this.shogun.post(`/private-link/v0/databases/${database}`, Object.assign(Object.assign({}, this.shogun.defaults), { body: {
15
+ allowed_accounts: account_ids,
16
16
  } }));
17
- cli_ux_1.cli.action.stop();
18
- this.log();
19
- cli_ux_1.cli.styledObject({
17
+ core_1.ux.action.stop();
18
+ core_1.ux.log();
19
+ core_1.ux.styledObject({
20
20
  Status: res.status,
21
- 'Service Name': res.service_name || 'Provisioning'
21
+ 'Service Name': res.service_name || 'Provisioning',
22
22
  });
23
- this.log();
24
- this.log(`The privatelink endpoint is now being provisioned for ${color_1.default.cyan(database)}.`);
25
- this.log('Run ' + color_1.default.cyan('heroku data:privatelink:wait ' + database + ' --app ' + flags.app) +
23
+ core_1.ux.log();
24
+ core_1.ux.log(`The privatelink endpoint is now being provisioned for ${color_1.default.green(database)}.`);
25
+ core_1.ux.log('Run ' + color_1.default.cmd('heroku data:privatelink:wait ' + database + ' --app ' + app) +
26
26
  ' to check the creation process.');
27
27
  }
28
28
  }
29
- EndpointsCreate.description = 'create a new privatelink endpoint for your database';
30
- EndpointsCreate.aliases = ['pg:privatelink:create', 'kafka:privatelink:create', 'redis:privatelink:create'];
31
- EndpointsCreate.args = [
32
- { name: 'database' },
33
- ];
34
- EndpointsCreate.flags = {
35
- 'aws-account-id': command_1.flags.build({
29
+ exports.default = Create;
30
+ Create.description = 'create a new privatelink endpoint for your database';
31
+ Create.hiddenAliases = ['pg:privatelink:create', 'kafka:privatelink:create', 'redis:privatelink:create'];
32
+ Create.args = {
33
+ database: core_1.Args.string({ required: true }),
34
+ };
35
+ Create.flags = {
36
+ 'aws-account-id': command_1.flags.string({
36
37
  char: 'i',
37
38
  description: 'AWS account id to use',
38
- parse: (input, ctx) => {
39
- if (!ctx.endpoints_create_ids)
40
- ctx.endpoints_create_ids = [];
41
- ctx.endpoints_create_ids.push(input);
42
- return ctx.endpoints_create_ids;
43
- },
44
- })(),
45
- app: command_1.flags.app({ required: true })
39
+ required: true,
40
+ multiple: true,
41
+ }),
42
+ app: command_1.flags.app({ required: true }),
43
+ remote: command_1.flags.remote(),
46
44
  };
47
- EndpointsCreate.examples = [
48
- '$ heroku data:privatelink:create postgresql-sushi-12345 --aws-account-id 123456789012:user/abc',
49
- '$ heroku data:privatelink:create postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --account-id 123456789012:user/xyz',
45
+ Create.examples = [
46
+ '$ heroku data:privatelink:create postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --app my-app',
47
+ '$ heroku data:privatelink:create postgresql-sushi-12345 --aws-account-id 123456789012:user/abc --account-id 123456789012:user/xyz --app my-app',
50
48
  ];
51
- exports.default = EndpointsCreate;
@@ -1,13 +1,13 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../base';
3
- export default class EndpointsDestroy extends BaseCommand {
2
+ export default class Destroy extends BaseCommand {
4
3
  static description: string;
5
- static aliases: string[];
4
+ static hiddenAliases: string[];
6
5
  static args: {
7
- name: string;
8
- }[];
6
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
9
8
  static flags: {
10
- app: flags.IOptionFlag<string>;
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
11
  };
12
12
  static examples: string[];
13
13
  run(): Promise<void>;
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@heroku-cli/command");
4
- const cli_ux_1 = require("cli-ux");
4
+ const core_1 = require("@oclif/core");
5
5
  const base_1 = require("../../../base");
6
6
  const fetcher_1 = require("../../../lib/fetcher");
7
- class EndpointsDestroy extends base_1.default {
7
+ class Destroy extends base_1.default {
8
8
  async run() {
9
- const { args, flags } = this.parse(EndpointsDestroy);
10
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
11
- cli_ux_1.cli.action.start('Destroying privatelink endpoint');
9
+ const { args, flags } = await this.parse(Destroy);
10
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, flags.app);
11
+ core_1.ux.action.start('Destroying privatelink endpoint');
12
12
  await this.shogun.delete(`/private-link/v0/databases/${database}`, this.shogun.defaults);
13
- cli_ux_1.cli.action.stop();
13
+ core_1.ux.action.stop();
14
14
  }
15
15
  }
16
- EndpointsDestroy.description = 'destroy a privatelink endpoint for your database';
17
- EndpointsDestroy.aliases = ['pg:privatelink:destroy', 'kafka:privatelink:destroy', 'redis:privatelink:destroy'];
18
- EndpointsDestroy.args = [
19
- { name: 'database' }
20
- ];
21
- EndpointsDestroy.flags = {
22
- app: command_1.flags.app({ required: true })
16
+ exports.default = Destroy;
17
+ Destroy.description = 'destroy a privatelink endpoint for your database';
18
+ Destroy.hiddenAliases = ['pg:privatelink:destroy', 'kafka:privatelink:destroy', 'redis:privatelink:destroy'];
19
+ Destroy.args = {
20
+ database: core_1.Args.string({ required: true }),
21
+ };
22
+ Destroy.flags = {
23
+ app: command_1.flags.app({ required: true }),
24
+ remote: command_1.flags.remote(),
23
25
  };
24
- EndpointsDestroy.examples = [
25
- '$ heroku data:privatelink:destroy postgresql-sushi-12345',
26
+ Destroy.examples = [
27
+ '$ heroku data:privatelink:destroy postgresql-sushi-12345 --app my-app',
26
28
  ];
27
- exports.default = EndpointsDestroy;
@@ -1,14 +1,16 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../base';
3
- export default class EndpointsIndex extends BaseCommand {
2
+ export default class Index extends BaseCommand {
3
+ static topic: string;
4
4
  static description: string;
5
- static aliases: string[];
5
+ static hiddenAliases: string[];
6
6
  static args: {
7
- name: string;
8
- }[];
7
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
8
+ };
9
9
  static flags: {
10
- app: flags.IOptionFlag<string>;
10
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  };
12
13
  static examples: string[];
13
14
  run(): Promise<void>;
15
+ private addonType;
14
16
  }
@@ -2,60 +2,70 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const color_1 = require("@heroku-cli/color");
4
4
  const command_1 = require("@heroku-cli/command");
5
- const cli_ux_1 = require("cli-ux");
5
+ const core_1 = require("@oclif/core");
6
6
  const base_1 = require("../../../base");
7
- const addontype_1 = require("../../../lib/addontype");
8
7
  const fetcher_1 = require("../../../lib/fetcher");
9
- class EndpointsIndex extends base_1.default {
8
+ class Index extends base_1.default {
10
9
  async run() {
11
- const { args, flags } = this.parse(EndpointsIndex);
12
- const database = await fetcher_1.default(this.heroku, args.database, flags.app);
10
+ const { args, flags } = await this.parse(Index);
11
+ const { app } = flags;
12
+ const database = await (0, fetcher_1.default)(this.heroku, args.database, app);
13
13
  const { body: res } = await this.shogun.get(`/private-link/v0/databases/${database}`, this.shogun.defaults);
14
- const addonType = await addontype_1.default(res.addon.name);
14
+ const addonType = this.addonType(res.addon.name);
15
15
  if (res.status === 'Provisioning') {
16
- this.log();
17
- this.log(`The privatelink endpoint is now being provisioned for ${color_1.default.cyan(database)}.`);
18
- this.log(`Run ${color_1.default.cyan('heroku data:privatelink:wait -a APP')} to check the creation process.`);
16
+ core_1.ux.log();
17
+ core_1.ux.log(`The privatelink endpoint is now being provisioned for ${color_1.default.green(database)}.`);
18
+ core_1.ux.log(`Run ${color_1.default.cmd(`heroku data:privatelink:wait -a ${app}`)} to check the creation process.`);
19
19
  }
20
20
  else {
21
- cli_ux_1.cli.styledHeader(`privatelink endpoint status for ${color_1.default.cyan(database)}`);
22
- cli_ux_1.cli.styledObject({
21
+ core_1.ux.styledHeader(`privatelink endpoint status for ${color_1.default.green(database)}`);
22
+ core_1.ux.styledObject({
23
23
  Status: res.status,
24
24
  'Service Name': res.service_name || 'Provisioning',
25
25
  });
26
26
  if (res && res.allowed_accounts.length > 0) {
27
- this.log();
28
- cli_ux_1.cli.styledHeader('Allowed Accounts');
29
- cli_ux_1.cli.table(res.allowed_accounts, {
27
+ core_1.ux.log();
28
+ core_1.ux.styledHeader('Allowed Accounts');
29
+ core_1.ux.table(res.allowed_accounts, {
30
30
  arn: { header: 'ARN' },
31
- status: {}
31
+ status: {},
32
32
  });
33
33
  }
34
- this.log();
34
+ core_1.ux.log();
35
35
  if (res && res.connections.length > 0) {
36
- cli_ux_1.cli.styledHeader('Connections');
37
- cli_ux_1.cli.table(res.connections, {
36
+ core_1.ux.styledHeader('Connections');
37
+ core_1.ux.table(res.connections, {
38
38
  endpoint_id: { header: 'Endpoint ID' },
39
39
  owner_arn: { header: 'Owner ARN' },
40
- status: {}
40
+ status: {},
41
41
  });
42
42
  }
43
43
  else if (res.status === 'Operational' && res.connections.length === 0) {
44
- this.log('Your privatelink endpoint is now operational.');
45
- this.log(`You must now copy the ${color_1.default.cyan('Service Name')} and follow the rest of the steps listed in https://devcenter.heroku.com/articles/heroku-${addonType}-via-privatelink`);
44
+ core_1.ux.log('Your privatelink endpoint is now operational.');
45
+ core_1.ux.log(`You must now copy the ${color_1.default.green('Service Name')} and follow the rest of the steps listed in https://devcenter.heroku.com/articles/heroku-${addonType}-via-privatelink`);
46
46
  }
47
47
  }
48
48
  }
49
+ addonType(addon_name) {
50
+ if (addon_name.includes('postgres'))
51
+ return 'postgres';
52
+ if (addon_name.includes('kafka'))
53
+ return 'kafka';
54
+ if (addon_name.includes('redis'))
55
+ return 'redis';
56
+ }
49
57
  }
50
- EndpointsIndex.description = 'list all your privatelink endpoints!';
51
- EndpointsIndex.aliases = ['pg:privatelink', 'kafka:privatelink', 'redis:privatelink'];
52
- EndpointsIndex.args = [
53
- { name: 'database' }
54
- ];
55
- EndpointsIndex.flags = {
56
- app: command_1.flags.app({ required: true })
58
+ exports.default = Index;
59
+ Index.topic = 'data:privatelink';
60
+ Index.description = 'list all your privatelink endpoints';
61
+ Index.hiddenAliases = ['pg:privatelink', 'kafka:privatelink', 'redis:privatelink'];
62
+ Index.args = {
63
+ database: core_1.Args.string({ required: true }),
64
+ };
65
+ Index.flags = {
66
+ app: command_1.flags.app({ required: true }),
67
+ remote: command_1.flags.remote(),
57
68
  };
58
- EndpointsIndex.examples = [
59
- '$ heroku data:privatelink postgresql-sushi-12345',
69
+ Index.examples = [
70
+ '$ heroku data:privatelink postgresql-sushi-12345 --app my-app',
60
71
  ];
61
- exports.default = EndpointsIndex;
@@ -1,13 +1,13 @@
1
- import { flags } from '@heroku-cli/command';
2
1
  import BaseCommand from '../../../base';
3
- export default class EndpointsWait extends BaseCommand {
2
+ export default class Wait extends BaseCommand {
4
3
  static description: string;
5
- static aliases: string[];
4
+ static hiddenAliases: string[];
6
5
  static args: {
7
- name: string;
8
- }[];
6
+ database: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
7
+ };
9
8
  static flags: {
10
- app: flags.IOptionFlag<string>;
9
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ remote: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
11
  };
12
12
  static examples: string[];
13
13
  run(): Promise<void>;