@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.
Files changed (43) hide show
  1. package/README.md +90 -51
  2. package/dist/base.d.ts +8 -8
  3. package/dist/base.js +4 -7
  4. package/dist/commands/data/mtls/certificates/create.d.ts +3 -3
  5. package/dist/commands/data/mtls/certificates/create.js +17 -19
  6. package/dist/commands/data/mtls/certificates/delete.d.ts +4 -4
  7. package/dist/commands/data/mtls/certificates/delete.js +16 -19
  8. package/dist/commands/data/mtls/certificates/download.d.ts +6 -6
  9. package/dist/commands/data/mtls/certificates/download.js +59 -63
  10. package/dist/commands/data/mtls/certificates/get.d.ts +4 -4
  11. package/dist/commands/data/mtls/certificates/get.js +15 -17
  12. package/dist/commands/data/mtls/certificates/index.d.ts +3 -3
  13. package/dist/commands/data/mtls/certificates/index.js +23 -26
  14. package/dist/commands/data/mtls/create.d.ts +3 -3
  15. package/dist/commands/data/mtls/create.js +21 -23
  16. package/dist/commands/data/mtls/destroy.d.ts +3 -3
  17. package/dist/commands/data/mtls/destroy.js +15 -18
  18. package/dist/commands/data/mtls/index.d.ts +3 -3
  19. package/dist/commands/data/mtls/index.js +32 -41
  20. package/dist/commands/data/mtls/ip-rules/create.d.ts +5 -5
  21. package/dist/commands/data/mtls/ip-rules/create.js +20 -22
  22. package/dist/commands/data/mtls/ip-rules/delete.d.ts +5 -5
  23. package/dist/commands/data/mtls/ip-rules/delete.js +19 -22
  24. package/dist/commands/data/mtls/ip-rules/get.d.ts +4 -4
  25. package/dist/commands/data/mtls/ip-rules/get.js +13 -16
  26. package/dist/commands/data/mtls/ip-rules/index.d.ts +3 -3
  27. package/dist/commands/data/mtls/ip-rules/index.js +13 -16
  28. package/dist/index.d.ts +1 -2
  29. package/dist/index.js +1 -3
  30. package/dist/lib/addon-fetcher.d.ts +7 -0
  31. package/dist/lib/addon-fetcher.js +23 -0
  32. package/dist/utils/file-helper.d.ts +1 -1
  33. package/dist/utils/file-helper.js +4 -11
  34. package/dist/utils/is-error-http.js +1 -4
  35. package/dist/utils/is-error-message.js +1 -4
  36. package/dist/utils/table.d.ts +1 -1
  37. package/dist/utils/table.js +11 -16
  38. package/{dist/oclif.manifest.json → oclif.manifest.json} +134 -49
  39. package/package.json +36 -36
  40. package/dist/README.md +0 -347
  41. package/dist/lib/fetcher.d.ts +0 -1
  42. package/dist/lib/fetcher.js +0 -70
  43. package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/README.md DELETED
