wazuh-kibana-app/server/routes/wazuh-api-elastic.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

/*
* Wazuh app - Module for Wazuh-API-Elastic routes
2019-01-14 16:36:47 +00:00
* Copyright (C) 2015-2019 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/
2018-09-03 09:46:55 +00:00
import { WazuhApiElasticCtrl } from '../controllers';
2018-09-03 09:46:55 +00:00
export function WazuhApiElasticRoutes(server) {
2018-09-10 08:32:49 +00:00
const ctrl = new WazuhApiElasticCtrl(server);
2018-09-10 08:32:49 +00:00
// Save the given API into elasticsearch
server.route({
method: 'PUT',
2018-10-01 07:56:50 +00:00
path: '/elastic/api',
2018-09-10 08:32:49 +00:00
handler(req, reply) {
return ctrl.saveAPI(req, reply);
}
});
2018-09-10 08:32:49 +00:00
// Update the given API into elasticsearch
server.route({
method: 'PUT',
2018-10-01 07:56:50 +00:00
path: '/elastic/api-settings',
2018-09-10 08:32:49 +00:00
handler(req, reply) {
return ctrl.updateFullAPI(req, reply);
}
});
2018-09-10 08:32:49 +00:00
// Get Wazuh-API entries list (Multimanager) from elasticsearch index
server.route({
method: 'GET',
2018-10-01 07:56:50 +00:00
path: '/elastic/apis',
2018-09-10 08:32:49 +00:00
handler(req, reply) {
return ctrl.getAPIEntries(req, reply);
}
});
2018-09-10 08:32:49 +00:00
// Delete Wazuh-API entry (multimanager) from elasticsearch index
server.route({
method: 'DELETE',
2018-10-01 07:56:50 +00:00
path: '/elastic/apis/{id}',
2018-09-10 08:32:49 +00:00
handler(req, reply) {
return ctrl.deleteAPIEntries(req, reply);
}
});
2018-09-10 08:32:49 +00:00
// Update the API hostname
server.route({
method: 'PUT',
2018-10-01 07:56:50 +00:00
path: '/elastic/api-hostname/{id}',
2018-09-10 08:32:49 +00:00
handler(req, reply) {
return ctrl.updateAPIHostname(req, reply);
}
});
}