2016-09-16 12:55:45 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
// This file just describes the interface
|
|
|
|
|
//
|
|
|
|
|
// New backends can start from here
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
|
|
|
|
|
exports = module.exports = {
|
|
|
|
|
getBoxBackupDetails: getBoxBackupDetails,
|
|
|
|
|
getAppBackupDetails: getAppBackupDetails,
|
|
|
|
|
|
|
|
|
|
getRestoreUrl: getRestoreUrl,
|
2016-09-19 15:03:38 +02:00
|
|
|
getAppRestoreConfig: getAppRestoreConfig,
|
2016-09-16 18:14:36 +02:00
|
|
|
getLocalFilePath: getLocalFilePath,
|
2016-09-16 12:55:45 +02:00
|
|
|
|
2016-10-10 15:04:28 +02:00
|
|
|
copyObject: copyObject,
|
2016-10-11 11:36:25 +02:00
|
|
|
removeBackup: removeBackup,
|
|
|
|
|
|
2017-01-04 16:22:58 -08:00
|
|
|
backupDone: backupDone,
|
|
|
|
|
|
2016-10-11 11:36:25 +02:00
|
|
|
testConfig: testConfig
|
2016-09-16 12:55:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
|
|
function getBoxBackupDetails(apiConfig, id, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof id, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: { backupScriptArguments: [] }
|
|
|
|
|
// The resulting array consists of string passed down 1to1 to the backupbox.sh
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getAppBackupDetails(apiConfig, appId, dataId, configId, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof appId, 'string');
|
|
|
|
|
assert.strictEqual(typeof dataId, 'string');
|
2016-09-16 16:54:34 +02:00
|
|
|
assert.strictEqual(typeof configId, 'string');
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: { backupScriptArguments: [] }
|
|
|
|
|
// The resulting array consists of string passed down 1to1 to the backupapp.sh
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getRestoreUrl(apiConfig, filename, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof filename, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
2016-10-10 18:11:23 +02:00
|
|
|
// Result: { url: <restoreUrl>, sha1: <optional> }
|
2016-09-16 12:55:45 +02:00
|
|
|
// The resulting url must work with curl as it is passed into start.sh and restoreapp.sh
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-19 15:03:38 +02:00
|
|
|
function getAppRestoreConfig(apiConfig, backupId, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof backupId, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// var configFilename = backupId.replace(/\.tar\.gz$/, '.json');
|
|
|
|
|
|
|
|
|
|
// Result: {} <- Backup config object from .json file
|
|
|
|
|
// The resulting url must work with curl as it is passed into start.sh and restoreapp.sh
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 18:14:36 +02:00
|
|
|
function getLocalFilePath(apiConfig, filename, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof filename, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: { filePath: <localFilePath> }
|
|
|
|
|
// The resulting filePath is a local path to the backup file
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 12:55:45 +02:00
|
|
|
function copyObject(apiConfig, from, to, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof from, 'string');
|
|
|
|
|
assert.strictEqual(typeof to, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: none
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
2016-10-10 15:04:28 +02:00
|
|
|
|
2016-10-10 15:45:12 +02:00
|
|
|
function removeBackup(apiConfig, backupId, appBackupIds, callback) {
|
2016-10-10 15:04:28 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof backupId, 'string');
|
2016-10-10 15:45:12 +02:00
|
|
|
assert(Array.isArray(appBackupIds));
|
2016-10-10 15:04:28 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: none
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
2016-10-11 11:36:25 +02:00
|
|
|
|
|
|
|
|
function testConfig(apiConfig, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: none
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
2017-01-04 16:22:58 -08:00
|
|
|
|
|
|
|
|
function backupDone(filename, app, appBackupIds, callback) {
|
|
|
|
|
assert.strictEqual(typeof filename, 'string');
|
|
|
|
|
assert(!app || typeof app === 'object');
|
|
|
|
|
assert(!appBackupIds || Array.isArray(appBackupIds));
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|