2018-06-28 14:12:16 +00:00
|
|
|
/*
|
|
|
|
* Wazuh app - Module for Wazuh reporting routes
|
2019-01-14 16:36:47 +00:00
|
|
|
* Copyright (C) 2015-2019 Wazuh, Inc.
|
2018-06-28 14:12:16 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
import { WazuhReportingCtrl } from '../controllers';
|
|
|
|
|
2018-09-03 09:46:55 +00:00
|
|
|
export function WazuhReportingRoutes(server) {
|
2018-09-10 08:32:49 +00:00
|
|
|
const ctrl = new WazuhReportingCtrl(server);
|
2018-06-28 14:12:16 +00:00
|
|
|
|
2018-09-10 08:32:49 +00:00
|
|
|
// Builds a PDF report from multiple PNG images
|
|
|
|
server.route({
|
|
|
|
method: 'POST',
|
2018-10-01 07:56:50 +00:00
|
|
|
path: '/reports',
|
2018-09-10 08:32:49 +00:00
|
|
|
handler(req, res) {
|
|
|
|
return ctrl.report(req, res);
|
|
|
|
}
|
|
|
|
});
|
2018-06-28 14:12:16 +00:00
|
|
|
|
2018-09-10 08:32:49 +00:00
|
|
|
// Fetch specific report
|
|
|
|
server.route({
|
|
|
|
method: 'GET',
|
2018-10-01 07:56:50 +00:00
|
|
|
path: '/reports/{name}',
|
2018-09-10 08:32:49 +00:00
|
|
|
handler(req, res) {
|
|
|
|
return ctrl.getReportByName(req, res);
|
|
|
|
}
|
|
|
|
});
|
2018-06-28 14:12:16 +00:00
|
|
|
|
2018-09-10 08:32:49 +00:00
|
|
|
// Delete specific report
|
|
|
|
server.route({
|
|
|
|
method: 'DELETE',
|
2018-10-01 07:56:50 +00:00
|
|
|
path: '/reports/{name}',
|
2018-09-10 08:32:49 +00:00
|
|
|
handler(req, res) {
|
|
|
|
return ctrl.deleteReportByName(req, res);
|
|
|
|
}
|
|
|
|
});
|
2018-06-28 14:12:16 +00:00
|
|
|
|
2018-09-10 08:32:49 +00:00
|
|
|
// Fetch the reports list
|
|
|
|
server.route({
|
|
|
|
method: 'GET',
|
2018-10-01 07:56:50 +00:00
|
|
|
path: '/reports',
|
2018-09-10 08:32:49 +00:00
|
|
|
handler(req, res) {
|
|
|
|
return ctrl.getReports(req, res);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|