app: add export route

Currently, the export route only creates the snapshot (the other side
of in-place import). In the future, the export route can export to a
custom backup config (like import).
This commit is contained in:
Girish Ramakrishnan
2020-12-06 19:38:50 -08:00
parent c6fd922fcd
commit 78752fde7a
5 changed files with 37 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ exports = module.exports = {
uninstall,
restore,
importApp,
exportApp,
backup,
update,
getLogs,
@@ -443,6 +444,17 @@ function importApp(req, res, next) {
});
}
function exportApp(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.resource, 'object');
apps.exportApp(req.resource, {}, auditSource.fromRequest(req), function (error, result) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId: result.taskId }));
});
}
function clone(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.resource, 'object');