Commit 7f514bfb authored by Alessio Netti's avatar Alessio Netti
Browse files

Analytics: start and stop REST API commands are now POST

parent 44503d5d
...@@ -354,8 +354,8 @@ void OperatorManager::addRestEndpoints(RESTHttpsServer* restServer) { ...@@ -354,8 +354,8 @@ void OperatorManager::addRestEndpoints(RESTHttpsServer* restServer) {
restServer->addEndpoint("/analytics/units", {http::verb::get, stdBind(GET_analytics_units)}); restServer->addEndpoint("/analytics/units", {http::verb::get, stdBind(GET_analytics_units)});
restServer->addEndpoint("/analytics/operators", {http::verb::get, stdBind(GET_analytics_operators)}); restServer->addEndpoint("/analytics/operators", {http::verb::get, stdBind(GET_analytics_operators)});
restServer->addEndpoint("/analytics/start", {http::verb::put, stdBind(PUT_analytics_start)}); restServer->addEndpoint("/analytics/start", {http::verb::post, stdBind(POST_analytics_start)});
restServer->addEndpoint("/analytics/stop", {http::verb::put, stdBind(PUT_analytics_stop)}); restServer->addEndpoint("/analytics/stop", {http::verb::post, stdBind(POST_analytics_stop)});
restServer->addEndpoint("/analytics/compute", {http::verb::put, stdBind(PUT_analytics_compute)}); restServer->addEndpoint("/analytics/compute", {http::verb::put, stdBind(PUT_analytics_compute)});
restServer->addEndpoint("/analytics/operator", {http::verb::put, stdBind(PUT_analytics_operator)}); restServer->addEndpoint("/analytics/operator", {http::verb::put, stdBind(PUT_analytics_operator)});
} }
...@@ -543,7 +543,7 @@ void OperatorManager::GET_analytics_operators(endpointArgs) { ...@@ -543,7 +543,7 @@ void OperatorManager::GET_analytics_operators(endpointArgs) {
} }
void OperatorManager::PUT_analytics_start(endpointArgs) { void OperatorManager::POST_analytics_start(endpointArgs) {
if (!managerLoaded(res)) { if (!managerLoaded(res)) {
return; return;
} }
...@@ -560,7 +560,7 @@ void OperatorManager::PUT_analytics_start(endpointArgs) { ...@@ -560,7 +560,7 @@ void OperatorManager::PUT_analytics_start(endpointArgs) {
} }
} }
void OperatorManager::PUT_analytics_stop(endpointArgs) { void OperatorManager::POST_analytics_stop(endpointArgs) {
if (!managerLoaded(res)) { if (!managerLoaded(res)) {
return; return;
} }
......
...@@ -228,13 +228,7 @@ public: ...@@ -228,13 +228,7 @@ public:
" /units?plugin;[operator];[json]\n" " /units?plugin;[operator];[json]\n"
" D List of units to which sensors are associated in\n" " D List of units to which sensors are associated in\n"
" the specified data analytics plugin (and operator).\n" " the specified data analytics plugin (and operator).\n"
" -PUT: /start?[plugin];[operator]\n" " -PUT /reload?[plugin] Reload all or only a specific analytics plugin.\n"
" Start all or only a specific analytics plugin or\n"
" start only a specific operator within a plugin.\n"
" /stop?[plugin];[operator]\n"
" Stop all or only a specific analytics plugin or\n"
" stop only a specific operator within a plugin.\n"
" /reload?[plugin] Reload all or only a specific analytics plugin.\n"
" /load?plugin;[path];[config]\n" " /load?plugin;[path];[config]\n"
" Load a new plugin. Optionally specify path to the\n" " Load a new plugin. Optionally specify path to the\n"
" shared library and/or the config file for the \n" " shared library and/or the config file for the \n"
...@@ -248,6 +242,12 @@ public: ...@@ -248,6 +242,12 @@ public:
" selected operator within a plugin (refer to plugin\n" " selected operator within a plugin (refer to plugin\n"
" documentation).\n" " documentation).\n"
" /navigator Reloads the sensor navigator.\n" " /navigator Reloads the sensor navigator.\n"
" -POST:/start?[plugin];[operator]\n"
" Start all or only a specific analytics plugin or\n"
" start only a specific operator within a plugin.\n"
" /stop?[plugin];[operator]\n"
" Stop all or only a specific analytics plugin or\n"
" stop only a specific operator within a plugin.\n"
"\n" "\n"
"D = Discovery method\n" "D = Discovery method\n"
"All resources have to be prepended by host:port.\n" "All resources have to be prepended by host:port.\n"
...@@ -362,7 +362,7 @@ private: ...@@ -362,7 +362,7 @@ private:
void GET_analytics_operators(endpointArgs); void GET_analytics_operators(endpointArgs);
/** /**
* PUT "/analytics/start" * POST "/analytics/start"
* *
* @brief Start all or only a specific plugin. Or only start a specific * @brief Start all or only a specific plugin. Or only start a specific
* streaming operator within a specific plugin. * streaming operator within a specific plugin.
...@@ -377,10 +377,10 @@ private: ...@@ -377,10 +377,10 @@ private:
* | | | to be specified. Limited to * | | | to be specified. Limited to
* | | | streaming operators. * | | | streaming operators.
*/ */
void PUT_analytics_start(endpointArgs); void POST_analytics_start(endpointArgs);
/** /**
* PUT "/analytics/stop" * POST "/analytics/stop"
* *
* @brief Stop all or only a specific plugin. Or only stop a specific * @brief Stop all or only a specific plugin. Or only stop a specific
* streaming operator within a plugin. * streaming operator within a plugin.
...@@ -395,7 +395,7 @@ private: ...@@ -395,7 +395,7 @@ private:
* | | | to be specified. Limited to * | | | to be specified. Limited to
* | | | streaming operators. * | | | streaming operators.
*/ */
void PUT_analytics_stop(endpointArgs); void POST_analytics_stop(endpointArgs);
/** /**
* This endpoint must either be overwritten (by adding a custom * This endpoint must either be overwritten (by adding a custom
......
...@@ -636,44 +636,6 @@ Prefix `/analytics` left out! ...@@ -636,44 +636,6 @@ Prefix `/analytics` left out!
</tr> </tr>
</table> </table>
<table>
<tr>
<td colspan="2"><b>PUT /start</b></td>
<td colspan="2">Start all or only a specific plugin. Or only start a specific streaming operator within a specific plugin.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td>Yes</td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>operator</td>
<td>All operator names of a plugin.</td>
<td>Yes</td>
<td>Only start the specified operator. Requires a plugin to be specified. Limited to streaming operators.</td>
</tr>
</table>
<table>
<tr>
<td colspan="2"><b>PUT /stop</b></td>
<td colspan="2">Stop all or only a specific plugin. Or only stop a specific streaming operator within a specific plugin.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td>Yes</td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>operator</td>
<td>All operator names of a plugin.</td>
<td>Yes</td>
<td>Only stop the specified operator. Requires a plugin to be specified. Limited to streaming operators.</td>
</tr>
</table>
<table> <table>
<tr> <tr>
<td colspan="2"><b>PUT /reload</b></td> <td colspan="2"><b>PUT /reload</b></td>
...@@ -756,6 +718,44 @@ Prefix `/analytics` left out! ...@@ -756,6 +718,44 @@ Prefix `/analytics` left out!
</tr> </tr>
</table> </table>
<table>
<tr>
<td colspan="2"><b>POST /start</b></td>
<td colspan="2">Start all or only a specific plugin. Or only start a specific streaming operator within a specific plugin.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td>Yes</td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>operator</td>
<td>All operator names of a plugin.</td>
<td>Yes</td>
<td>Only start the specified operator. Requires a plugin to be specified. Limited to streaming operators.</td>
</tr>
</table>
<table>
<tr>
<td colspan="2"><b>POST /stop</b></td>
<td colspan="2">Stop all or only a specific plugin. Or only stop a specific streaming operator within a specific plugin.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td>Yes</td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>operator</td>
<td>All operator names of a plugin.</td>
<td>Yes</td>
<td>Only stop the specified operator. Requires a plugin to be specified. Limited to streaming operators.</td>
</tr>
</table>
> NOTE&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp; Opt. = Optional > NOTE&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp; Opt. = Optional
> NOTE 2 &ensp;&ensp;&ensp;&ensp;&ensp; The value of operator output sensors can be retrieved with the _compute_ resource, or with the _/average_ resource defined in the DCDB Pusher REST API. > NOTE 2 &ensp;&ensp;&ensp;&ensp;&ensp; The value of operator output sensors can be retrieved with the _compute_ resource, or with the _/average_ resource defined in the DCDB Pusher REST API.
......
...@@ -235,8 +235,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer ...@@ -235,8 +235,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer
<table> <table>
<tr> <tr>
<td colspan="2"><b>PUT /start</b></td> <td colspan="2"><b>PUT /reload</b></td>
<td colspan="2">Start a plugin, i.e. its sensors start polling.</td> <td colspan="2">Reload a plugin's configuration (includes fresh creation of a plugin's sensors and a plugin restart).</td>
</tr> </tr>
<tr> <tr>
<td>plugin</td> <td>plugin</td>
...@@ -248,8 +248,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer ...@@ -248,8 +248,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer
<table> <table>
<tr> <tr>
<td colspan="2"><b>PUT /stop</b></td> <td colspan="2"><b>POST /start</b></td>
<td colspan="2">Stop a plugin, i.e. its sensors stop polling.</td> <td colspan="2">Start a plugin, i.e. its sensors start polling.</td>
</tr> </tr>
<tr> <tr>
<td>plugin</td> <td>plugin</td>
...@@ -261,8 +261,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer ...@@ -261,8 +261,8 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer
<table> <table>
<tr> <tr>
<td colspan="2"><b>PUT /reload</b></td> <td colspan="2"><b>POST /stop</b></td>
<td colspan="2">Reload a plugin's configuration (includes fresh creation of a plugin's sensors and a plugin restart).</td> <td colspan="2">Stop a plugin, i.e. its sensors stop polling.</td>
</tr> </tr>
<tr> <tr>
<td>plugin</td> <td>plugin</td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment