rename appVolumes to appMounts

This commit is contained in:
Girish Ramakrishnan
2020-10-28 19:42:48 -07:00
parent 4388f6e87c
commit 88ed545830
8 changed files with 35 additions and 46 deletions
+8 -6
View File
@@ -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 }));