@heroku-cli/plugin-mtls 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @heroku-cli/plugin-mtls
|
|
|
20
20
|
$ heroku COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ heroku (-v|--version|version)
|
|
23
|
-
@heroku-cli/plugin-mtls/0.8.
|
|
23
|
+
@heroku-cli/plugin-mtls/0.8.1 darwin-x64 node-v14.18.0
|
|
24
24
|
$ heroku --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ heroku COMMAND
|
|
@@ -57,7 +57,7 @@ EXAMPLE
|
|
|
57
57
|
$ heroku data:mtls postgresql-sushi-12345
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
_See code: [src/commands/data/mtls/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
60
|
+
_See code: [src/commands/data/mtls/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/index.ts)_
|
|
61
61
|
|
|
62
62
|
## `heroku data:mtls:certificates [ADDON]`
|
|
63
63
|
|
|
@@ -74,7 +74,7 @@ EXAMPLE
|
|
|
74
74
|
$ heroku data:mtls:ip-rules postgresql-sushi-12345
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
_See code: [src/commands/data/mtls/certificates/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
77
|
+
_See code: [src/commands/data/mtls/certificates/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/certificates/index.ts)_
|
|
78
78
|
|
|
79
79
|
## `heroku data:mtls:certificates:create [ADDON]`
|
|
80
80
|
|
|
@@ -91,7 +91,7 @@ EXAMPLE
|
|
|
91
91
|
$ heroku data:mtls:certificates:create postgresql-sushi-12345
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
_See code: [src/commands/data/mtls/certificates/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
94
|
+
_See code: [src/commands/data/mtls/certificates/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/certificates/create.ts)_
|
|
95
95
|
|
|
96
96
|
## `heroku data:mtls:certificates:delete [ADDON]`
|
|
97
97
|
|
|
@@ -109,7 +109,7 @@ EXAMPLE
|
|
|
109
109
|
$ heroku data:mtls:certificates:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
_See code: [src/commands/data/mtls/certificates/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
112
|
+
_See code: [src/commands/data/mtls/certificates/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/certificates/delete.ts)_
|
|
113
113
|
|
|
114
114
|
## `heroku data:mtls:certificates:download [ADDON]`
|
|
115
115
|
|
|
@@ -133,7 +133,7 @@ EXAMPLES
|
|
|
133
133
|
"prefix_"
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
_See code: [src/commands/data/mtls/certificates/download.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
136
|
+
_See code: [src/commands/data/mtls/certificates/download.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/certificates/download.ts)_
|
|
137
137
|
|
|
138
138
|
## `heroku data:mtls:certificates:get [ADDON]`
|
|
139
139
|
|
|
@@ -151,7 +151,7 @@ EXAMPLE
|
|
|
151
151
|
$ heroku data:mtls:certificates:create postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
_See code: [src/commands/data/mtls/certificates/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
154
|
+
_See code: [src/commands/data/mtls/certificates/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/certificates/get.ts)_
|
|
155
155
|
|
|
156
156
|
## `heroku data:mtls:create [ADDON]`
|
|
157
157
|
|
|
@@ -168,7 +168,7 @@ EXAMPLE
|
|
|
168
168
|
$ heroku data:mtls:create postgresql-sushi-12345
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
_See code: [src/commands/data/mtls/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
171
|
+
_See code: [src/commands/data/mtls/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/create.ts)_
|
|
172
172
|
|
|
173
173
|
## `heroku data:mtls:destroy [ADDON]`
|
|
174
174
|
|
|
@@ -188,7 +188,7 @@ EXAMPLE
|
|
|
188
188
|
$ heroku data:mtls:destroy postgresql-sushi-12345
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
_See code: [src/commands/data/mtls/destroy.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
191
|
+
_See code: [src/commands/data/mtls/destroy.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/destroy.ts)_
|
|
192
192
|
|
|
193
193
|
## `heroku data:mtls:ip-rules [ADDON]`
|
|
194
194
|
|
|
@@ -205,11 +205,11 @@ EXAMPLE
|
|
|
205
205
|
$ heroku data:mtls:ip-rules postgresql-sushi-12345
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
_See code: [src/commands/data/mtls/ip-rules/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
208
|
+
_See code: [src/commands/data/mtls/ip-rules/index.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/ip-rules/index.ts)_
|
|
209
209
|
|
|
210
210
|
## `heroku data:mtls:ip-rules:create [ADDON]`
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
create an IP Rule for your MTLS enabled addon
|
|
213
213
|
|
|
214
214
|
```
|
|
215
215
|
USAGE
|
|
@@ -224,7 +224,7 @@ EXAMPLE
|
|
|
224
224
|
$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr "1.2.3.4/32" --description "home IP address"
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
_See code: [src/commands/data/mtls/ip-rules/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
227
|
+
_See code: [src/commands/data/mtls/ip-rules/create.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/ip-rules/create.ts)_
|
|
228
228
|
|
|
229
229
|
## `heroku data:mtls:ip-rules:delete [ADDON]`
|
|
230
230
|
|
|
@@ -243,11 +243,11 @@ EXAMPLE
|
|
|
243
243
|
$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
_See code: [src/commands/data/mtls/ip-rules/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
246
|
+
_See code: [src/commands/data/mtls/ip-rules/delete.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/ip-rules/delete.ts)_
|
|
247
247
|
|
|
248
248
|
## `heroku data:mtls:ip-rules:get [ADDON]`
|
|
249
249
|
|
|
250
|
-
get
|
|
250
|
+
get a specific IP Rule for your MTLS enabled addon
|
|
251
251
|
|
|
252
252
|
```
|
|
253
253
|
USAGE
|
|
@@ -261,5 +261,5 @@ EXAMPLE
|
|
|
261
261
|
$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id "1862ec85-fdc1-47b3-924e-a91d26ca3a7c"
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
_See code: [src/commands/data/mtls/ip-rules/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.
|
|
264
|
+
_See code: [src/commands/data/mtls/ip-rules/get.ts](https://github.com/heroku/heroku-cli-plugin-mtls/blob/v0.8.1/src/commands/data/mtls/ip-rules/get.ts)_
|
|
265
265
|
<!-- commandsstop -->
|
|
@@ -18,7 +18,7 @@ class MTLSIPCreate extends base_1.default {
|
|
|
18
18
|
cli_ux_1.cli.styledObject(res);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
MTLSIPCreate.description = '
|
|
21
|
+
MTLSIPCreate.description = 'create an IP Rule for your MTLS enabled addon';
|
|
22
22
|
MTLSIPCreate.args = [
|
|
23
23
|
{ name: 'addon' }
|
|
24
24
|
];
|
|
@@ -12,7 +12,7 @@ class MTLSIPGet extends base_1.default {
|
|
|
12
12
|
cli_ux_1.cli.styledObject(res);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
MTLSIPGet.description = 'get
|
|
15
|
+
MTLSIPGet.description = 'get a specific IP Rule for your MTLS enabled addon';
|
|
16
16
|
MTLSIPGet.args = [
|
|
17
17
|
{ name: 'addon' }
|
|
18
18
|
];
|
package/lib/lib/fetcher.js
CHANGED
|
@@ -2,23 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_ux_1 = require("cli-ux");
|
|
4
4
|
async function default_1(heroku, addon_attachment, app) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
app,
|
|
9
|
-
addon: db
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
if (res.id === 'not_found') {
|
|
13
|
-
cli_ux_1.cli.error(res.message);
|
|
14
|
-
}
|
|
15
|
-
const filteredAddon = res.find((addon) => {
|
|
16
|
-
if (addon.addon_service) {
|
|
17
|
-
return addon.addon_service.name &&
|
|
18
|
-
(addon.addon_service.name.startsWith('heroku-postgresql') ||
|
|
19
|
-
addon.addon_service.name.startsWith('heroku-kafka'));
|
|
20
|
-
}
|
|
21
|
-
});
|
|
5
|
+
const filteredAddon = addon_attachment ?
|
|
6
|
+
await findAddonGivenAttachment(heroku, addon_attachment, app) :
|
|
7
|
+
await findAllAddons(heroku, app);
|
|
22
8
|
if (filteredAddon) {
|
|
23
9
|
if (filteredAddon.addon_service.name.startsWith('heroku-postgresql')) {
|
|
24
10
|
return {
|
|
@@ -36,8 +22,49 @@ async function default_1(heroku, addon_attachment, app) {
|
|
|
36
22
|
};
|
|
37
23
|
}
|
|
38
24
|
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = default_1;
|
|
27
|
+
async function findAllAddons(heroku, app) {
|
|
28
|
+
const { body: addon_list } = await heroku.get(`/apps/${app}/addons`);
|
|
29
|
+
let 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
|
+
});
|
|
36
|
+
if (filtered_list.length === 0) {
|
|
37
|
+
cli_ux_1.cli.error('No addons found');
|
|
38
|
+
}
|
|
39
|
+
else if (filtered_list.length === 1) {
|
|
40
|
+
return filtered_list[0];
|
|
41
|
+
}
|
|
39
42
|
else {
|
|
43
|
+
cli_ux_1.cli.error("No addon specified. Here's the list of addons:" + filtered_list.map((addon) => addon.name));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function findAddonGivenAttachment(heroku, addon_attachment, app) {
|
|
47
|
+
const db = addon_attachment;
|
|
48
|
+
const { body: res } = await heroku.post('/actions/addons/resolve', {
|
|
49
|
+
body: {
|
|
50
|
+
app,
|
|
51
|
+
addon: db
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
if (res.id === 'not_found') {
|
|
55
|
+
cli_ux_1.cli.error(res.message);
|
|
56
|
+
}
|
|
57
|
+
let addon = res.find((addon) => {
|
|
58
|
+
if (addon.addon_service) {
|
|
59
|
+
return addon.addon_service.name &&
|
|
60
|
+
(addon.addon_service.name.startsWith('heroku-postgresql') ||
|
|
61
|
+
addon.addon_service.name.startsWith('heroku-kafka'));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (!addon) {
|
|
40
65
|
cli_ux_1.cli.error('No addons found');
|
|
41
66
|
}
|
|
67
|
+
else {
|
|
68
|
+
return addon;
|
|
69
|
+
}
|
|
42
70
|
}
|
|
43
|
-
exports.default = default_1;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.8.
|
|
1
|
+
{"version":"0.8.1","commands":{"data:mtls:create":{"id":"data:mtls:create","description":"enable MTLS for your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:create postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:destroy":{"id":"data:mtls:destroy","description":"destroy MTLS configuration on your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":["data:mtls:delete"],"examples":["$ heroku data:mtls:destroy postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls":{"id":"data:mtls","description":"get the status of MTLS for your addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:create":{"id":"data:mtls:certificates:create","description":"create a new certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:create postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:delete":{"id":"data:mtls:certificates:delete","description":"delete a specific certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:delete postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of certificate","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates:download":{"id":"data:mtls:certificates:download","description":"download your certificate bundle for your mTLS addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f\"","$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f\" --dir \"./folder\"","$ heroku data:mtls:certificates:download postgresql-sushi-12345 --id \"3559a4df-2c82-4473-86cf-181310a6ef4f --prefix \"prefix_\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"dir":{"name":"dir","type":"option","description":"directory to download files to. defaults to HOME:/.postgresql","required":false},"id":{"name":"id","type":"option","description":"ID of certificate to download","required":false},"prefix":{"name":"prefix","type":"option","description":"prefix to put in front of downloaded file names","required":true,"default":""}},"args":[{"name":"addon"}]},"data:mtls:certificates:get":{"id":"data:mtls:certificates:get","description":"get a specific certificate for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:certificates:create postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of IP Rule","required":true}},"args":[{"name":"addon"}]},"data:mtls:certificates":{"id":"data:mtls:certificates","description":"get the certificates for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:create":{"id":"data:mtls:ip-rules:create","description":"create an IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:create postgresql-sushi-12345 --cidr \"1.2.3.4/32\" --description \"home IP address\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"cidr":{"name":"cidr","type":"option","required":true},"description":{"name":"description","type":"option","required":false}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:delete":{"id":"data:mtls:ip-rules:delete","description":"delete a specific IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:delete postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"cidr":{"name":"cidr","type":"option","description":"cidr of IP Rule"},"id":{"name":"id","type":"option","description":"id of IP Rule"}},"args":[{"name":"addon"}]},"data:mtls:ip-rules:get":{"id":"data:mtls:ip-rules:get","description":"get a specific IP Rule for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules:get postgresql-sushi-12345 --id \"1862ec85-fdc1-47b3-924e-a91d26ca3a7c\""],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true},"id":{"name":"id","type":"option","description":"id of IP Rule","required":true}},"args":[{"name":"addon"}]},"data:mtls:ip-rules":{"id":"data:mtls:ip-rules","description":"get the IP Rules for your MTLS enabled addon","pluginName":"@heroku-cli/plugin-mtls","pluginType":"core","aliases":[],"examples":["$ heroku data:mtls:ip-rules postgresql-sushi-12345"],"flags":{"app":{"name":"app","type":"option","char":"a","description":"app to run command against","required":true}},"args":[{"name":"addon"}]}}}
|
package/package.json
CHANGED