@heroku-cli/plugin-data 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +276 -0
- package/lib/commands/data/connectors/create.d.ts +16 -0
- package/lib/commands/data/connectors/create.js +71 -0
- package/lib/commands/data/connectors/destroy.d.ts +13 -0
- package/lib/commands/data/connectors/destroy.js +43 -0
- package/lib/commands/data/connectors/index.d.ts +15 -0
- package/lib/commands/data/connectors/index.js +87 -0
- package/lib/commands/data/connectors/info.d.ts +12 -0
- package/lib/commands/data/connectors/info.js +61 -0
- package/lib/commands/data/connectors/pause.d.ts +9 -0
- package/lib/commands/data/connectors/pause.js +27 -0
- package/lib/commands/data/connectors/resume.d.ts +9 -0
- package/lib/commands/data/connectors/resume.js +27 -0
- package/lib/commands/data/connectors/update.d.ts +17 -0
- package/lib/commands/data/connectors/update.js +81 -0
- package/lib/commands/data/connectors/wait.d.ts +9 -0
- package/lib/commands/data/connectors/wait.js +27 -0
- package/lib/commands/data/enhanced-certificates/disable.d.ts +12 -0
- package/lib/commands/data/enhanced-certificates/disable.js +26 -0
- package/lib/commands/data/enhanced-certificates/enable.d.ts +13 -0
- package/lib/commands/data/enhanced-certificates/enable.js +29 -0
- package/lib/commands/data/enhanced-certificates/status.d.ts +13 -0
- package/lib/commands/data/enhanced-certificates/status.js +29 -0
- package/lib/fetcher.d.ts +3 -0
- package/lib/fetcher.js +20 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -0
- package/lib/lib/base.d.ts +37 -0
- package/lib/lib/base.js +24 -0
- package/oclif.manifest.json +1 -0
- package/package.json +68 -0
- package/yarn.lock +2864 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Chris Freeman @cafreeman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
heroku-cli-plugin-data-connectors
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
A Heroku CLI Plugin for managing Heroku Data Connections
|
|
5
|
+
|
|
6
|
+
[](https://oclif.io)
|
|
7
|
+
[](https://npmjs.org/package/@heroku-cli/plugin-data-connectors)
|
|
8
|
+
[](https://circleci.com/gh/heroku/heroku-cli-plugin-data-connectors/tree/main)
|
|
9
|
+
[](https://npmjs.org/package/@heroku-cli/plugin-data-connectors)
|
|
10
|
+
[](https://github.com/heroku/heroku-cli-plugin-data-connectors/blob/main/package.json)
|
|
11
|
+
|
|
12
|
+
You can read more about Heroku Data Connectors on [Dev
|
|
13
|
+
Center](https://devcenter.heroku.com/articles/heroku-data-connectors).
|
|
14
|
+
|
|
15
|
+
<!-- toc -->
|
|
16
|
+
* [Usage](#usage)
|
|
17
|
+
* [Commands](#commands)
|
|
18
|
+
<!-- tocstop -->
|
|
19
|
+
# Usage
|
|
20
|
+
```sh-session
|
|
21
|
+
$ heroku plugins:install data-connectors
|
|
22
|
+
$ heroku COMMAND
|
|
23
|
+
running command...
|
|
24
|
+
$ heroku (-v|--version|version)
|
|
25
|
+
@heroku-cli/plugin-data-connectors/0.2.2 darwin-x64 node-v12.10.0
|
|
26
|
+
$ heroku --help [COMMAND]
|
|
27
|
+
USAGE
|
|
28
|
+
$ heroku COMMAND
|
|
29
|
+
...
|
|
30
|
+
```
|
|
31
|
+
<!-- usagestop -->
|
|
32
|
+
# Commands
|
|
33
|
+
<!-- commands -->
|
|
34
|
+
* [`heroku data:connectors`](#heroku-dataconnectors)
|
|
35
|
+
* [`heroku data:connectors:create`](#heroku-dataconnectorscreate)
|
|
36
|
+
* [`heroku data:connectors:destroy [CONNECTOR]`](#heroku-dataconnectorsdestroy-connector)
|
|
37
|
+
* [`heroku data:connectors:info [CONNECTOR]`](#heroku-dataconnectorsinfo-connector)
|
|
38
|
+
* [`heroku data:connectors:pause [CONNECTOR]`](#heroku-dataconnectorspause-connector)
|
|
39
|
+
* [`heroku data:connectors:resume [CONNECTOR]`](#heroku-dataconnectorsresume-connector)
|
|
40
|
+
* [`heroku data:connectors:update [CONNECTOR]`](#heroku-dataconnectorsupdate-connector)
|
|
41
|
+
* [`heroku data:connectors:wait [CONNECTOR]`](#heroku-dataconnectorswait-connector)
|
|
42
|
+
* [`heroku data:enhanced-certificates:disable [ADDON]`](#heroku-dataenhanced-certificatesdisable-addon)
|
|
43
|
+
* [`heroku data:enhanced-certificates:enable [ADDON]`](#heroku-dataenhanced-certificatesenable-addon)
|
|
44
|
+
* [`heroku data:enhanced-certificates:status [ADDON]`](#heroku-dataenhanced-certificatesstatus-addon)
|
|
45
|
+
|
|
46
|
+
## `heroku data:connectors`
|
|
47
|
+
|
|
48
|
+
List all Data Connectors for a particular app or addon
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
USAGE
|
|
52
|
+
$ heroku data:connectors
|
|
53
|
+
|
|
54
|
+
OPTIONS
|
|
55
|
+
-a, --app=app app to run command against
|
|
56
|
+
-r, --remote=remote git remote of app to use
|
|
57
|
+
--addon=addon The ID or name for the addon your connector is attached to
|
|
58
|
+
--json Return the results as JSON
|
|
59
|
+
--table Return the results as a table
|
|
60
|
+
|
|
61
|
+
DESCRIPTION
|
|
62
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
63
|
+
|
|
64
|
+
ALIASES
|
|
65
|
+
$ heroku data:connectors:list
|
|
66
|
+
|
|
67
|
+
EXAMPLES
|
|
68
|
+
heroku data:connectors -a your-app
|
|
69
|
+
heroku data:connectors --app=your-app --json
|
|
70
|
+
heroku data:connectors --addon=your-postgres-addon --table
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
_See code: [src/commands/data/connectors/index.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/index.ts)_
|
|
74
|
+
|
|
75
|
+
## `heroku data:connectors:create`
|
|
76
|
+
|
|
77
|
+
create a new Data Connector
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
USAGE
|
|
81
|
+
$ heroku data:connectors:create
|
|
82
|
+
|
|
83
|
+
OPTIONS
|
|
84
|
+
-a, --app=app app to run command against
|
|
85
|
+
-t, --table=table (required) Tables to include
|
|
86
|
+
--exclude-column=exclude-column Columns to exclude
|
|
87
|
+
--name=name Name of the connector
|
|
88
|
+
--source=source (required) The name of the database add-on whose change data you want to store
|
|
89
|
+
--store=store (required) The name of the database add-on that will store the change data
|
|
90
|
+
|
|
91
|
+
DESCRIPTION
|
|
92
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
93
|
+
|
|
94
|
+
EXAMPLES
|
|
95
|
+
$ heroku data:connectors:create --store kafka-lovely-12345 --source postgresql-neato-98765 --table public.posts
|
|
96
|
+
--table public.comments
|
|
97
|
+
$ heroku data:connectors:create --store kafka-lovely-12345 --source postgresql-neato-98765 --table public.users
|
|
98
|
+
--exclude-column public.users.password
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
_See code: [src/commands/data/connectors/create.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/create.ts)_
|
|
102
|
+
|
|
103
|
+
## `heroku data:connectors:destroy [CONNECTOR]`
|
|
104
|
+
|
|
105
|
+
Destroy a Data Connector
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
USAGE
|
|
109
|
+
$ heroku data:connectors:destroy [CONNECTOR]
|
|
110
|
+
|
|
111
|
+
OPTIONS
|
|
112
|
+
--confirm=confirm confirms destroying the connector if passed in
|
|
113
|
+
|
|
114
|
+
DESCRIPTION
|
|
115
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
116
|
+
|
|
117
|
+
EXAMPLES
|
|
118
|
+
$ heroku data:connectors:destroy gentle-connector-1234
|
|
119
|
+
$ heroku data:connectors:destroy gentle-connector-1234 --confirm gentle-connector-1234
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
_See code: [src/commands/data/connectors/destroy.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/destroy.ts)_
|
|
123
|
+
|
|
124
|
+
## `heroku data:connectors:info [CONNECTOR]`
|
|
125
|
+
|
|
126
|
+
Get information about a Data Connector
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
USAGE
|
|
130
|
+
$ heroku data:connectors:info [CONNECTOR]
|
|
131
|
+
|
|
132
|
+
OPTIONS
|
|
133
|
+
--json Return the results as JSON
|
|
134
|
+
|
|
135
|
+
DESCRIPTION
|
|
136
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
137
|
+
|
|
138
|
+
EXAMPLES
|
|
139
|
+
$ heroku data:connectors:info gentle-connector-1234
|
|
140
|
+
$ heroku data:connectors:info gentle-connector-1234 --json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
_See code: [src/commands/data/connectors/info.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/info.ts)_
|
|
144
|
+
|
|
145
|
+
## `heroku data:connectors:pause [CONNECTOR]`
|
|
146
|
+
|
|
147
|
+
Pause change event creation on a Data Connector
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
USAGE
|
|
151
|
+
$ heroku data:connectors:pause [CONNECTOR]
|
|
152
|
+
|
|
153
|
+
DESCRIPTION
|
|
154
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
155
|
+
|
|
156
|
+
EXAMPLE
|
|
157
|
+
$ heroku data:connectors:pause gentle-connector-1234
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
_See code: [src/commands/data/connectors/pause.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/pause.ts)_
|
|
161
|
+
|
|
162
|
+
## `heroku data:connectors:resume [CONNECTOR]`
|
|
163
|
+
|
|
164
|
+
Resume change event creation on a Data Connector
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
USAGE
|
|
168
|
+
$ heroku data:connectors:resume [CONNECTOR]
|
|
169
|
+
|
|
170
|
+
DESCRIPTION
|
|
171
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
172
|
+
|
|
173
|
+
EXAMPLE
|
|
174
|
+
$ heroku data:connectors:resume gentle-connector-1234
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
_See code: [src/commands/data/connectors/resume.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/resume.ts)_
|
|
178
|
+
|
|
179
|
+
## `heroku data:connectors:update [CONNECTOR]`
|
|
180
|
+
|
|
181
|
+
Update the settings, tables, and columns to exclude for a Data Connector
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
USAGE
|
|
185
|
+
$ heroku data:connectors:update [CONNECTOR]
|
|
186
|
+
|
|
187
|
+
OPTIONS
|
|
188
|
+
--add-table=add-table Tables to add
|
|
189
|
+
--exclude-column=exclude-column Columns to exclude
|
|
190
|
+
--remove-excluded-column=remove-excluded-column Columns to no longer exclude
|
|
191
|
+
--remove-table=remove-table Tables to remove
|
|
192
|
+
--setting=setting
|
|
193
|
+
|
|
194
|
+
DESCRIPTION
|
|
195
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors#update-configuration
|
|
196
|
+
|
|
197
|
+
EXAMPLE
|
|
198
|
+
$ heroku data:connectors:update gentle-connector-1234 --setting key=value --setting otherKey=otherValue --add-table
|
|
199
|
+
public.posts --add-table public.people --remove-table public.messages --exclude-column public.posts.key
|
|
200
|
+
--remove-excluded-column public.parcels.key
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
_See code: [src/commands/data/connectors/update.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/update.ts)_
|
|
204
|
+
|
|
205
|
+
## `heroku data:connectors:wait [CONNECTOR]`
|
|
206
|
+
|
|
207
|
+
Wait for your Data Connector to be provisioned
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
USAGE
|
|
211
|
+
$ heroku data:connectors:wait [CONNECTOR]
|
|
212
|
+
|
|
213
|
+
DESCRIPTION
|
|
214
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors
|
|
215
|
+
|
|
216
|
+
EXAMPLE
|
|
217
|
+
$ heroku data:connectors:wait gentle-connector-1234
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
_See code: [src/commands/data/connectors/wait.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/connectors/wait.ts)_
|
|
221
|
+
|
|
222
|
+
## `heroku data:enhanced-certificates:disable [ADDON]`
|
|
223
|
+
|
|
224
|
+
Disable enhanced certificates on an Addon
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
USAGE
|
|
228
|
+
$ heroku data:enhanced-certificates:disable [ADDON]
|
|
229
|
+
|
|
230
|
+
OPTIONS
|
|
231
|
+
-a, --app=app app to run command against
|
|
232
|
+
|
|
233
|
+
DESCRIPTION
|
|
234
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-enhanced-certificates
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
_See code: [src/commands/data/enhanced-certificates/disable.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/enhanced-certificates/disable.ts)_
|
|
238
|
+
|
|
239
|
+
## `heroku data:enhanced-certificates:enable [ADDON]`
|
|
240
|
+
|
|
241
|
+
Enable enhanced certificates on an Addon
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
USAGE
|
|
245
|
+
$ heroku data:enhanced-certificates:enable [ADDON]
|
|
246
|
+
|
|
247
|
+
OPTIONS
|
|
248
|
+
-a, --app=app app to run command against
|
|
249
|
+
|
|
250
|
+
DESCRIPTION
|
|
251
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-enhanced-certificates
|
|
252
|
+
|
|
253
|
+
EXAMPLE
|
|
254
|
+
$ heroku data:enhanced-certificates:enale happy-postgres-1234 -a example-app
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
_See code: [src/commands/data/enhanced-certificates/enable.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/enhanced-certificates/enable.ts)_
|
|
258
|
+
|
|
259
|
+
## `heroku data:enhanced-certificates:status [ADDON]`
|
|
260
|
+
|
|
261
|
+
Get the status of Enhanced Certificates
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
USAGE
|
|
265
|
+
$ heroku data:enhanced-certificates:status [ADDON]
|
|
266
|
+
|
|
267
|
+
OPTIONS
|
|
268
|
+
-a, --app=app app to run command against
|
|
269
|
+
--json Return the results as JSON
|
|
270
|
+
|
|
271
|
+
DESCRIPTION
|
|
272
|
+
Read more about this feature at https://devcenter.heroku.com/articles/heroku-data-enhanced-certificates
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
_See code: [src/commands/data/enhanced-certificates/status.ts](https://github.com/heroku/heroku-cli-plugin-data/blob/v1.1.0/src/commands/data/enhanced-certificates/status.ts)_
|
|
276
|
+
<!-- commandsstop -->
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import BaseCommand from '../../../lib/base';
|
|
3
|
+
export default class ConnectorsCreate extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
app: flags.IOptionFlag<string | undefined>;
|
|
7
|
+
source: flags.IOptionFlag<string>;
|
|
8
|
+
store: flags.IOptionFlag<string>;
|
|
9
|
+
name: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
table: flags.IOptionFlag<string[]>;
|
|
11
|
+
'exclude-column': flags.IOptionFlag<string[]>;
|
|
12
|
+
'platform-version': flags.IOptionFlag<string | undefined>;
|
|
13
|
+
};
|
|
14
|
+
static examples: string[];
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@heroku-cli/color");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const cli_ux_1 = require("cli-ux");
|
|
6
|
+
const fetcher_1 = require("../../../fetcher");
|
|
7
|
+
const base_1 = require("../../../lib/base");
|
|
8
|
+
class ConnectorsCreate extends base_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = this.parse(ConnectorsCreate);
|
|
11
|
+
const tables = flags.table;
|
|
12
|
+
const excluded = flags['exclude-column'] || [];
|
|
13
|
+
const platformVersion = flags['platform-version'] || '';
|
|
14
|
+
const name = flags.name || '';
|
|
15
|
+
const kafka = await fetcher_1.fetchAddon(this.heroku, flags.store, flags.app);
|
|
16
|
+
const postgres = await fetcher_1.fetchAddon(this.heroku, flags.source, flags.app);
|
|
17
|
+
cli_ux_1.cli.action.start('Provisioning Data Connector');
|
|
18
|
+
const { body: res } = await this.shogun.post(`/data/cdc/v0/kafka_tenants/${kafka.id}`, Object.assign(Object.assign({}, this.shogun.defaults), { body: {
|
|
19
|
+
postgres_addon_uuid: postgres.id,
|
|
20
|
+
tables,
|
|
21
|
+
excluded_columns: excluded,
|
|
22
|
+
platform_version: platformVersion,
|
|
23
|
+
name: name,
|
|
24
|
+
} }));
|
|
25
|
+
cli_ux_1.cli.action.stop();
|
|
26
|
+
this.log();
|
|
27
|
+
cli_ux_1.cli.styledObject({
|
|
28
|
+
Name: res.name,
|
|
29
|
+
Status: res.status,
|
|
30
|
+
});
|
|
31
|
+
this.log();
|
|
32
|
+
this.log('Run ' + color_1.default.cyan('heroku data:connectors:wait ' + res.name) +
|
|
33
|
+
' to check the creation process.');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.default = ConnectorsCreate;
|
|
37
|
+
ConnectorsCreate.description = 'create a new Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
|
|
38
|
+
ConnectorsCreate.flags = {
|
|
39
|
+
app: command_1.flags.app(),
|
|
40
|
+
source: command_1.flags.string({
|
|
41
|
+
required: true,
|
|
42
|
+
description: 'The name of the database add-on whose change data you want to store',
|
|
43
|
+
}),
|
|
44
|
+
store: command_1.flags.string({
|
|
45
|
+
required: true,
|
|
46
|
+
description: 'The name of the database add-on that will store the change data',
|
|
47
|
+
}),
|
|
48
|
+
name: command_1.flags.string({
|
|
49
|
+
required: false,
|
|
50
|
+
description: 'Name of the connector',
|
|
51
|
+
}),
|
|
52
|
+
table: command_1.flags.string({
|
|
53
|
+
char: 't',
|
|
54
|
+
description: 'Tables to include',
|
|
55
|
+
multiple: true,
|
|
56
|
+
required: true,
|
|
57
|
+
}),
|
|
58
|
+
'exclude-column': command_1.flags.string({
|
|
59
|
+
description: 'Columns to exclude',
|
|
60
|
+
multiple: true,
|
|
61
|
+
}),
|
|
62
|
+
'platform-version': command_1.flags.string({
|
|
63
|
+
char: 'p',
|
|
64
|
+
required: false,
|
|
65
|
+
hidden: true,
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
ConnectorsCreate.examples = [
|
|
69
|
+
'$ heroku data:connectors:create --store kafka-lovely-12345 --source postgresql-neato-98765 --table public.posts --table public.comments',
|
|
70
|
+
'$ heroku data:connectors:create --store kafka-lovely-12345 --source postgresql-neato-98765 --table public.users --exclude-column public.users.password',
|
|
71
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import BaseCommand from '../../../lib/base';
|
|
3
|
+
export default class ConnectorsDestroy extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
name: string;
|
|
7
|
+
}[];
|
|
8
|
+
static flags: {
|
|
9
|
+
confirm: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
};
|
|
11
|
+
static examples: string[];
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_ux_1 = require("cli-ux");
|
|
4
|
+
const command_1 = require("@heroku-cli/command");
|
|
5
|
+
const base_1 = require("../../../lib/base");
|
|
6
|
+
class ConnectorsDestroy extends base_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
const { args, flags } = this.parse(ConnectorsDestroy);
|
|
9
|
+
const connector = args.connector;
|
|
10
|
+
const confirm = flags.confirm || '';
|
|
11
|
+
await base_1.confirmConnector(connector, confirm);
|
|
12
|
+
cli_ux_1.cli.action.start('Destroying Data Connector');
|
|
13
|
+
try {
|
|
14
|
+
await this.shogun.delete(`/data/cdc/v0/connectors/${connector}`, this.shogun.defaults);
|
|
15
|
+
this.log(`Data Connector ${connector} deleted successfully.`);
|
|
16
|
+
this.log('Note: We do not delete your Kafka topics automatically, because they could still contain messages which you haven\'t consumed. Please delete the topics manually. See heroku kafka:topics:destroy --help');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
this.warn('There was an issue deleting your Data Connector.');
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
cli_ux_1.cli.action.stop();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = ConnectorsDestroy;
|
|
28
|
+
ConnectorsDestroy.description = 'Destroy a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
|
|
29
|
+
ConnectorsDestroy.args = [
|
|
30
|
+
{
|
|
31
|
+
name: 'connector',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
ConnectorsDestroy.flags = {
|
|
35
|
+
confirm: command_1.flags.string({
|
|
36
|
+
description: 'confirms destroying the connector if passed in',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
ConnectorsDestroy.examples = [
|
|
41
|
+
'$ heroku data:connectors:destroy gentle-connector-1234',
|
|
42
|
+
'$ heroku data:connectors:destroy gentle-connector-1234 --confirm gentle-connector-1234',
|
|
43
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { flags } from '@heroku-cli/command';
|
|
2
|
+
import BaseCommand from '../../../lib/base';
|
|
3
|
+
export default class ConnectorsList extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static aliases: string[];
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: {
|
|
8
|
+
app: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
remote: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
addon: flags.IOptionFlag<string | undefined>;
|
|
11
|
+
table: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
+
json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const cli_ux_1 = require("cli-ux");
|
|
5
|
+
const fetcher_1 = require("../../../fetcher");
|
|
6
|
+
const base_1 = require("../../../lib/base");
|
|
7
|
+
class ConnectorsList extends base_1.default {
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = this.parse(ConnectorsList);
|
|
10
|
+
let connectorInfo;
|
|
11
|
+
if (flags.addon) {
|
|
12
|
+
const addon = await fetcher_1.fetchAddon(this.heroku, flags.addon, flags.app);
|
|
13
|
+
const { body: response } = await this.shogun.get(`/data/cdc/v0/addons/${addon.id}`, this.shogun.defaults);
|
|
14
|
+
connectorInfo = response;
|
|
15
|
+
}
|
|
16
|
+
else if (flags.app) {
|
|
17
|
+
// make sure we have app id even if they passed app name
|
|
18
|
+
const { body: app } = await this.heroku.get(`/apps/${flags.app}`);
|
|
19
|
+
const response = await this.shogun.get(`/data/cdc/v0/apps/${app.id}`, this.shogun.defaults);
|
|
20
|
+
connectorInfo = response.body;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
cli_ux_1.cli.error('You must pass either the --app or --addon flag');
|
|
24
|
+
}
|
|
25
|
+
if (flags.json) {
|
|
26
|
+
connectorInfo.forEach(v => {
|
|
27
|
+
cli_ux_1.cli.styledJSON(v);
|
|
28
|
+
this.log();
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
cli_ux_1.cli.styledHeader(`Data Connector info for ${flags.app || flags.addon}`);
|
|
33
|
+
if (flags.table) {
|
|
34
|
+
cli_ux_1.cli.table(connectorInfo, {
|
|
35
|
+
name: { header: 'Connector Name' },
|
|
36
|
+
kafka_addon: {
|
|
37
|
+
header: 'Kafka Add-On',
|
|
38
|
+
get: row => row.kafka_addon.name,
|
|
39
|
+
},
|
|
40
|
+
postgres_addon: {
|
|
41
|
+
header: 'Postgres Add-On',
|
|
42
|
+
get: row => row.postgres_addon.name,
|
|
43
|
+
},
|
|
44
|
+
tables: { header: 'Tables' },
|
|
45
|
+
excluded_columns: { header: 'Excluded Columns' },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
connectorInfo.forEach(c => {
|
|
50
|
+
cli_ux_1.cli.styledObject({
|
|
51
|
+
'Connector Name': c.name,
|
|
52
|
+
'Kafka Add-On': c.kafka_addon.name,
|
|
53
|
+
'Postgres Add-On': c.postgres_addon.name,
|
|
54
|
+
Tables: c.tables,
|
|
55
|
+
'Excluded Columns': c.excluded_columns,
|
|
56
|
+
});
|
|
57
|
+
this.log();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
this.log();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = ConnectorsList;
|
|
64
|
+
ConnectorsList.description = 'List all Data Connectors for a particular app or addon\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
|
|
65
|
+
ConnectorsList.aliases = [
|
|
66
|
+
'data:connectors:list',
|
|
67
|
+
];
|
|
68
|
+
ConnectorsList.examples = [
|
|
69
|
+
'heroku data:connectors -a your-app',
|
|
70
|
+
'heroku data:connectors --app=your-app --json',
|
|
71
|
+
'heroku data:connectors --addon=your-postgres-addon --table',
|
|
72
|
+
];
|
|
73
|
+
ConnectorsList.flags = {
|
|
74
|
+
app: command_1.flags.app(),
|
|
75
|
+
remote: command_1.flags.remote(),
|
|
76
|
+
addon: command_1.flags.string({
|
|
77
|
+
description: 'The ID or name for the addon your connector is attached to',
|
|
78
|
+
}),
|
|
79
|
+
table: command_1.flags.boolean({
|
|
80
|
+
description: 'Return the results as a table',
|
|
81
|
+
exclusive: ['json'],
|
|
82
|
+
}),
|
|
83
|
+
json: command_1.flags.boolean({
|
|
84
|
+
description: 'Return the results as JSON',
|
|
85
|
+
exclusive: ['table'],
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseCommand from '../../../lib/base';
|
|
2
|
+
export default class ConnectorsInfo extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
static args: {
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@heroku-cli/command");
|
|
4
|
+
const color_1 = require("@heroku-cli/color");
|
|
5
|
+
const cli_ux_1 = require("cli-ux");
|
|
6
|
+
const base_1 = require("../../../lib/base");
|
|
7
|
+
class ConnectorsInfo extends base_1.default {
|
|
8
|
+
async run() {
|
|
9
|
+
const { args, flags } = this.parse(ConnectorsInfo);
|
|
10
|
+
const connector = args.connector;
|
|
11
|
+
const { body: res } = await this.shogun.get(`/data/cdc/v0/connectors/${connector}`, this.shogun.defaults);
|
|
12
|
+
if (flags.json) {
|
|
13
|
+
cli_ux_1.default.styledJSON(res);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (res.status === 'creating') {
|
|
17
|
+
this.log(`The Data Connector is now being provisioned for ${color_1.default.cyan(connector)}.`);
|
|
18
|
+
this.log(`Run ${color_1.default.cyan(`heroku data:connectors:wait ${res.name}`)} to check the creation process.`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
cli_ux_1.default.styledHeader(`Data Connector status for ${color_1.default.cyan(connector)}`);
|
|
22
|
+
cli_ux_1.default.styledObject({
|
|
23
|
+
Lag: res.lag,
|
|
24
|
+
Status: res.status,
|
|
25
|
+
'Service Name': res.uuid || 'Provisioning',
|
|
26
|
+
});
|
|
27
|
+
if (res.topics && res.topics.length > 0) {
|
|
28
|
+
this.log();
|
|
29
|
+
cli_ux_1.default.styledHeader('Configuration');
|
|
30
|
+
cli_ux_1.default.table(res.topics, {
|
|
31
|
+
table_name: { header: 'Table Name' },
|
|
32
|
+
topic_name: { header: 'Topic Name' },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (res.excluded_columns && res.excluded_columns.length > 0) {
|
|
36
|
+
this.log();
|
|
37
|
+
this.log(color_1.default.bold('Excluded Columns'));
|
|
38
|
+
res.excluded_columns.forEach(column => this.log(column));
|
|
39
|
+
}
|
|
40
|
+
this.log();
|
|
41
|
+
if (res.status === 'available') {
|
|
42
|
+
this.log(`Your Data Connector is now ${color_1.default.green('available')}.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = ConnectorsInfo;
|
|
47
|
+
ConnectorsInfo.description = 'Get information about a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
|
|
48
|
+
ConnectorsInfo.examples = [
|
|
49
|
+
'$ heroku data:connectors:info gentle-connector-1234',
|
|
50
|
+
'$ heroku data:connectors:info gentle-connector-1234 --json',
|
|
51
|
+
];
|
|
52
|
+
ConnectorsInfo.flags = {
|
|
53
|
+
json: command_1.flags.boolean({
|
|
54
|
+
description: 'Return the results as JSON',
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
ConnectorsInfo.args = [
|
|
58
|
+
{
|
|
59
|
+
name: 'connector',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_ux_1 = require("cli-ux");
|
|
4
|
+
const base_1 = require("../../../lib/base");
|
|
5
|
+
class ConnectorsPause extends base_1.default {
|
|
6
|
+
async run() {
|
|
7
|
+
const { args } = this.parse(ConnectorsPause);
|
|
8
|
+
cli_ux_1.cli.action.start(`Pausing Data Connector ${args.connector}`);
|
|
9
|
+
try {
|
|
10
|
+
await this.shogun.put(`/data/cdc/v0/connectors/${args.connector}/pause`, Object.assign(Object.assign({}, this.shogun.defaults), { raw: true }));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
cli_ux_1.cli.error(error);
|
|
14
|
+
}
|
|
15
|
+
cli_ux_1.cli.action.stop();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ConnectorsPause;
|
|
19
|
+
ConnectorsPause.description = 'Pause change event creation on a Data Connector\nRead more about this feature at https://devcenter.heroku.com/articles/heroku-data-connectors';
|
|
20
|
+
ConnectorsPause.examples = [
|
|
21
|
+
'$ heroku data:connectors:pause gentle-connector-1234',
|
|
22
|
+
];
|
|
23
|
+
ConnectorsPause.args = [
|
|
24
|
+
{
|
|
25
|
+
name: 'connector',
|
|
26
|
+
},
|
|
27
|
+
];
|