diff --git a/src/routes/volumes.js b/src/routes/volumes.js index 6a7348f3a..bfc88487d 100644 --- a/src/routes/volumes.js +++ b/src/routes/volumes.js @@ -5,7 +5,6 @@ exports = module.exports = { get, del, list, - update, load }; @@ -48,20 +47,6 @@ function get(req, res, next) { next(new HttpSuccess(200, req.resource)); } -function update(req, res, next) { - assert.strictEqual(typeof req.params.id, 'string'); - assert.strictEqual(typeof req.body, 'object'); - - if (typeof req.body.name !== 'string') return next(new HttpError(400, 'name must be a string')); - if (typeof req.body.hostPath !== 'string') return next(new HttpError(400, 'hostPath must be a string')); - - volumes.update(req.resource, req.body, function (error, result) { - if (error) return next(BoxError.toHttpError(error)); - - next(new HttpSuccess(200, result)); - }); -} - function del(req, res, next) { assert.strictEqual(typeof req.params.id, 'string'); diff --git a/src/server.js b/src/server.js index 6a1d2da76..98b4c3755 100644 --- a/src/server.js +++ b/src/server.js @@ -304,7 +304,6 @@ function initializeExpressSync() { router.get ('/api/v1/volumes', token, authorizeAdmin, routes.volumes.list); router.get ('/api/v1/volumes/:id', token, authorizeAdmin, routes.volumes.load, routes.volumes.get); router.del ('/api/v1/volumes/:id', token, authorizeAdmin, routes.volumes.load, routes.volumes.del); - router.put ('/api/v1/volumes/:id', json, token, authorizeAdmin, routes.volumes.load, routes.volumes.update); // addon routes router.get ('/api/v1/services', token, authorizeAdmin, routes.services.getAll); diff --git a/src/volumes.js b/src/volumes.js index bc1b0cef5..b48b785c2 100644 --- a/src/volumes.js +++ b/src/volumes.js @@ -4,16 +4,14 @@ exports = module.exports = { add, get, del, - list, - update + list }; const assert = require('assert'), BoxError = require('./boxerror.js'), volumedb = require('./volumedb.js'), eventlog = require('./eventlog.js'), - uuid = require('uuid'), - _ = require('underscore'); + uuid = require('uuid'); function validateName(name) { assert.strictEqual(typeof name, 'string'); @@ -89,25 +87,3 @@ function del(volume, auditSource, callback) { }); } -function update(volume, data, auditSource, callback) { - assert.strictEqual(typeof volume, 'object'); - assert.strictEqual(typeof data, 'object'); - assert.strictEqual(typeof auditSource, 'object'); - assert.strictEqual(typeof callback, 'function'); - - let error = validateName(data.name); - if (error) return callback(error); - - error = validateHostPath(data.hostPath); - if (error) return callback(error); - - volumedb.update(volume.id, { name: data.name, hostPath: data.hostPath }, function (error) { - if (error) return callback(error); - - const newVolume = _.extend({}, volume, data); - - eventlog.add(eventlog.ACTION_VOLUME_UPDATE, auditSource, { volume: newVolume }); - - return callback(null); - }); -}