MXS-1300: Add monitor credentials as create options
The monitor user and password can now be defined as options to the create command. This should help with the creation of a monitor in one request. Fixed the command description of `create listener`.
This commit is contained in:
@ -82,7 +82,15 @@ exports.builder = function(yargs) {
|
|||||||
describe: 'Link the created monitor to these servers',
|
describe: 'Link the created monitor to these servers',
|
||||||
type: 'array'
|
type: 'array'
|
||||||
})
|
})
|
||||||
.command('monitor <name> <module>', 'Create a new server', {}, function(argv) {
|
.option('monitor-user', {
|
||||||
|
describe: 'Username for the monitor user',
|
||||||
|
type: 'string'
|
||||||
|
})
|
||||||
|
.option('monitor-password', {
|
||||||
|
describe: 'Password for the monitor user',
|
||||||
|
type: 'string'
|
||||||
|
})
|
||||||
|
.command('monitor <name> <module>', 'Create a new monitor', {}, function(argv) {
|
||||||
|
|
||||||
var monitor = {
|
var monitor = {
|
||||||
'data': {
|
'data': {
|
||||||
@ -99,6 +107,13 @@ exports.builder = function(yargs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argv.monitorUser) {
|
||||||
|
_.set(monitor, 'data.attributes.parameters.user', argv.monitorUser)
|
||||||
|
}
|
||||||
|
if (argv.monitorPassword) {
|
||||||
|
_.set(monitor, 'data.attributes.parameters.password', argv.monitorPassword)
|
||||||
|
}
|
||||||
|
|
||||||
maxctrl(argv, function(host) {
|
maxctrl(argv, function(host) {
|
||||||
return doRequest(host, 'monitors', null, {method: 'POST', body: monitor})
|
return doRequest(host, 'monitors', null, {method: 'POST', body: monitor})
|
||||||
})
|
})
|
||||||
@ -132,7 +147,7 @@ exports.builder = function(yargs) {
|
|||||||
describe: 'TLS certificate verification depth',
|
describe: 'TLS certificate verification depth',
|
||||||
type: 'string'
|
type: 'string'
|
||||||
})
|
})
|
||||||
.command('listener <service> <name> <port>', 'Create a new server', {}, function(argv) {
|
.command('listener <service> <name> <port>', 'Create a new listener', {}, function(argv) {
|
||||||
|
|
||||||
var listener = {
|
var listener = {
|
||||||
'data': {
|
'data': {
|
||||||
|
Reference in New Issue
Block a user