diff --git a/client/maxctrl/lib/clear.js b/client/maxctrl/lib/clear.js new file mode 100644 index 000000000..dd213e313 --- /dev/null +++ b/client/maxctrl/lib/clear.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 MariaDB Corporation Ab + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file and at www.mariadb.com/bsl11. + * + * Change Date: 2020-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2 or later of the General + * Public License. + */ +require('../common.js')() + +exports.command = 'clear ' +exports.desc = 'Clear object status' +exports.handler = function() {} +exports.builder = function(yargs) { + yargs + .command('server ', 'Clear server status', {}, function(argv) { + var target = 'servers/' + argv.server + "/clear?status=" + argv.status + doRequest(target, null, {method: "POST"}) + }) + .command('*', 'the default command', {}, () => { + console.log("Unknown command. See output of 'help clear' for a list of commands.") + }) + .help() +} diff --git a/client/maxctrl/lib/set.js b/client/maxctrl/lib/set.js new file mode 100644 index 000000000..b41904cc9 --- /dev/null +++ b/client/maxctrl/lib/set.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 MariaDB Corporation Ab + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file and at www.mariadb.com/bsl11. + * + * Change Date: 2020-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2 or later of the General + * Public License. + */ +require('../common.js')() + +exports.command = 'set ' +exports.desc = 'Set object status' +exports.handler = function() {} +exports.builder = function(yargs) { + yargs + .command('server ', 'Set server status', {}, function(argv) { + var target = 'servers/' + argv.server + "/set?status=" + argv.status + doRequest(target, null, {method: "POST"}) + }) + .command('*', 'the default command', {}, () => { + console.log("Unknown command. See output of 'help set' for a list of commands.") + }) + .help() +} diff --git a/client/maxctrl/maxctrl.js b/client/maxctrl/maxctrl.js index cd0185f32..c4e8d0442 100644 --- a/client/maxctrl/maxctrl.js +++ b/client/maxctrl/maxctrl.js @@ -52,6 +52,8 @@ program }) .command(require('./lib/list.js')) .command(require('./lib/show.js')) + .command(require('./lib/set.js')) + .command(require('./lib/clear.js')) .recommendCommands() .help() .demandCommand(1, 'At least one command is required')