UNPKG

1.16 kBJavaScriptView Raw
1'use strict'
2
3let cli = require('heroku-cli-util')
4let co = require('co')
5
6function * run (context, heroku) {
7 let lib = require('../../lib/peering')(heroku)
8 let space = context.flags.space || context.args.space
9 if (!space) throw new Error('Space name required.\nUSAGE: heroku spaces:peerings:accept pcx-12345678 --space my-space')
10 let pcxID = context.flags.pcxid || context.args.pcxid
11 yield lib.acceptPeeringRequest(space, pcxID)
12 cli.log(`Accepting and configuring peering connection ${cli.color.cyan.bold(pcxID)}`)
13}
14
15module.exports = {
16 topic: 'spaces',
17 command: 'peerings:accept',
18 description: 'accepts a pending peering request for a private space',
19 help: `Example:
20
21 $ heroku spaces:peerings:accept pcx-4bd27022 --space example-space
22 Accepting and configuring peering connection pcx-4bd27022
23 `,
24 needsApp: false,
25 needsAuth: true,
26 args: [{name: 'pcxid', optional: true, hidden: true}],
27 flags: [
28 {name: 'pcxid', char: 'p', hasValue: true, description: 'PCX ID of a pending peering'},
29 {name: 'space', char: 's', hasValue: true, description: 'space to get peering info from'}
30 ],
31 run: cli.command(co.wrap(run))
32}