backups: add setPrimary route
This commit is contained in:
@@ -13,6 +13,7 @@ exports = module.exports = {
|
||||
setLimits,
|
||||
setSchedule,
|
||||
setRetention,
|
||||
setPrimary,
|
||||
|
||||
create,
|
||||
cleanup,
|
||||
@@ -214,3 +215,12 @@ async function setRetention(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
async function setPrimary(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
const [error] = await safe(backupTargets.setPrimary(req.resources.backupTarget));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, {}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user