2016-09-15 11:29:45 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
exports = module.exports = {
|
|
|
|
|
getRestoreUrl: getRestoreUrl,
|
|
|
|
|
|
|
|
|
|
copyObject: copyObject,
|
|
|
|
|
getAllPaged: getAllPaged,
|
|
|
|
|
|
2016-09-16 10:58:34 +02:00
|
|
|
getBackupDetails: getBackupDetails
|
2016-09-15 11:29:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
2016-09-16 10:58:34 +02:00
|
|
|
function getBackupDetails(apiConfig, id, callback) {
|
2016-09-15 11:29:45 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
2016-09-16 10:58:34 +02:00
|
|
|
assert.strictEqual(typeof id, 'string');
|
2016-09-15 11:29:45 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
2016-09-16 10:58:34 +02:00
|
|
|
var backupFolder = apiConfig.backupFolder || '/tmp/backups';
|
|
|
|
|
|
|
|
|
|
var details = {
|
|
|
|
|
backupScriptArguments: [ 'filesystem', backupFolder, id, apiConfig.key ]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
callback(null, details);
|
2016-09-15 11:29:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getAllPaged(apiConfig, page, perPage, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof page, 'number');
|
|
|
|
|
assert.strictEqual(typeof perPage, 'number');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
return callback(null, []);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getRestoreUrl(apiConfig, filename, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof filename, 'string');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
callback(null, { url: '' });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
|
|
|
|
|
callback(null);
|
|
|
|
|
}
|