@heroku/skynet 1.6.20 → 1.7.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/commands/deprovision.js +1 -1
- package/commands/suspensions.js +1 -1
- package/commands/whitelists.js +30 -0
- package/index.js +1 -0
- package/lib/skynet.js +9 -0
- package/package.json +1 -1
package/commands/deprovision.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
help: `Examples:
|
|
32
32
|
$ heroku skynet:deprovision -u foo@bar.com -n "helpful suspend message" -c "spam"`,
|
|
33
33
|
flags: [
|
|
34
|
-
{ name: 'user', char: 'u', description: 'user to deprovision', hasValue: true
|
|
34
|
+
{ name: 'user', char: 'u', description: 'user to deprovision', hasValue: true },
|
|
35
35
|
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
36
36
|
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
37
37
|
{ name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false },
|
package/commands/suspensions.js
CHANGED
|
@@ -14,7 +14,7 @@ async function run (context) {
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
topic: 'skynet',
|
|
16
16
|
command: 'suspensions',
|
|
17
|
-
description: '(requires sudo)
|
|
17
|
+
description: '(requires sudo) suspension history of the given user account',
|
|
18
18
|
help: `Examples:
|
|
19
19
|
$ heroku skynet:suspensions -a [user account]`,
|
|
20
20
|
flags: [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const cli = require('heroku-cli-util')
|
|
2
|
+
const command = require('../lib/command')
|
|
3
|
+
const SkynetAPI = require('../lib/skynet')
|
|
4
|
+
|
|
5
|
+
async function run (context) {
|
|
6
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
+
let response = await skynet.whitelists()
|
|
8
|
+
response = JSON.parse(response)
|
|
9
|
+
if (Object.keys(response).length > 0) {
|
|
10
|
+
cli.table(response, {
|
|
11
|
+
columns: [
|
|
12
|
+
{ key: 'Value' },
|
|
13
|
+
{ key: 'Notes' },
|
|
14
|
+
{ key: 'CreatedAt' },
|
|
15
|
+
{ key: 'UpdatedAt' },
|
|
16
|
+
{ key: 'DeletedAt' }
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
topic: 'skynet',
|
|
24
|
+
command: 'whitelists',
|
|
25
|
+
description: 'whitelists used by skynet',
|
|
26
|
+
help: `Examples:
|
|
27
|
+
$ heroku skynet:whitelists`,
|
|
28
|
+
flags: [],
|
|
29
|
+
run: command(run)
|
|
30
|
+
}
|
package/index.js
CHANGED
package/lib/skynet.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const got = require('got')
|
|
2
2
|
let skynetHost = 'https://skynet.herokai.com'
|
|
3
3
|
|
|
4
|
+
// If test against local skynet environment, change shynet host to localhost:5000
|
|
5
|
+
// let skynetHost = 'http://localhost:5000'
|
|
6
|
+
|
|
4
7
|
if (process.env.SKYNET_HOST) {
|
|
5
8
|
skynetHost = process.env.SKYNET_HOST
|
|
6
9
|
}
|
|
@@ -29,6 +32,12 @@ module.exports = class SkynetAPI {
|
|
|
29
32
|
})
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
whitelists () {
|
|
36
|
+
return this.request('/whitelist', {
|
|
37
|
+
method: 'GET'
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
addWhitelist (appOrUserEmail, notes) {
|
|
33
42
|
var body = {
|
|
34
43
|
value: appOrUserEmail,
|