`triton create ... --firewall` for CreateMachine `firewall_enabled`

Fixes #49
This commit is contained in:
Trent Mick 2015-10-17 12:43:24 -07:00
parent 78f7d3c72e
commit da447939d2
2 changed files with 17 additions and 3 deletions

View File

@ -2,7 +2,8 @@
## 2.1.4 (not yet released)
(nothing yet)
- #49: `triton create ... --firewall` to enable [Cloud
Firewall](https://docs.joyent.com/public-cloud/network/firewall).
## 2.1.3

View File

@ -88,13 +88,20 @@ function do_create_instance(subcmd, opts, args, callback) {
function (net) { return net.id; })
};
for (var i = 0; i < opts._order.length; i++) {
var opt = opts._order[i];
if (opt.key === 'firewall') {
createOpts.firewall_enabled = opt.value;
}
}
log.trace({dryRun: opts.dry_run, createOpts: createOpts},
'create-instance createOpts');
ctx.start = Date.now();
if (opts.dry_run) {
ctx.inst = {
id: 'beefbeef-4c0e-11e5-86cd-a7fd38d2a50b',
name: 'm00'
name: 'this-is-a-dry-run'
};
console.log('Creating instance %s (%s, %s@%s)',
ctx.inst.name, ctx.inst.id,
@ -183,13 +190,19 @@ do_create_instance.options = [
type: 'string',
help: 'Instance name. If not given, a random one will be created.'
},
{
// TODO: add boolNegationPrefix:'no-' when that cmdln pull is in
names: ['firewall'],
type: 'bool',
help: 'Enable Cloud Firewall on this instance. See ' +
'<https://docs.joyent.com/public-cloud/network/firewall>'
},
// XXX arrayOfCommaSepString dashdash type
//{
// names: ['networks', 'nets'],
// type: 'arrayOfCommaSepString',
// help: 'One or more (comma-separated) networks IDs.'
//},
// XXX enable-firewall
// XXX locality: near, far
// XXX metadata, metadata-file
// XXX script (user-script)