mirror of
https://github.com/emqx/neuron.git
synced 2026-10-18 21:50:42 +08:00
feat(restful): add template group del api
This commit is contained in:
@@ -408,6 +408,12 @@ static struct neu_http_handler rest_handlers[] = {
|
||||
.url = "/api/v2/template/group",
|
||||
.value.handler = handle_update_template_group,
|
||||
},
|
||||
{
|
||||
.method = NEU_HTTP_METHOD_DELETE,
|
||||
.type = NEU_HTTP_HANDLER_FUNCTION,
|
||||
.url = "/api/v2/template/group",
|
||||
.value.handler = handle_del_template_group,
|
||||
},
|
||||
};
|
||||
|
||||
void neu_rest_handler(const struct neu_http_handler **handlers, uint32_t *size)
|
||||
|
||||
@@ -380,6 +380,29 @@ void handle_update_template_group(nng_aio *aio)
|
||||
process_mod_template_group(aio, NEU_REQ_UPDATE_TEMPLATE_GROUP);
|
||||
}
|
||||
|
||||
void handle_del_template_group(nng_aio *aio)
|
||||
{
|
||||
neu_plugin_t *plugin = neu_rest_get_plugin();
|
||||
|
||||
NEU_PROCESS_HTTP_REQUEST_VALIDATE_JWT(
|
||||
aio, neu_json_template_del_group_req_t,
|
||||
neu_json_decode_template_del_group_req, {
|
||||
neu_reqresp_head_t header = { 0 };
|
||||
header.ctx = aio;
|
||||
header.type = NEU_REQ_DEL_TEMPLATE_GROUP;
|
||||
|
||||
neu_req_add_template_group_t cmd = { 0 };
|
||||
strcpy(cmd.tmpl, req->tmpl);
|
||||
strcpy(cmd.group, req->group);
|
||||
|
||||
if (0 != neu_plugin_op(plugin, header, &cmd)) {
|
||||
int ret = NEU_ERR_IS_BUSY;
|
||||
NEU_JSON_RESPONSE_ERROR(
|
||||
ret, { neu_http_response(aio, ret, result_error); });
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static int send_template_mod_tags_req(nng_aio *aio, neu_reqresp_type_e type,
|
||||
neu_json_template_mod_tags_req_t *req)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ void handle_get_templates_resp(nng_aio *aio, neu_resp_get_templates_t *resp);
|
||||
|
||||
void handle_add_template_group(nng_aio *aio);
|
||||
void handle_update_template_group(nng_aio *aio);
|
||||
void handle_del_template_group(nng_aio *aio);
|
||||
|
||||
void handle_add_template_tags(nng_aio *aio);
|
||||
void handle_update_template_tags(nng_aio *aio);
|
||||
|
||||
Reference in New Issue
Block a user