@@ -1,347 +0,0 @@
1
- # Heroku CLI MTLS Plugin
2
-
3
- [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
4
- ![GitHub Actions CI](https://github.com/heroku/heroku-mtls-cli/actions/workflows/ci.yml/badge.svg)
5
-
6
- <!-- toc -->
7
- * [Heroku CLI MTLS Plugin](#heroku-cli-mtls-plugin)
8
- * [Installation](#installation)
9
- * [Commands](#commands)
10
- <!-- tocstop -->
11
- # Installation
12
- ```sh-session
13
- $ heroku plugins:install @heroku-cli/plugin-mtls
14
- ```
15
- # Commands
16
- <!-- commands -->
17
- * [`heroku data:mtls ADDON`](#heroku-datamtls-addon)
18
- * [`heroku data:mtls:certificates ADDON`](#heroku-datamtlscertificates-addon)
19
- * [`heroku data:mtls:certificates:create ADDON`](#heroku-datamtlscertificatescreate-addon)
20
- * [`heroku data:mtls:certificates:delete ADDON`](#heroku-datamtlscertificatesdelete-addon)
21
- * [`heroku data:mtls:certificates:download ADDON`](#heroku-datamtlscertificatesdownload-addon)
22
- * [`heroku data:mtls:certificates:get ADDON`](#heroku-datamtlscertificatesget-addon)
23
- * [`heroku data:mtls:create ADDON`](#heroku-datamtlscreate-addon)
24
- * [`heroku data:mtls:delete ADDON`](#heroku-datamtlsdelete-addon)
25
- * [`heroku data:mtls:destroy ADDON`](#heroku-datamtlsdestroy-addon)
26
- * [`heroku data:mtls:ip-rules ADDON`](#heroku-datamtlsip-rules-addon)
27
- * [`heroku data:mtls:ip-rules:create ADDON`](#heroku-datamtlsip-rulescreate-addon)
28
- * [`heroku data:mtls:ip-rules:delete ADDON`](#heroku-datamtlsip-rulesdelete-addon)
29
- * [`heroku data:mtls:ip-rules:get ADDON`](#heroku-datamtlsip-rulesget-addon)
30
-
31
- ## `heroku data:mtls ADDON`
32
-
33
- get the status of MTLS for your addon
34
-
35
- ```
36
- USAGE
37
- $ heroku data:mtls ADDON -a <value>
38
-
39
- ARGUMENTS
40
- ADDON addon
41
-
42
- FLAGS
43
- -a, --app=<value> (required) app to run command against
44
-
45
- DESCRIPTION
46
- get the status of MTLS for your addon
47
-
48
- EXAMPLES
49
- $ heroku data:mtls postgresql-sushi-12345 -a example-app
50
- ```
51
-
52
- _See code: [src/commands/data/mtls/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/index.ts)_
53
-
54
- ## `heroku data:mtls:certificates ADDON`
55
-
56
- get the certificates for your MTLS enabled addon
57
-
58
- ```
59
- USAGE
60
- $ heroku data:mtls:certificates ADDON -a <value>
61
-
62
- ARGUMENTS
63
- ADDON addon
64
-
65
- FLAGS
66
- -a, --app=<value> (required) app to run command against
67
-
68
- DESCRIPTION
69
- get the certificates for your MTLS enabled addon
70
-
71
- EXAMPLES
72
- $ heroku data:mtls:certificates postgresql-sushi-12345 -a example-app
73
- ```
74
-
75
- _See code: [src/commands/data/mtls/certificates/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/certificates/index.ts)_
76
-
77
- ## `heroku data:mtls:certificates:create ADDON`
78
-
79
- create a new certificate for your MTLS enabled addon
80
-
81
- ```
82
- USAGE
83
- $ heroku data:mtls:certificates:create ADDON -a <value>
84
-
85
- ARGUMENTS
86
- ADDON addon
87
-
88
- FLAGS
89
- -a, --app=<value> (required) app to run command against
90
-
91
- DESCRIPTION
92
- create a new certificate for your MTLS enabled addon
93
-
94
- EXAMPLES
95
- $ heroku data:mtls:certificates:create postgresql-sushi-12345 -a example-app
96
- ```
97
-
98
- _See code: [src/commands/data/mtls/certificates/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/certificates/create.ts)_
99
-
100
- ## `heroku data:mtls:certificates:delete ADDON`
101
-
102
- delete a specific certificate for your MTLS enabled addon
103
-
104
- ```
105
- USAGE
106
- $ heroku data:mtls:certificates:delete ADDON -a <value> --id <value>
107
-
108
- ARGUMENTS
109
- ADDON addon
110
-
111
- FLAGS
112
- -a, --app=<value> (required) app to run command against
113
- --id=<value> (required) id of certificate
114
-
115
- DESCRIPTION
116
- delete a specific certificate for your MTLS enabled addon
117
-
118
- EXAMPLES
119
- $ heroku data:mtls:certificates:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app
120
- ```
121
-
122
- _See code: [src/commands/data/mtls/certificates/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/certificates/delete.ts)_
123
-
124
- ## `heroku data:mtls:certificates:download ADDON`
125
-
126
- download your certificate bundle for your mTLS addon
127
-
128
- ```
129
- USAGE
130
- $ heroku data:mtls:certificates:download ADDON -a <value> --prefix <value> [--dir <value>] [--id <value>]
131
-
132
- ARGUMENTS
133
- ADDON addon
134
-
135
- FLAGS
136
- -a, --app=<value> (required) app to run command against
137
- --dir=<value> directory to download files to. defaults to HOME:/.postgresql
138
- --id=<value> ID of certificate to download
139
- --prefix=<value> (required) prefix to put in front of downloaded file names
140
-
141
- DESCRIPTION
142
- download your certificate bundle for your mTLS addon
143
-
144
- EXAMPLES
145
- $ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" -a example-app
146
-
147
- $ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f" --dir "./folder" -a example-app
148
-
149
- $ heroku data:mtls:certificates:download postgresql-sushi-12345 --id "3559a4df-2c82-4473-86cf-181310a6ef4f --prefix "prefix_" -a example-app
150
- ```
151
-
152
- _See code: [src/commands/data/mtls/certificates/download.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/certificates/download.ts)_
153
-
154
- ## `heroku data:mtls:certificates:get ADDON`
155
-
156
- get a specific certificate for your MTLS enabled addon
157
-
158
- ```
159
- USAGE
160
- $ heroku data:mtls:certificates:get ADDON -a <value> --id <value>
161
-
162
- ARGUMENTS
163
- ADDON addon
164
-
165
- FLAGS
166
- -a, --app=<value> (required) app to run command against
167
- --id=<value> (required) id of IP Rule
168
-
169
- DESCRIPTION
170
- get a specific certificate for your MTLS enabled addon
171
-
172
- EXAMPLES
173
- $ heroku data:mtls:certificates:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app
174
- ```
175
-
176
- _See code: [src/commands/data/mtls/certificates/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/certificates/get.ts)_
177
-
178
- ## `heroku data:mtls:create ADDON`
179
-
180
- enable MTLS for your addon
181
-
182
- ```
183
- USAGE
184
- $ heroku data:mtls:create ADDON -a <value>
185
-
186
- ARGUMENTS
187
- ADDON addon
188
-
189
- FLAGS
190
- -a, --app=<value> (required) app to run command against
191
-
192
- DESCRIPTION
193
- enable MTLS for your addon
194
-
195
- EXAMPLES
196
- $ heroku data:mtls:create postgresql-sushi-12345 -a example-app
197
- ```
198
-
199
- _See code: [src/commands/data/mtls/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/create.ts)_
200
-
201
- ## `heroku data:mtls:delete ADDON`
202
-
203
- destroy MTLS configuration on your addon
204
-
205
- ```
206
- USAGE
207
- $ heroku data:mtls:delete ADDON -a <value>
208
-
209
- ARGUMENTS
210
- ADDON addon
211
-
212
- FLAGS
213
- -a, --app=<value> (required) app to run command against
214
-
215
- DESCRIPTION
216
- destroy MTLS configuration on your addon
217
-
218
- ALIASES
219
- $ heroku data:mtls:delete
220
-
221
- EXAMPLES
222
- $ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app
223
- ```
224
-
225
- ## `heroku data:mtls:destroy ADDON`
226
-
227
- destroy MTLS configuration on your addon
228
-
229
- ```
230
- USAGE
231
- $ heroku data:mtls:destroy ADDON -a <value>
232
-
233
- ARGUMENTS
234
- ADDON addon
235
-
236
- FLAGS
237
- -a, --app=<value> (required) app to run command against
238
-
239
- DESCRIPTION
240
- destroy MTLS configuration on your addon
241
-
242
- ALIASES
243
- $ heroku data:mtls:delete
244
-
245
- EXAMPLES
246
- $ heroku data:mtls:destroy postgresql-sushi-12345 -a example-app
247
- ```
248
-
249
- _See code: [src/commands/data/mtls/destroy.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/destroy.ts)_
250
-
251
- ## `heroku data:mtls:ip-rules ADDON`
252
-
253
- get the IP Rules for your MTLS enabled addon
254
-
255
- ```
256
- USAGE
257
- $ heroku data:mtls:ip-rules ADDON -a <value>
258
-
259
- ARGUMENTS
260
- ADDON addon
261
-
262
- FLAGS
263
- -a, --app=<value> (required) app to run command against
264
-
265
- DESCRIPTION
266
- get the IP Rules for your MTLS enabled addon
267
-
268
- EXAMPLES
269
- $ heroku data:mtls:ip-rules postgresql-sushi-12345 -a example-app
270
- ```
271
-
272
- _See code: [src/commands/data/mtls/ip-rules/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/ip-rules/index.ts)_
273
-
274
- ## `heroku data:mtls:ip-rules:create ADDON`
275
-
276
- create an IP Rule for your MTLS enabled addon
277
-
278
- ```
279
- USAGE
280
- $ heroku data:mtls:ip-rules:create ADDON -a <value> --cidr <value> [--description <value>]
281
-
282
- ARGUMENTS
283
- ADDON addon
284
-
285
- FLAGS
286
- -a, --app=<value> (required) app to run command against
287
- --cidr=<value> (required)
288
- --description=<value>
289
-
290
- DESCRIPTION
291
- create an IP Rule for your MTLS enabled addon
292
-
293
- EXAMPLES
294
- $ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address" -a example-app
295
- ```
296
-
297
- _See code: [src/commands/data/mtls/ip-rules/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/ip-rules/create.ts)_
298
-
299
- ## `heroku data:mtls:ip-rules:delete ADDON`
300
-
301
- delete a specific IP Rule for your MTLS enabled addon
302
-
303
- ```
304
- USAGE
305
- $ heroku data:mtls:ip-rules:delete ADDON -a <value> [--cidr <value>] [--id <value>]
306
-
307
- ARGUMENTS
308
- ADDON addon
309
-
310
- FLAGS
311
- -a, --app=<value> (required) app to run command against
312
- --cidr=<value> cidr of IP Rule
313
- --id=<value> id of IP Rule
314
-
315
- DESCRIPTION
316
- delete a specific IP Rule for your MTLS enabled addon
317
-
318
- EXAMPLES
319
- $ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app
320
- ```
321
-
322
- _See code: [src/commands/data/mtls/ip-rules/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/ip-rules/delete.ts)_
323
-
324
- ## `heroku data:mtls:ip-rules:get ADDON`
325
-
326
- get a specific IP Rule for your MTLS enabled addon
327
-
328
- ```
329
- USAGE
330
- $ heroku data:mtls:ip-rules:get ADDON -a <value> --id <value>
331
-
332
- ARGUMENTS
333
- ADDON addon
334
-
335
- FLAGS
336
- -a, --app=<value> (required) app to run command against
337
- --id=<value> (required) id of IP Rule
338
-
339
- DESCRIPTION
340
- get a specific IP Rule for your MTLS enabled addon
341
-
342
- EXAMPLES
343
- $ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c" -a example-app
344
- ```
345
-
346
- _See code: [src/commands/data/mtls/ip-rules/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v1.0.1/src/commands/data/mtls/ip-rules/get.ts)_
347
- <!-- commandsstop -->
@@ -1 +0,0 @@
1
- export default function (heroku: any, addon_attachment: string, app: string): Promise<any>;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const core_1 = require("@oclif/core");
5
- async function default_1(heroku, addon_attachment, app) {
6
- const filteredAddon = addon_attachment
7
- ? await findAddonGivenAttachment(heroku, addon_attachment, app)
8
- : await findAllAddons(heroku, app);
9
- if (filteredAddon) {
10
- if (filteredAddon.addon_service.name.startsWith('heroku-postgresql')) {
11
- return {
12
- name: filteredAddon.name,
13
- endpoint: `/postgres/v0/databases/${filteredAddon.id}/tls-endpoint`,
14
- kind: 'postgresql'
15
- };
16
- }
17
- if (filteredAddon.addon_service.name.startsWith('heroku-kafka')
18
- && /private|shield/.test(filteredAddon.plan.name)) {
19
- return {
20
- name: filteredAddon.name,
21
- endpoint: `/data/kafka/v0/clusters/${filteredAddon.id}`,
22
- kind: 'kafka'
23
- };
24
- }
25
- }
26
- }
27
- async function findAllAddons(heroku, app) {
28
- const { body: addon_list } = await heroku.get(`/apps/${app}/addons`);
29
- const filtered_list = addon_list.filter((addon) => {
30
- if (addon.addon_service) {
31
- return addon.addon_service.name
32
- && (addon.addon_service.name.startsWith('heroku-postgresql')
33
- || addon.addon_service.name.startsWith('heroku-kafka'));
34
- }
35
- return false;
36
- });
37
- if (filtered_list.length === 0) {
38
- core_1.ux.error('No addons found');
39
- }
40
- else if (filtered_list.length === 1) {
41
- return filtered_list[0];
42
- }
43
- else {
44
- core_1.ux.error("No addon specified. Here's the list of addons:" + filtered_list.map((addon) => addon.name));
45
- }
46
- }
47
- async function findAddonGivenAttachment(heroku, addon_attachment, app) {
48
- const db = addon_attachment;
49
- const { body: res } = await heroku.post('/actions/addons/resolve', {
50
- body: {
51
- app,
52
- addon: db
53
- }
54
- });
55
- if (res.id === 'not_found') {
56
- core_1.ux.error(res.message);
57
- }
58
- const addon = res.find((addon) => {
59
- if (addon.addon_service) {
60
- return addon.addon_service.name
61
- && (addon.addon_service.name.startsWith('heroku-postgresql')
62
- || addon.addon_service.name.startsWith('heroku-kafka'));
63
- }
64
- return false;
65
- });
66
- if (addon) {
67
- return addon;
68
- }
69
- core_1.ux.error('No addons found');
70
- }
@@ -1 +0,0 @@
1
- {"root":["../src/base.ts","../src/index.ts","../src/commands/data/mtls/create.ts","../src/commands/data/mtls/destroy.ts","../src/commands/data/mtls/index.ts","../src/commands/data/mtls/certificates/create.ts","../src/commands/data/mtls/certificates/delete.ts","../src/commands/data/mtls/certificates/download.ts","../src/commands/data/mtls/certificates/get.ts","../src/commands/data/mtls/certificates/index.ts","../src/commands/data/mtls/ip-rules/create.ts","../src/commands/data/mtls/ip-rules/delete.ts","../src/commands/data/mtls/ip-rules/get.ts","../src/commands/data/mtls/ip-rules/index.ts","../src/lib/fetcher.ts","../src/utils/file-helper.ts","../src/utils/is-error-http.ts","../src/utils/is-error-message.ts","../src/utils/table.ts"],"version":"5.8.3"}