eventlog: add service rebuild/restart/configure events

This commit is contained in:
Girish Ramakrishnan
2021-09-24 10:22:45 -07:00
parent 05e8339555
commit d90beb18d4
7 changed files with 50 additions and 20 deletions

View File

@@ -11,6 +11,7 @@ exports = module.exports = {
};
const assert = require('assert'),
auditSource = require('../auditsource.js'),
BoxError = require('../boxerror.js'),
HttpError = require('connect-lastmile').HttpError,
HttpSuccess = require('connect-lastmile').HttpSuccess,
@@ -44,7 +45,7 @@ async function configure(req, res, next) {
memoryLimit: req.body.memoryLimit
};
const [error] = await safe(services.configureService(req.params.service, data));
const [error] = await safe(services.configureService(req.params.service, data, auditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
@@ -114,7 +115,7 @@ async function getLogStream(req, res, next) {
async function restart(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
const [error] = await safe(services.restartService(req.params.service));
const [error] = await safe(services.restartService(req.params.service, auditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
@@ -123,7 +124,7 @@ async function restart(req, res, next) {
async function rebuild(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
const [error] = await safe(services.rebuildService(req.params.service));
const [error] = await safe(services.rebuildService(req.params.service, auditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));