Add route to list application backups

This commit is contained in:
Johannes Zellner
2016-01-19 13:35:28 +01:00
parent d2ed816f44
commit e15bd89ba2
2 changed files with 13 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ exports = module.exports = {
updateApp: updateApp,
getLogs: getLogs,
getLogStream: getLogStream,
listBackups: listBackups,
stopApp: stopApp,
startApp: startApp,
@@ -373,3 +374,14 @@ function exec(req, res, next) {
res.socket.pipe(duplexStream);
});
}
function listBackups(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
apps.listBackups(function (error, result) {
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, { backups: result }));
});
}