MXS-1220: Add output for module commands
The module commands can now produce JSON formatted output which is passed to the caller. The output should conform to the JSON API as closely as possible. Currently, the REST API wraps all JSON produced by module commands inside a meta-object of the following type: { "meta": <output of module command> } This allows the output to be JSON API conformant without modifying the modules and allows incremental updates to code.
This commit is contained in:
@ -96,7 +96,7 @@ static modulecmd_arg_type_t custom_cmd_args[] =
|
||||
{(MODULECMD_ARG_BOOLEAN | MODULECMD_ARG_OPTIONAL), "This is an optional bool parameter"}
|
||||
};
|
||||
|
||||
bool custom_cmd_example(const MODULECMD_ARG *argv);
|
||||
bool custom_cmd_example(const MODULECMD_ARG *argv, json_t** output);
|
||||
|
||||
using std::string;
|
||||
using std::cout;
|
||||
@ -890,7 +890,7 @@ static void process_finish()
|
||||
* A function executed as a custom module command through MaxAdmin
|
||||
* @param argv The arguments
|
||||
*/
|
||||
bool custom_cmd_example(const MODULECMD_ARG *argv)
|
||||
bool custom_cmd_example(const MODULECMD_ARG *argv, json_t** output)
|
||||
{
|
||||
cout << MXS_MODULE_NAME << " wishes the Admin a good day.\n";
|
||||
int n_args = argv->argc;
|
||||
|
Reference in New Issue
Block a user