rename appVolumes to appMounts
This commit is contained in:
+8
-6
@@ -30,7 +30,7 @@ exports = module.exports = {
|
||||
setMailbox,
|
||||
setLocation,
|
||||
setDataDir,
|
||||
setVolumes,
|
||||
setMounts,
|
||||
|
||||
stop,
|
||||
start,
|
||||
@@ -766,16 +766,18 @@ function downloadFile(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function setVolumes(req, res, next) {
|
||||
function setMounts(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
if (Array.isArray(req.body.volumes)) return next(new HttpError(400, 'volumes should be an array'));
|
||||
for (let v of req.body.volumes) {
|
||||
if (!v || typeof v !== 'string') return next(new HttpError(400, 'volume must be a non-empty string'));
|
||||
if (Array.isArray(req.body.mounts)) return next(new HttpError(400, 'mounts should be an array'));
|
||||
for (let m of req.body.mounts) {
|
||||
if (!m || typeof m !== 'object') return next(new HttpError(400, 'mounts must be an object'));
|
||||
if (typeof m.volumeId !== 'string') return next(new HttpError(400, 'volumeId must be a string'));
|
||||
if (typeof m.readOnly !== 'boolean') return next(new HttpError(400, 'readOnly must be a boolean'));
|
||||
}
|
||||
|
||||
apps.setVolume(req.resource, req.body.volumes, auditSource.fromRequest(req), function (error, result) {
|
||||
apps.setMounts(req.resource, req.body.mounts, auditSource.fromRequest(req), function (error, result) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId: result.taskId }));
|
||||
|
||||
Reference in New Issue
Block a user