MXS-1220: Add execution of module commands to REST API
The module command self links now point to an endpoint that executes the module command. Depending on the type of the module command, either a GET or a POST request must be made.
This commit is contained in:
@ -417,6 +417,12 @@ struct cb_param
|
||||
|
||||
bool modulecmd_cb(const MODULECMD *cmd, void *data)
|
||||
{
|
||||
if (modulecmd_requires_output_dcb(cmd))
|
||||
{
|
||||
/** Module requires an output DCB, don't print it */
|
||||
return true;
|
||||
}
|
||||
|
||||
cb_param* d = static_cast<cb_param*>(data);
|
||||
|
||||
json_t* obj = json_object();
|
||||
@ -424,6 +430,8 @@ bool modulecmd_cb(const MODULECMD *cmd, void *data)
|
||||
json_object_set_new(obj, CN_TYPE, json_string(CN_MODULE_COMMAND));
|
||||
|
||||
json_t* attr = json_object();
|
||||
const char* method = MODULECMD_MODIFIES_DATA(cmd) ? "POST" : "GET";
|
||||
json_object_set_new(attr, CN_METHOD, json_string(method));
|
||||
json_object_set_new(attr, CN_ARG_MIN, json_integer(cmd->arg_count_min));
|
||||
json_object_set_new(attr, CN_ARG_MAX, json_integer(cmd->arg_count_max));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user