cloudcms-cli
Version:
Cloud CMS Command-Line client
67 lines (57 loc) • 2.08 kB
JavaScript
var helper = require("../../../helper");
var AbstractCommand = require("../../abstract");
class FindDeploymentRecordCommand extends AbstractCommand
{
constructor()
{
super({
"group": "deployment",
"name": "find-deployment-records",
"description": "Finds deployment records for a given node",
"schema": {
"properties": [{
"name": "repositoryId",
"type": "string",
"description": "Enter the repository ID",
"required": true,
"args": ["repository", "r"]
}, {
"name": "branchId",
"type": "string",
"description": "Enter the branch ID",
"required": true,
"args": ["branch", "b"]
}, {
"name": "nodeId",
"type": "string",
"description": "Enter a node ID",
"required": true,
"args": ["node", "id"]
}]
}
});
}
handle(options, callback)
{
var repositoryId = options.repositoryId;
var branchId = options.branchId;
var nodeId = options.nodeId;
helper.appConnect(function(err) {
if (err) {
return callback(err);
}
this.readRepository(repositoryId).then(function() {
this.readBranch(branchId).then(function() {
this.readNode(nodeId).then(function() {
var query = {};
query["ref"] = this.ref();
helper._handleGitanaPost("/deployment/records/query", {}, query, function(err, jsonResponse) {
helper._handleJsonResponse(err, jsonResponse, callback);
});
});
});
});
});
}
}
module.exports = FindDeploymentRecordCommand;