backups: set label of backup and control it's retention

This commit is contained in:
Girish Ramakrishnan
2022-04-02 17:09:08 -07:00
parent d47b39d90b
commit 70695b1b0f
12 changed files with 174 additions and 19 deletions

View File

@@ -54,6 +54,7 @@ exports = module.exports = {
backup,
listBackups,
updateBackup,
getTask,
getLogPaths,
@@ -2452,6 +2453,18 @@ async function listBackups(app, page, perPage) {
return await backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, page, perPage);
}
async function updateBackup(app, backupId, data) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof backupId, 'string');
assert.strictEqual(typeof data, 'object');
const backup = await backups.get(backupId);
if (!backup) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found');
if (backup.identifier !== app.id) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found'); // some other app's backup
await backups.update(backupId, data);
}
async function restoreInstalledApps(options, auditSource) {
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof auditSource, 'object');