'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (_ref) {
var client = _ref.client,
filterQuery = _ref.filterQuery,
mustContain = _ref.mustContain,
encodeQueryAsString = _ref.encodeQueryAsString,
busy = _ref.busy;
return {
// get /volumes
// List available volumes.
listVolumes: function listVolumes() {
var limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (limit) {
return busy(client._.get('/volumes?limit=' + limit));
}
return busy(client._.get('/volumes'));
},
// post /volumes
// Create a volume
createVolume: function createVolume(volume) {
return busy(client._.post('/volumes', volume, {
transformRequest: _utils.transformRequest,
headers: headers
}));
},
// get /volumes/{id}
// Get a volume
getVolume: function getVolume(id) {
return busy(client._.get('/volumes/' + id));
},
// delete /volumes/{id}
// Delete a volume
deleteVolume: function deleteVolume(id) {
return busy(client._.delete('/volumes/' + id));
},
// get /volumes/{id}/log
// Get log entries for volume
getVolumeLog: function getVolumeLog(volumeId) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (offset) {
return busy(client._.get('/volumes/' + volumeId + '/log?offset=' + offset));
}
return busy(client._.get('/volumes/' + volumeId + '/log'));
},
// get /volumes/{id}/status
// Get the volume's current state
getVolumeStatus: function getVolumeStatus(id) {
return busy(client._.get('/volumes/' + id + '/status'));
},
// put /volumes/{id}/attach/{cluster}
// Attach a volume to a cluster
attachVolume: function attachVolume(id, cluster) {
return busy(client._.put('/volumes/' + id + '/attach/' + cluster));
},
// put /volumes/{id}/attach/{cluster}
// Detach a volume to a cluster
detachVolume: function detachVolume(id) {
return busy(client._.put('/volumes/' + id + '/detach'));
}
};
};
var _utils = require('./utils');
var headers = {
'Content-Type': 'application/json'
};
|