2016-01-04 19:05:53 +02:00
|
|
|
/*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2018-02-23 15:16:23 +02:00
|
|
|
* Copyright 2018 Joyent, Inc.
|
2016-01-04 19:05:53 +02:00
|
|
|
*
|
|
|
|
* `triton instance ...`
|
|
|
|
*/
|
|
|
|
|
|
|
|
var Cmdln = require('cmdln').Cmdln;
|
|
|
|
var util = require('util');
|
|
|
|
|
|
|
|
|
|
|
|
// ---- CLI class
|
|
|
|
|
|
|
|
function InstanceCLI(top) {
|
|
|
|
this.top = top;
|
|
|
|
Cmdln.call(this, {
|
|
|
|
name: top.name + ' instance',
|
|
|
|
/* BEGIN JSSTYLED */
|
|
|
|
desc: [
|
2018-02-10 20:17:02 +02:00
|
|
|
'List and manage Spearhead instances.'
|
2016-01-04 19:05:53 +02:00
|
|
|
].join('\n'),
|
|
|
|
/* END JSSTYLED */
|
|
|
|
helpOpts: {
|
|
|
|
minHelpCol: 24 /* line up with option help */
|
|
|
|
},
|
|
|
|
helpSubcmds: [
|
|
|
|
'help',
|
|
|
|
'list',
|
|
|
|
'get',
|
|
|
|
'create',
|
2016-01-04 23:08:16 +02:00
|
|
|
'delete',
|
2017-02-17 03:00:32 +02:00
|
|
|
'resize',
|
2016-11-01 06:54:07 +02:00
|
|
|
'rename',
|
2016-01-04 23:08:16 +02:00
|
|
|
{ group: '' },
|
|
|
|
'start',
|
|
|
|
'stop',
|
|
|
|
'reboot',
|
|
|
|
{ group: '' },
|
2016-03-11 21:24:44 +02:00
|
|
|
'fwrules',
|
2016-03-11 16:07:11 +02:00
|
|
|
'enable-firewall',
|
|
|
|
'disable-firewall',
|
|
|
|
{ group: '' },
|
2018-02-23 15:16:23 +02:00
|
|
|
'enable-deletion-protection',
|
|
|
|
'disable-deletion-protection',
|
|
|
|
{ group: '' },
|
2016-01-04 23:08:16 +02:00
|
|
|
'ssh',
|
2016-03-12 01:21:19 +02:00
|
|
|
'ip',
|
2016-01-04 23:08:16 +02:00
|
|
|
'wait',
|
2016-02-09 22:23:55 +02:00
|
|
|
'audit',
|
2018-03-06 00:04:36 +02:00
|
|
|
'nic',
|
2016-02-04 15:39:50 +02:00
|
|
|
'snapshot',
|
2016-02-09 22:23:55 +02:00
|
|
|
'tag'
|
2016-01-04 19:05:53 +02:00
|
|
|
]
|
|
|
|
});
|
|
|
|
}
|
|
|
|
util.inherits(InstanceCLI, Cmdln);
|
|
|
|
|
|
|
|
InstanceCLI.prototype.init = function init(opts, args, cb) {
|
|
|
|
this.log = this.top.log;
|
|
|
|
Cmdln.prototype.init.apply(this, arguments);
|
|
|
|
};
|
|
|
|
|
|
|
|
InstanceCLI.prototype.do_list = require('./do_list');
|
|
|
|
InstanceCLI.prototype.do_get = require('./do_get');
|
|
|
|
InstanceCLI.prototype.do_create = require('./do_create');
|
2016-01-10 02:55:12 +02:00
|
|
|
InstanceCLI.prototype.do_delete = require('./do_delete');
|
2017-02-17 03:00:32 +02:00
|
|
|
InstanceCLI.prototype.do_resize = require('./do_resize');
|
2016-11-01 06:54:07 +02:00
|
|
|
InstanceCLI.prototype.do_rename = require('./do_rename');
|
2016-01-04 23:08:16 +02:00
|
|
|
|
2016-01-10 02:55:12 +02:00
|
|
|
InstanceCLI.prototype.do_start = require('./do_start');
|
|
|
|
InstanceCLI.prototype.do_stop = require('./do_stop');
|
|
|
|
InstanceCLI.prototype.do_reboot = require('./do_reboot');
|
2016-01-04 19:05:53 +02:00
|
|
|
|
2016-12-21 06:22:23 +02:00
|
|
|
InstanceCLI.prototype.do_fwrule = require('./do_fwrule');
|
2016-03-11 21:24:44 +02:00
|
|
|
InstanceCLI.prototype.do_fwrules = require('./do_fwrules');
|
2016-03-11 16:07:11 +02:00
|
|
|
InstanceCLI.prototype.do_enable_firewall = require('./do_enable_firewall');
|
|
|
|
InstanceCLI.prototype.do_disable_firewall = require('./do_disable_firewall');
|
|
|
|
|
2018-02-23 15:16:23 +02:00
|
|
|
InstanceCLI.prototype.do_enable_deletion_protection =
|
|
|
|
require('./do_enable_deletion_protection');
|
|
|
|
InstanceCLI.prototype.do_disable_deletion_protection =
|
|
|
|
require('./do_disable_deletion_protection');
|
|
|
|
|
2016-01-04 23:08:16 +02:00
|
|
|
InstanceCLI.prototype.do_ssh = require('./do_ssh');
|
2016-03-12 01:21:19 +02:00
|
|
|
InstanceCLI.prototype.do_ip = require('./do_ip');
|
2016-01-04 23:08:16 +02:00
|
|
|
InstanceCLI.prototype.do_wait = require('./do_wait');
|
|
|
|
InstanceCLI.prototype.do_audit = require('./do_audit');
|
2018-03-06 00:04:36 +02:00
|
|
|
InstanceCLI.prototype.do_nic = require('./do_nic');
|
2016-02-04 15:39:50 +02:00
|
|
|
InstanceCLI.prototype.do_snapshot = require('./do_snapshot');
|
|
|
|
InstanceCLI.prototype.do_snapshots = require('./do_snapshots');
|
2016-02-09 22:23:55 +02:00
|
|
|
InstanceCLI.prototype.do_tag = require('./do_tag');
|
|
|
|
InstanceCLI.prototype.do_tags = require('./do_tags');
|
2016-01-04 19:05:53 +02:00
|
|
|
|
|
|
|
InstanceCLI.aliases = ['inst'];
|
|
|
|
|
|
|
|
module.exports = InstanceCLI;
|