Commit b9d3b03d authored by Patricio Bruna's avatar Patricio Bruna

Added flushCache

parent 1761e049
......@@ -428,6 +428,34 @@ return /******/ (function(modules) { // webpackBootstrap
var resource_data = this.buildResourceData(name, attributes);
return this.create('DistributionList', resource_data, callback);
}
// flushData = {
// type: Comma separated list of cache types. e.g. from skin|locale|account|cos|domain|server|zimlet,
// allServers: 0|1,
// entry: Name or Id of the object, should be relevant to type
// }
}, {
key: 'flushCache',
value: function flushCache() {
var flushData = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var callback = arguments[1];
var request_data = this.buildRequestData('FlushCache', callback);
request_data.parse_response = ResponseParser.emptyResponse;
request_data.params.params = {
cache: {
type: flushData.type,
allServers: flushData.allServers || 0,
'_content': { entry: {} }
}
};
if (flushData.entry) request_data.params.params.cache._content.entry = {
'by': this.dictionary.byIdOrName(flushData.entry),
'_content': flushData.entry
};
return this.performRequest(request_data);
}
}, {
key: 'getAllDomains',
value: function getAllDomains(callback, query_object) {
......
......@@ -322,6 +322,28 @@ class ZimbraAdminApi {
return this.create('DistributionList', resource_data, callback);
}
// flushData = {
// type: Comma separated list of cache types. e.g. from skin|locale|account|cos|domain|server|zimlet,
// allServers: 0|1,
// entry: Name or Id of the object, should be relevant to type
// }
flushCache(flushData = {}, callback) {
const request_data = this.buildRequestData('FlushCache', callback);
request_data.parse_response = ResponseParser.emptyResponse;
request_data.params.params = {
cache: {
type: flushData.type,
allServers: (flushData.allServers || 0),
'_content': { entry: { } }
}
};
if (flushData.entry) request_data.params.params.cache._content.entry = {
'by': this.dictionary.byIdOrName(flushData.entry),
'_content': flushData.entry
}
return this.performRequest(request_data);
}
getAllDomains(callback, query_object) {
query_object = query_object || {};
query_object.types = 'domains';
......
......@@ -24,6 +24,16 @@
});
});
it('Should Flush the Cache', function(done){
let api = new ZimbraAdminApi(auth_data);
const flush_data = {type: 'domain', allServers: 1, entry: 'zboxapp.dev'};
api.flushCache(flush_data, function(err, data){
if (err) console.log(err);
expect(err).to.not.exist;
done();
})
});
it('should get all domains', function(done) {
let api = new ZimbraAdminApi(auth_data);
api.getAllDomains(function(err, data){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment