cloudcms-cli
Version:
Cloud CMS Command-Line client
60 lines (56 loc) • 2.08 kB
JavaScript
var helper = require("../../../helper");
var AbstractCommand = require("../../abstract");
class RebuildDatastoreIndexesCommand extends AbstractCommand
{
constructor()
{
super({
"group": "admin",
"name": "reindex-datastore",
"description": "Rebuilds MongoDB indexes for a datastore",
"schema": {
"properties": [{
"name": "datastoreTypeId",
"type": "string",
"description": "Enter the data store type ID",
"required": true,
"args": ["datastoreTypeId", "type"]
}, {
"name": "datastoreId",
"type": "string",
"description": "Enter the data store ID",
"required": true,
"args": ["datastoreId", "id"]
}, {
"name": "children",
"type": "boolean",
"description": "Whether to index any child data stores as well",
"required": false,
"default": false,
"args": ["children", "c"]
}, {
"name": "username",
"type": "string",
"description": "Admin username",
"required": true,
"args": ["username", "u"]
}, {
"name": "password",
"type": "string",
"description": "Admin password",
"required": true,
"hidden": true,
"args": ["password", "p"]
}]
}
});
}
handle(options, callback)
{
// call workhorse function
helper.rebuildDatastoreIndexes(options.datastoreTypeId, options.datastoreId, options.children, options.username, options.password, function(err) {
callback(err);
});
}
}
module.exports = RebuildDatastoreIndexesCommand;