MXS-1220: Unify resource member naming

All resoures now use the `state` member to describe their internal
state. This includes servers, services and monitors. This means that the
`status` keyword can be reserved for something else and it can be removed
until it is needed again.

Changed the module maturity field to `maturity` to better describe its
purpose.
This commit is contained in:
Markus Mäkelä
2017-06-30 16:56:49 +03:00
parent a8bfdac49c
commit c7b9b7ac4a
13 changed files with 59 additions and 45 deletions

View File

@ -13,12 +13,12 @@
require('../common.js')()
exports.command = 'clear <command>'
exports.desc = 'Clear object status'
exports.desc = 'Clear object state'
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
.command('server <server> <state>', 'Clear server state', {}, function(argv) {
var target = 'servers/' + argv.server + '/clear?state=' + argv.state
doRequest(target, null, {method: 'POST'})
})
.usage('Usage: clear <command>')

View File

@ -24,7 +24,7 @@ exports.builder = function(yargs) {
{'Address': 'attributes.parameters.address'},
{'Port': 'attributes.parameters.port'},
{'Connections': 'attributes.statistics.connections'},
{'Status': 'attributes.status'}
{'State': 'attributes.state'}
])
})
.command('services', 'List services', {}, function() {
@ -39,7 +39,7 @@ exports.builder = function(yargs) {
.command('monitors', 'List monitors', {}, function() {
getCollection('monitors', [
{'Monitor': 'id'},
{'Status': 'attributes.state'},
{'State': 'attributes.state'},
{'Servers': 'relationships.servers.data[].id'}
])
})

View File

@ -13,12 +13,12 @@
require('../common.js')()
exports.command = 'set <command>'
exports.desc = 'Set object status'
exports.desc = 'Set object state'
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
.command('server <server> <state>', 'Set server state', {}, function(argv) {
var target = 'servers/' + argv.server + '/set?state=' + argv.state
doRequest(target, null, {method: 'POST'})
})
.usage('Usage: set <command>')

View File

@ -23,7 +23,7 @@ exports.builder = function(yargs) {
{'Server': 'id'},
{'Address': 'attributes.parameters.address'},
{'Port': 'attributes.parameters.port'},
{'Status': 'attributes.status'},
{'State': 'attributes.state'},
{'Services': 'relationships.services.data[].id'},
{'Monitors': 'relationships.monitors.data[].id'},
{'Master ID': 'attributes.master_id'},
@ -36,6 +36,7 @@ exports.builder = function(yargs) {
getResource('services/' + argv.service, [
{'Service': 'id'},
{'Router': 'attributes.router'},
{'State': 'attributes.state'},
{'Started At': 'attributes.started'},
{'Current Connections': 'attributes.connections'},
{'Total Connections': 'attributes.total_connections'},
@ -47,7 +48,7 @@ exports.builder = function(yargs) {
.command('monitor <monitor>', 'Show monitor', {}, function(argv) {
getResource('monitors/' + argv.monitor, [
{'Monitor': 'id'},
{'Status': 'attributes.state'},
{'State': 'attributes.state'},
{'Servers': 'relationships.servers.data[].id'},
{'Parameters': 'attributes.parameters'},
{'Monitor Diagnostics': 'attributes.monitor_diagnostics'}
@ -57,7 +58,7 @@ exports.builder = function(yargs) {
getResource('sessions/' + argv.session, [
{'Id': 'id'},
{'Service': 'relationships.services.data[].id'},
{'Status': 'attributes.state'},
{'State': 'attributes.state'},
{'User': 'attributes.user'},
{'Host': 'attributes.remote'},
{'Connected': 'attributes.connected'},
@ -77,7 +78,7 @@ exports.builder = function(yargs) {
{'Module': 'id'},
{'Type': 'attributes.module_type'},
{'Version': 'attributes.version'},
{'Maturity': 'attributes.status'},
{'Maturity': 'attributes.maturity'},
{'Description': 'attributes.description'},
{'Parameters': 'attributes.parameters'},
{'Commands': 'attributes.commands'}