@heroku/skynet 1.12.0 → 1.14.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.
@@ -13,6 +13,7 @@ async function run (context) {
13
13
  const notes = context.flags.notes
14
14
  const category = context.flags.category
15
15
  const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
16
+ const deprovision = context.flags.deprovision
16
17
 
17
18
  if (app && file) {
18
19
  throw new Error('Either --app or --infile must be passed, but not both')
@@ -23,7 +24,7 @@ async function run (context) {
23
24
  const chunks = utils.arrayChunks(apps, chunkSize)
24
25
  for (const chunk of chunks) {
25
26
  cli.log('Suspending app owners: ' + chunk.join())
26
- const response = await skynet.bulkSuspendAppOwner(apps.join(), notes, category)
27
+ const response = await skynet.bulkSuspendAppOwner(apps.join(), notes, category, deprovision)
27
28
  cli.log(`${cli.color.cyan(response.status)}. ${response.message}`)
28
29
  cli.log()
29
30
  }
@@ -32,8 +33,8 @@ async function run (context) {
32
33
  throw new Error('Required flag: --owner OWNER or --infile FILE')
33
34
  }
34
35
 
35
- let response = await cli.action(`Deprovisioning app owner of ${cli.color.cyan(app)}`,
36
- skynet.suspendAppOwner(app, notes, category, force))
36
+ let response = await cli.action(`Suspending app owner of ${cli.color.cyan(app)}`,
37
+ skynet.suspendAppOwner(app, notes, category, force, deprovision))
37
38
  response = JSON.parse(response)
38
39
  cli.log(`${cli.color.cyan(response.status)}. ${response.message}`)
39
40
  }
@@ -50,7 +51,8 @@ module.exports = {
50
51
  { name: 'infile', char: 'i', description: 'file of apps that require owner suspension', hasValue: true },
51
52
  { name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
52
53
  { name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
53
- { name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false }
54
+ { name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
55
+ { name: 'deprovision', char: 'd', description: 'put user into the fast resource deletion flow', hasValue: false, required: false }
54
56
  ],
55
57
  run: command(run)
56
58
  }
@@ -22,6 +22,7 @@ async function run (context) {
22
22
  const category = context.flags.category
23
23
  const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
24
24
  const unverify = context.flags.unverify
25
+ const deprovision = context.flags.deprovision
25
26
 
26
27
  const notify = notifyOption.set(context.flags.notify, context.flags['no-notify'])
27
28
  const notificationStatus = (notify) ? 'enabled' : 'disabled'
@@ -35,7 +36,7 @@ async function run (context) {
35
36
  const chunks = utils.arrayChunks(users, chunkSize)
36
37
  for (const chunk of chunks) {
37
38
  cli.log('Suspending users: ' + chunk.join())
38
- const response = await skynet.bulkSuspendUsers(chunk.join(), notes, category, notify, force)
39
+ const response = await skynet.bulkSuspendUsers(chunk.join(), notes, category, notify, force, deprovision)
39
40
  cli.log(`${response}. Notification ${notificationStatus}`)
40
41
  cli.log()
41
42
  }
@@ -48,7 +49,7 @@ async function run (context) {
48
49
  throw new Error('Required flag: --user USER or --infile FILE')
49
50
  }
50
51
 
51
- let response = await skynet.suspendUser(user, notes, category, notify, force)
52
+ let response = await skynet.suspendUser(user, notes, category, notify, force, deprovision)
52
53
  response = JSON.parse(response)
53
54
  cli.log(`Suspending user ${user}...\n${response.status}. ${response.message}. Notification ${notificationStatus}`)
54
55
 
@@ -72,7 +73,8 @@ module.exports = {
72
73
  { name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
73
74
  { name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false },
74
75
  { name: 'notify', description: 'send user suspension email notification', hasValue: false, required: false },
75
- { name: 'unverify', description: 'unverifies a user account, removes all billing info', hasValue: false, required: false }
76
+ { name: 'unverify', description: 'unverifies a user account, removes all billing info', hasValue: false, required: false },
77
+ { name: 'deprovision', char: 'd', description: 'put user into the fast resource deletion flow', hasValue: false, required: false }
76
78
  ],
77
79
  run: command(run)
78
80
  }
package/lib/skynet.js CHANGED
@@ -33,13 +33,12 @@ module.exports = class SkynetAPI {
33
33
  }
34
34
 
35
35
  addCategory (name, description) {
36
- const body = {
37
- category: name,
38
- description: description
39
- }
40
36
  return this.request('/categories', {
41
37
  method: 'POST',
42
- form: body
38
+ json: {
39
+ category: name,
40
+ description: description
41
+ }
43
42
  })
44
43
  }
45
44
 
@@ -98,13 +97,14 @@ module.exports = class SkynetAPI {
98
97
  })
99
98
  }
100
99
 
101
- suspendAppOwner (app, notes, category, force = false) {
100
+ suspendAppOwner (app, notes, category, force = false, deprovision = false) {
102
101
  const body = {
103
102
  value: app,
104
103
  reason: notes,
105
104
  method: 'skynet-cli',
106
105
  category: category,
107
- force: force
106
+ force: force,
107
+ deprovision: deprovision
108
108
  }
109
109
 
110
110
  return this.request('/suspend/app-owner', {
@@ -135,14 +135,15 @@ module.exports = class SkynetAPI {
135
135
  })
136
136
  }
137
137
 
138
- suspendUser (user, notes, category, notify, force = false) {
138
+ suspendUser (user, notes, category, notify, force = false, deprovision = false) {
139
139
  const body = {
140
140
  value: user,
141
141
  reason: notes,
142
142
  method: 'skynet-cli',
143
143
  category: category,
144
144
  force: force,
145
- notify: notify
145
+ notify: notify,
146
+ deprovision: deprovision
146
147
  }
147
148
 
148
149
  return this.request('/suspend/user', {
@@ -158,7 +159,7 @@ module.exports = class SkynetAPI {
158
159
  })
159
160
  }
160
161
 
161
- bulkSuspendUsers (users, notes, category, notify, force = false) {
162
+ bulkSuspendUsers (users, notes, category, notify, force = false, deprovision = false) {
162
163
  const body = {
163
164
  value: users,
164
165
  reason: notes,
@@ -166,7 +167,8 @@ module.exports = class SkynetAPI {
166
167
  category: category,
167
168
  bulk: 'true',
168
169
  force: force,
169
- notify: notify
170
+ notify: notify,
171
+ deprovision: deprovision
170
172
  }
171
173
 
172
174
  return this.request('/suspend/user', {
@@ -175,13 +177,14 @@ module.exports = class SkynetAPI {
175
177
  })
176
178
  }
177
179
 
178
- bulkSuspendAppOwner (apps, notes, category) {
180
+ bulkSuspendAppOwner (apps, notes, category, deprovision = false) {
179
181
  const body = {
180
182
  value: apps,
181
183
  reason: notes,
182
184
  method: 'skynet-cli',
183
185
  category: category,
184
- bulk: 'true'
186
+ bulk: 'true',
187
+ deprovision: deprovision
185
188
  }
186
189
 
187
190
  return this.request('/suspend/app-owner', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/skynet",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "description": "use Skynet from Heroku CLI",
5
5
  "main": "index.js",
6
6
  "author": "Bob Argenbright @byt3smith",