2015-11-04 01:40:59 +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/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2015 Joyent, Inc.
|
|
|
|
*
|
|
|
|
* `triton rbac ...`
|
|
|
|
*/
|
|
|
|
|
|
|
|
var Cmdln = require('cmdln').Cmdln;
|
|
|
|
var util = require('util');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---- CLI class
|
|
|
|
|
|
|
|
function RbacCLI(top) {
|
|
|
|
this.top = top;
|
|
|
|
Cmdln.call(this, {
|
|
|
|
name: top.name + ' rbac',
|
|
|
|
/* BEGIN JSSTYLED */
|
2015-11-18 22:54:44 +02:00
|
|
|
desc: [
|
|
|
|
'Role-based Access Control (RBAC) commands.',
|
|
|
|
'See <https://docs.joyent.com/public-cloud/rbac> for a general start.',
|
|
|
|
'**Warning: `triton rbac ...` is experimental, not well tested and in flux.**'
|
|
|
|
].join('\n'),
|
2015-11-04 01:40:59 +02:00
|
|
|
/* END JSSTYLED */
|
|
|
|
helpOpts: {
|
|
|
|
minHelpCol: 24 /* line up with option help */
|
2015-11-10 01:09:37 +02:00
|
|
|
},
|
|
|
|
helpSubcmds: [
|
|
|
|
'help',
|
|
|
|
'info',
|
2015-11-18 22:54:44 +02:00
|
|
|
'apply',
|
2015-11-10 01:09:37 +02:00
|
|
|
{ group: 'RBAC Resources' },
|
|
|
|
'users',
|
|
|
|
'user',
|
|
|
|
'keys',
|
|
|
|
'key',
|
|
|
|
'policies',
|
|
|
|
'policy',
|
|
|
|
'roles',
|
|
|
|
'role',
|
|
|
|
{ group: 'Role Tags' },
|
2015-11-13 02:04:12 +02:00
|
|
|
'instance-role-tags',
|
2015-11-13 02:13:23 +02:00
|
|
|
'image-role-tags',
|
|
|
|
'network-role-tags',
|
|
|
|
'package-role-tags'
|
2015-11-10 01:09:37 +02:00
|
|
|
]
|
2015-11-04 01:40:59 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
util.inherits(RbacCLI, Cmdln);
|
|
|
|
|
|
|
|
RbacCLI.hidden = true;
|
|
|
|
|
|
|
|
RbacCLI.prototype.init = function init(opts, args, cb) {
|
|
|
|
this.log = this.top.log;
|
|
|
|
Cmdln.prototype.init.apply(this, arguments);
|
|
|
|
};
|
|
|
|
|
2015-11-10 01:09:37 +02:00
|
|
|
RbacCLI.prototype.do_info = require('./do_info');
|
2015-11-18 22:54:44 +02:00
|
|
|
RbacCLI.prototype.do_apply = require('./do_apply');
|
2015-11-04 01:40:59 +02:00
|
|
|
|
|
|
|
RbacCLI.prototype.do_users = require('./do_users');
|
|
|
|
RbacCLI.prototype.do_user = require('./do_user');
|
2015-11-10 01:09:37 +02:00
|
|
|
RbacCLI.prototype.do_keys = require('./do_keys');
|
|
|
|
RbacCLI.prototype.do_key = require('./do_key');
|
2015-11-05 22:30:06 +02:00
|
|
|
RbacCLI.prototype.do_policies = require('./do_policies');
|
|
|
|
RbacCLI.prototype.do_policy = require('./do_policy');
|
2015-11-10 01:09:37 +02:00
|
|
|
RbacCLI.prototype.do_roles = require('./do_roles');
|
|
|
|
RbacCLI.prototype.do_role = require('./do_role');
|
2015-11-05 22:30:06 +02:00
|
|
|
|
2015-11-10 01:09:37 +02:00
|
|
|
var doRoleTags = require('./do_role_tags');
|
|
|
|
RbacCLI.prototype.do_instance_role_tags = doRoleTags.do_instance_role_tags;
|
2015-11-13 02:13:23 +02:00
|
|
|
RbacCLI.prototype.do_image_role_tags = doRoleTags.do_image_role_tags;
|
|
|
|
RbacCLI.prototype.do_network_role_tags = doRoleTags.do_network_role_tags;
|
|
|
|
RbacCLI.prototype.do_package_role_tags = doRoleTags.do_package_role_tags;
|
|
|
|
RbacCLI.prototype.do_role_tags = doRoleTags.do_role_tags;
|
2015-11-06 01:13:14 +02:00
|
|
|
|
2015-11-04 01:40:59 +02:00
|
|
|
module.exports = RbacCLI;
|