MXS-1300: Add set and clear commands
The manipulation of server status is now possible with the set and clear commands.
This commit is contained in:
28
client/maxctrl/lib/clear.js
Normal file
28
client/maxctrl/lib/clear.js
Normal file
@ -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 <command>'
|
||||||
|
exports.desc = 'Clear object status'
|
||||||
|
exports.handler = function() {}
|
||||||
|
exports.builder = function(yargs) {
|
||||||
|
yargs
|
||||||
|
.command('server <server> <status>', '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()
|
||||||
|
}
|
28
client/maxctrl/lib/set.js
Normal file
28
client/maxctrl/lib/set.js
Normal file
@ -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 <command>'
|
||||||
|
exports.desc = 'Set object status'
|
||||||
|
exports.handler = function() {}
|
||||||
|
exports.builder = function(yargs) {
|
||||||
|
yargs
|
||||||
|
.command('server <server> <status>', '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()
|
||||||
|
}
|
@ -52,6 +52,8 @@ program
|
|||||||
})
|
})
|
||||||
.command(require('./lib/list.js'))
|
.command(require('./lib/list.js'))
|
||||||
.command(require('./lib/show.js'))
|
.command(require('./lib/show.js'))
|
||||||
|
.command(require('./lib/set.js'))
|
||||||
|
.command(require('./lib/clear.js'))
|
||||||
.recommendCommands()
|
.recommendCommands()
|
||||||
.help()
|
.help()
|
||||||
.demandCommand(1, 'At least one command is required')
|
.demandCommand(1, 'At least one command is required')
|
||||||
|
Reference in New Issue
Block a user