Add explicit usage to each command
The yargs framework combined with the pkg packaging causes the executable name to be mangled on installation. For this reason, the usage should be explicitly added to each command.
This commit is contained in:
parent
c2283bbff1
commit
f102a563e9
@ -44,14 +44,16 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('server <server> <key> <value>', 'Alter server parameters', function(yargs) {
|
||||
return yargs.epilog('To display the server parameters, execute `show server <server>`');
|
||||
return yargs.epilog('To display the server parameters, execute `show server <server>`')
|
||||
.usage('Usage: alter server <server> <key> <value>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return updateValue(host, 'servers/' + argv.server, 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
})
|
||||
})
|
||||
.command('monitor <monitor> <key> <value>', 'Alter monitor parameters', function(yargs) {
|
||||
return yargs.epilog('To display the monitor parameters, execute `show monitor <monitor>`');
|
||||
return yargs.epilog('To display the monitor parameters, execute `show monitor <monitor>`')
|
||||
.usage('Usage: alter monitor <monitor> <key> <value>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return updateValue(host, 'monitors/' + argv.monitor, 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
@ -59,14 +61,16 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('service <service> <key> <value>', 'Alter service parameters', function(yargs) {
|
||||
return yargs.epilog('To display the service parameters, execute `show service <service>`. ' +
|
||||
'The following list of parameters can be altered at runtime:\n\n' + JSON.stringify(service_params, null, 4));
|
||||
'The following list of parameters can be altered at runtime:\n\n' + JSON.stringify(service_params, null, 4))
|
||||
.usage('Usage: alter service <service> <key> <value>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return updateValue(host, 'services/' + argv.service, 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
})
|
||||
})
|
||||
.command('logging <key> <value>', 'Alter logging parameters', function(yargs) {
|
||||
return yargs.epilog('To display the logging parameters, execute `show logging`');
|
||||
return yargs.epilog('To display the logging parameters, execute `show logging`')
|
||||
.usage('Usage: alter logging <key> <value>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return updateValue(host, 'maxscale/logs', 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
@ -74,7 +78,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('maxscale <key> <value>', 'Alter MaxScale parameters', function(yargs) {
|
||||
return yargs.epilog('To display the MaxScale parameters, execute `show maxscale`. ' +
|
||||
'The following list of parameters can be altered at runtime:\n\n' + JSON.stringify(maxscale_params, null, 4));
|
||||
'The following list of parameters can be altered at runtime:\n\n' + JSON.stringify(maxscale_params, null, 4))
|
||||
.usage('Usage: alter maxscale <key> <value>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return updateValue(host, 'maxscale', 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
|
@ -18,7 +18,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('command <module> <command> [params...]', 'Call a module command', function(yargs) {
|
||||
return yargs.epilog('To inspect the list of module commands, execute `list commands`');
|
||||
return yargs.epilog('To inspect the list of module commands, execute `list commands`')
|
||||
.usage('Usage: call command <module> <command> [params...]')
|
||||
}, function(argv) {
|
||||
// First we have to find the correct method to use
|
||||
maxctrl(argv, function(host) {
|
||||
|
@ -18,7 +18,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('server <server> <state>', 'Clear server state', function(yargs) {
|
||||
return yargs.epilog('This command clears a server state set by the `set server <server> <state>` command');
|
||||
return yargs.epilog('This command clears a server state set by the `set server <server> <state>` command')
|
||||
.usage('Usage: clear server <server> <state>')
|
||||
}, function(argv) {
|
||||
var target = 'servers/' + argv.server + '/clear?state=' + argv.state
|
||||
maxctrl(argv, function(host) {
|
||||
|
@ -128,7 +128,8 @@ exports.builder = function(yargs) {
|
||||
.command('diff <target>', 'Show difference between host servers and <target>.', function(yargs) {
|
||||
return yargs.epilog('The list of host servers is controlled with the --hosts option. ' +
|
||||
'The target server should not be in the host list. Value of <target> ' +
|
||||
'must be in HOST:PORT format');
|
||||
'must be in HOST:PORT format')
|
||||
.usage('Usage: cluster diff <target>')
|
||||
}, function(argv) {
|
||||
|
||||
maxctrl(argv, function(host) {
|
||||
@ -182,7 +183,8 @@ exports.builder = function(yargs) {
|
||||
'command on that instance. Synchronization can be attempted again if a previous ' +
|
||||
'attempt failed due to a network failure or some other ephemeral error. Any other ' +
|
||||
'errors require manual synchronization of the MaxScale configuration files and a ' +
|
||||
'restart of the failed Maxscale.');
|
||||
'restart of the failed Maxscale.')
|
||||
.usage('Usage: cluster sync <target>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getDiffs(argv.target, host)
|
||||
|
@ -68,7 +68,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('The created server will not be used by any services or monitors ' +
|
||||
'unless the --services or --monitors options are given. The list ' +
|
||||
'of servers a service or a monitor uses can be altered with the ' +
|
||||
'`link` and `unlink` commands.');
|
||||
'`link` and `unlink` commands.')
|
||||
.usage('Usage: create server <name> <host> <port>')
|
||||
}, function(argv) {
|
||||
var server = {
|
||||
'data': {
|
||||
@ -124,7 +125,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('monitor <name> <module>', 'Create a new monitor', function(yargs) {
|
||||
return yargs.epilog('The list of servers given with the --servers option should not ' +
|
||||
'contain any servers that are already monitored by another monitor.');
|
||||
'contain any servers that are already monitored by another monitor.')
|
||||
.usage('Usage: create monitor <name> <module>')
|
||||
}, function(argv) {
|
||||
|
||||
var monitor = {
|
||||
@ -162,7 +164,8 @@ exports.builder = function(yargs) {
|
||||
default: '::'
|
||||
})
|
||||
.command('listener <service> <name> <port>', 'Create a new listener', function(yargs) {
|
||||
return yargs.epilog('The new listener will be taken into use immediately.');
|
||||
return yargs.epilog('The new listener will be taken into use immediately.')
|
||||
.usage('Usage: create listener <service> <name> <port>')
|
||||
}, function(argv) {
|
||||
|
||||
var listener = {
|
||||
@ -201,7 +204,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('The created user can be used with the MaxScale REST API as ' +
|
||||
'well as the MaxAdmin network interface. By default the created ' +
|
||||
'user will have read-only privileges. To make the user an ' +
|
||||
'administrative user, use the `--type=admin` option.');
|
||||
'administrative user, use the `--type=admin` option.')
|
||||
.usage('Usage: create user <name> <password>')
|
||||
}, function(argv) {
|
||||
|
||||
var user = {
|
||||
|
@ -18,14 +18,16 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('server <name>', 'Destroy an unused server', function(yargs) {
|
||||
return yargs.epilog('The server must be unlinked from all services and monitor before it can be destroyed.');
|
||||
return yargs.epilog('The server must be unlinked from all services and monitor before it can be destroyed.')
|
||||
.usage('Usage: destroy server <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'servers/' + argv.name, null, {method: 'DELETE'})
|
||||
})
|
||||
})
|
||||
.command('monitor <name>', 'Destroy an unused monitor', function(yargs) {
|
||||
return yargs.epilog('The monitor must be unlinked from all servers before it can be destroyed.');
|
||||
return yargs.epilog('The monitor must be unlinked from all servers before it can be destroyed.')
|
||||
.usage('Usage: destroy monitor <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'monitors/' + argv.name, null, {method: 'DELETE'})
|
||||
@ -36,7 +38,8 @@ exports.builder = function(yargs) {
|
||||
'Destroying a listener at runtime stops it from accepting new ' +
|
||||
'connections but it will still be bound to the listening socket. This ' +
|
||||
'means that new listeners cannot be created to replace destroyed listeners ' +
|
||||
'without restarting MaxScale.');
|
||||
'without restarting MaxScale.')
|
||||
.usage('Usage: destroy listener <service> <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'services/' + argv.service + '/listeners/' + argv.name, null, {method: 'DELETE'})
|
||||
@ -45,7 +48,8 @@ exports.builder = function(yargs) {
|
||||
.command('user <name>', 'Remove a network user', function(yargs) {
|
||||
return yargs.epilog('The last remaining administrative user cannot be removed. ' +
|
||||
'Create a replacement administrative user before attempting ' +
|
||||
'to remove the last administrative user.');
|
||||
'to remove the last administrative user.')
|
||||
.usage('Usage: destroy user <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'users/inet/' + argv.name, null, {method: 'DELETE'})
|
||||
|
@ -25,7 +25,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('log-priority <log>', 'Disable log priority [warning|notice|info|debug]', function(yargs) {
|
||||
return yargs.epilog('The `debug` log priority is only available for debug builds of MaxScale.');
|
||||
return yargs.epilog('The `debug` log priority is only available for debug builds of MaxScale.')
|
||||
.usage('Usage: disable log-priority <log>')
|
||||
}, function(argv) {
|
||||
if (log_levels.indexOf(argv.log) != -1) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -38,7 +39,8 @@ exports.builder = function(yargs) {
|
||||
}
|
||||
})
|
||||
.command('account <name>', 'Disable a Linux user account from administrative use', function(yargs) {
|
||||
return yargs.epilog('The Linux user accounts are used by the MaxAdmin UNIX Domain Socket interface');
|
||||
return yargs.epilog('The Linux user accounts are used by the MaxAdmin UNIX Domain Socket interface')
|
||||
.usage('Usage: disable account <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'users/unix/' + argv.name, null, { method: 'DELETE'})
|
||||
|
@ -25,7 +25,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('log-priority <log>', 'Enable log priority [warning|notice|info|debug]', function(yargs) {
|
||||
return yargs.epilog('The `debug` log priority is only available for debug builds of MaxScale.');
|
||||
return yargs.epilog('The `debug` log priority is only available for debug builds of MaxScale.')
|
||||
.usage('Usage: enable log-priority <log>')
|
||||
}, function(argv) {
|
||||
if (log_levels.indexOf(argv.log) != -1) {
|
||||
maxctrl(argv, function(host) {
|
||||
@ -45,7 +46,8 @@ exports.builder = function(yargs) {
|
||||
choices: ['admin', 'basic']
|
||||
})
|
||||
.command('account <name>', 'Activate a Linux user account for administrative use', function(yargs) {
|
||||
return yargs.epilog('The Linux user accounts are used by the MaxAdmin UNIX Domain Socket interface');
|
||||
return yargs.epilog('The Linux user accounts are used by the MaxAdmin UNIX Domain Socket interface')
|
||||
.usage('Usage: enable account <name>')
|
||||
}, function(argv) {
|
||||
var req_body = {
|
||||
data: {
|
||||
|
@ -41,14 +41,16 @@ exports.builder = function(yargs) {
|
||||
'linked to a service, it should be linked to a monitor so that ' +
|
||||
'the server state is up to date. Newly linked server are only ' +
|
||||
'available to new connections, existing connections will use the ' +
|
||||
'old list of servers.');
|
||||
'old list of servers.')
|
||||
.usage('Usage: link service <name> <server...>')
|
||||
}, function(argv) {
|
||||
addServer(argv, 'services/' + argv.name, argv.server)
|
||||
})
|
||||
.command('monitor <name> <server...>', 'Link servers to a monitor', function(yargs) {
|
||||
return yargs.epilog('Linking a server to a monitor will add it to the list of servers ' +
|
||||
'that are monitored by that monitor. A server can be monitored by ' +
|
||||
'only one monitor at a time.');
|
||||
'only one monitor at a time.')
|
||||
.usage('Usage: link monitor <name> <server...>')
|
||||
}, function(argv) {
|
||||
addServer(argv, 'monitors/' + argv.name, argv.server)
|
||||
})
|
||||
|
@ -19,7 +19,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('servers', 'List servers', function(yargs) {
|
||||
return yargs.epilog('List all servers in MaxScale.');
|
||||
return yargs.epilog('List all servers in MaxScale.')
|
||||
.usage('Usage: list servers')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'servers', [
|
||||
@ -32,7 +33,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('services', 'List services', function(yargs) {
|
||||
return yargs.epilog('List all services and the servers they use.');
|
||||
return yargs.epilog('List all services and the servers they use.')
|
||||
.usage('Usage: list services')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'services',[
|
||||
@ -45,7 +47,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('listeners <service>', 'List listeners of a service', function(yargs) {
|
||||
return yargs.epilog('List listeners for a service.');
|
||||
return yargs.epilog('List listeners for a service.')
|
||||
.usage('Usage: list listeners <service>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getSubCollection(host, 'services/' + argv.service, 'attributes.listeners', [
|
||||
@ -56,7 +59,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('monitors', 'List monitors', function(yargs) {
|
||||
return yargs.epilog('List all monitors in MaxScale.');
|
||||
return yargs.epilog('List all monitors in MaxScale.')
|
||||
.usage('Usage: list monitors')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'monitors', [
|
||||
@ -67,7 +71,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('sessions', 'List sessions', function(yargs) {
|
||||
return yargs.epilog('List all client sessions.');
|
||||
return yargs.epilog('List all client sessions.')
|
||||
.usage('Usage: list sessions')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'sessions',[
|
||||
@ -79,7 +84,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('filters', 'List filters', function(yargs) {
|
||||
return yargs.epilog('List all filters in MaxScale.');
|
||||
return yargs.epilog('List all filters in MaxScale.')
|
||||
.usage('Usage: list filters')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'filters', [
|
||||
@ -90,7 +96,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('modules', 'List loaded modules', function(yargs) {
|
||||
return yargs.epilog('List all currently loaded modules.');
|
||||
return yargs.epilog('List all currently loaded modules.')
|
||||
.usage('Usage: list modules')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'maxscale/modules',[
|
||||
@ -101,7 +108,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('users', 'List created network users', function(yargs) {
|
||||
return yargs.epilog('List the users that can be used to connect to the MaxScale REST API.');
|
||||
return yargs.epilog('List the users that can be used to connect to the MaxScale REST API.')
|
||||
.usage('Usage: list users')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'users/inet',[
|
||||
@ -110,7 +118,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('commands', 'List module commands', function(yargs) {
|
||||
return yargs.epilog('List all available module commands.');
|
||||
return yargs.epilog('List all available module commands.')
|
||||
.usage('Usage: list commands')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getCollection(host, 'maxscale/modules',[
|
||||
|
@ -18,7 +18,8 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('logs', 'Rotate log files by closing and reopening the files', function(yargs) {
|
||||
return yargs.epilog('This command is intended to be used with the `logrotate` command.');
|
||||
return yargs.epilog('This command is intended to be used with the `logrotate` command.')
|
||||
.usage('Usage: rotate logs')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host){
|
||||
return doRequest(host, 'maxscale/logs/flush/', null, {method: 'POST'})
|
||||
|
@ -23,7 +23,8 @@ exports.builder = function(yargs) {
|
||||
'Any other states will be overridden by the monitor on the next ' +
|
||||
'monitoring interval. To manually control server states, use the ' +
|
||||
'`stop monitor <name>` command to stop the monitor before setting ' +
|
||||
'the server states manually.');
|
||||
'the server states manually.')
|
||||
.usage('Usage: set server <server> <state>')
|
||||
}, function(argv) {
|
||||
var target = 'servers/' + argv.server + '/set?state=' + argv.state
|
||||
maxctrl(argv, function(host) {
|
||||
|
@ -22,7 +22,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a server. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'server. See `help alter server` for more details about altering ' +
|
||||
'server parameters.');
|
||||
'server parameters.')
|
||||
.usage('Usage: show server <server>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'servers/' + argv.server, [
|
||||
@ -44,7 +45,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a service. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'service. See `help alter service` for more details about altering ' +
|
||||
'service parameters.');
|
||||
'service parameters.')
|
||||
.usage('Usage: show service <service>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'services/' + argv.service, [
|
||||
@ -64,7 +66,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a monitor. The `Parameters` ' +
|
||||
'field contains the currently configured parameters for this ' +
|
||||
'monitor. See `help alter monitor` for more details about altering ' +
|
||||
'monitor parameters.');
|
||||
'monitor parameters.')
|
||||
.usage('Usage: show monitor <monitor>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'monitors/' + argv.monitor, [
|
||||
@ -80,7 +83,8 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('Show detailed information about a single session. ' +
|
||||
'The list of sessions can be retrieved with the ' +
|
||||
'`list sessions` command. The <session> is the session ' +
|
||||
'ID of a particular session.');
|
||||
'ID of a particular session.')
|
||||
.usage('Usage: show session <session>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'sessions/' + argv.session, [
|
||||
@ -95,7 +99,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
})
|
||||
.command('filter <filter>', 'Show filter', function(yargs) {
|
||||
return yargs.epilog('The list of services that use this filter is show in the `Services` field.');
|
||||
return yargs.epilog('The list of services that use this filter is show in the `Services` field.')
|
||||
.usage('Usage: show filter <filter>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'filters/' + argv.filter, [
|
||||
@ -108,7 +113,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('module <module>', 'Show loaded module', function(yargs) {
|
||||
return yargs.epilog('This command shows all available parameters as well as ' +
|
||||
'detailed version information of a loaded module.');
|
||||
'detailed version information of a loaded module.')
|
||||
.usage('Usage: show module <module>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'maxscale/modules/' + argv.module, [
|
||||
@ -124,7 +130,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('maxscale', 'Show MaxScale information', function(yargs) {
|
||||
return yargs.epilog('See `help alter maxscale` for more details about altering ' +
|
||||
'MaxScale parameters.');
|
||||
'MaxScale parameters.')
|
||||
.usage('Usage: show maxscale')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'maxscale', [
|
||||
@ -138,7 +145,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('logging', 'Show MaxScale logging information', function(yargs) {
|
||||
return yargs.epilog('See `help alter logging` for more details about altering ' +
|
||||
'logging parameters.');
|
||||
'logging parameters.')
|
||||
.usage('Usage: show logging')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getResource(host, 'maxscale/logs', [
|
||||
@ -150,7 +158,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('commands <module>', 'Show module commands of a module', function(yargs) {
|
||||
return yargs.epilog('This command shows the parameters the command expects with ' +
|
||||
'the parameter descriptions.');
|
||||
'the parameter descriptions.')
|
||||
.usage('Usage: show commands <module>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return getSubCollection(host, 'maxscale/modules/' + argv.module, 'attributes.commands', [
|
||||
|
@ -18,14 +18,16 @@ exports.handler = function() {}
|
||||
exports.builder = function(yargs) {
|
||||
yargs
|
||||
.command('service <name>', 'Start a service', function(yargs) {
|
||||
return yargs.epilog('This starts a service stopped by `stop service <name>`');
|
||||
return yargs.epilog('This starts a service stopped by `stop service <name>`')
|
||||
.usage('Usage: start service <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'services/' + argv.name + '/start', null, {method: 'PUT'})
|
||||
})
|
||||
})
|
||||
.command('monitor <name>', 'Start a monitor', function(yargs) {
|
||||
return yargs.epilog('This starts a monitor stopped by `stop monitor <name>`');
|
||||
return yargs.epilog('This starts a monitor stopped by `stop monitor <name>`')
|
||||
.usage('Usage: start monitor <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'monitors/' + argv.name + '/start', null, {method: 'PUT'})
|
||||
@ -33,7 +35,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('maxscale', 'Start MaxScale by starting all services', function(yargs) {
|
||||
return yargs.epilog('This command will execute the `start service` command for ' +
|
||||
'all services in MaxScale.');
|
||||
'all services in MaxScale.')
|
||||
.usage('Usage: start maxscale')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'services/', function(res) {
|
||||
|
@ -20,7 +20,8 @@ exports.builder = function(yargs) {
|
||||
.command('service <name>', 'Stop a service', function(yargs) {
|
||||
return yargs.epilog('Stopping a service will prevent all the listeners for that service ' +
|
||||
'from accepting new connections. Existing connections will still be ' +
|
||||
'handled normally until they are closed.');
|
||||
'handled normally until they are closed.')
|
||||
.usage('Usage: stop service <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'services/' + argv.name + '/stop', null, {method: 'PUT'})
|
||||
@ -29,7 +30,8 @@ exports.builder = function(yargs) {
|
||||
.command('monitor <name>', 'Stop a monitor', function(yargs) {
|
||||
return yargs.epilog('Stopping a monitor will pause the monitoring of the servers. ' +
|
||||
'This can be used to manually control server states with the ' +
|
||||
'`set server` command.');
|
||||
'`set server` command.')
|
||||
.usage('Usage: stop monitor <name>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'monitors/' + argv.name + '/stop', null, {method: 'PUT'})
|
||||
@ -37,7 +39,8 @@ exports.builder = function(yargs) {
|
||||
})
|
||||
.command('maxscale', 'Stop MaxScale by stopping all services', function(yargs) {
|
||||
return yargs.epilog('This command will execute the `stop service` command for ' +
|
||||
'all services in MaxScale.');
|
||||
'all services in MaxScale.')
|
||||
.usage('Usage: stop maxscale')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return doRequest(host, 'services/', function(res) {
|
||||
|
@ -39,14 +39,16 @@ exports.builder = function(yargs) {
|
||||
return yargs.epilog('This command unlinks servers from a service, removing them from ' +
|
||||
'the list of available servers for that service. New connections to ' +
|
||||
'the service will not use the unlinked servers but existing ' +
|
||||
'connections can still use the servers.');
|
||||
'connections can still use the servers.')
|
||||
.usage('Usage: unlink service <name> <server...>')
|
||||
}, function(argv) {
|
||||
removeServer(argv, 'services/' + argv.name, argv.server)
|
||||
})
|
||||
.command('monitor <name> <server...>', 'Unlink servers from a monitor', function(yargs) {
|
||||
return yargs.epilog('This command unlinks servers from a monitor, removing them from ' +
|
||||
'the list of monitored servers. The servers will be left in their ' +
|
||||
'current state when they are unlinked from a monitor.');
|
||||
'current state when they are unlinked from a monitor.')
|
||||
.usage('Usage: unlink monitor <name> <server...>')
|
||||
}, function(argv) {
|
||||
removeServer(argv, 'monitors/' + argv.name, argv.server)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user