/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ "use strict"; var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb; var fs = require("fs");


















var __ = require("underscore");
var util = require("util");
var utils = require("../../../util/utils");
var HdiClient = require("./hdiClient");

var $ = utils.getLocaleString;

var UserInteractor = function(cli) {
  var self = this;
  this.cli = cli;
  this.log = cli.output;
  this.progress = null;

  function logErrorAndData(err, data) {
    self.cli.interaction.formatOutput(data, function(outputData) {
      self.log.error(err);
      self.cli.interaction.logEachData("HDInsight Cluster", outputData); }); };



  this.logErrorAndData = logErrorAndData;

  this.checkpoint = function() {  };

  function logError(err) {
    self.cli.interaction.formatOutput(err, function() {
      self.log.error(err); }); };



  this.logError = logError;

  function logData(msg, data) {
    self.cli.interaction.formatOutput(data, function(outputData) {
      self.cli.interaction.logEachData(msg, outputData); }); };



  this.logData = logData;

  function logList(list) {
    self.cli.interaction.formatOutput(list, function(outputData) {
      if ((outputData.length === 0)) {
        self.log.info("No HDInsight clusters exist"); }
       else {
        self.log.table(list, function(row, item) {
          row.cell("Name", item.Name);
          row.cell("Location", item.Location);
          row.cell("State", item.State); }); } ; }); };





  this.logList = logList;

  function promptIfNotGiven(message, value, _) { var __frame = { name: "promptIfNotGiven", line: 76 }; return __func(_, this, arguments, promptIfNotGiven, 2, __frame, function __$promptIfNotGiven() {
      return self.cli.interaction.promptIfNotGiven(message, value, __cb(_, __frame, 1, 32, _, true)); }); };


  this.promptIfNotGiven = promptIfNotGiven;

  function startProgress(message) {
    self.progress = self.cli.interaction.progress(message); };


  this.startProgress = startProgress;

  function endProgress() {
    self.progress.end(); };


  this.endProgress = endProgress;

  function writeConfig(filePath, config) {
    var data = JSON.stringify(config);
    fs.writeFileSync(filePath, data); };


  this.writeConfig = writeConfig;

  function readConfig(filePath) {
    var data = fs.readFileSync(filePath);
    return JSON.parse(data); };


  this.readConfig = readConfig;

  function logClusterOperationInfo(result) {

    if (((result === null) || (result === undefined))) {
      self.log.info("Cluster not found."); }
     else {
      if (self.log.format().json) {
        self.log.json(result); }
       else {
        self.log.data($("Operation Info "));
        self.log.data($("---------------"));
        self.log.data($("Operation status: "), result.status);
        self.log.data($("Operation ID: "), result.requestId); } ; } ; };




  this.logClusterOperationInfo = logClusterOperationInfo;};


var ExecutionProcessor = function(cli) {
  var self = this;
  this.cli = cli;
  this.errorCount = 0;

  this.createHdiClient = function(cli, subscription) {
    return new HdiClient(cli, subscription); };


  this.createCluster = function createCluster__1(resourceGroupName, clusterName, createParams, options, _) { var hdInsight, result, __this = this; var __frame = { name: "createCluster__1", line: 136 }; return __func(_, this, arguments, createCluster__1, 4, __frame, function __$createCluster__1() {
      hdInsight = __this.createHdiClient(cli, options.subscription);
      return hdInsight.createCluster(resourceGroupName, clusterName, createParams, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.getCluster = function getCluster__2(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "getCluster__2", line: 142 }; return __func(_, this, arguments, getCluster__2, 3, __frame, function __$getCluster__2() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.getCluster(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.deleteCluster = function deleteCluster__3(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "deleteCluster__3", line: 148 }; return __func(_, this, arguments, deleteCluster__3, 3, __frame, function __$deleteCluster__3() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.deleteCluster(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.listClusters = function listClusters__4(resourceGroupName, options, _) { var hdInsight, result; var __frame = { name: "listClusters__4", line: 154 }; return __func(_, this, arguments, listClusters__4, 2, __frame, function __$listClusters__4() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.listClusters(resourceGroupName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.resizeCluster = function resizeCluster__5(resourceGroupName, clusterName, targetInstanceCount, options, _) { var hdInsight, result; var __frame = { name: "resizeCluster__5", line: 160 }; return __func(_, this, arguments, resizeCluster__5, 4, __frame, function __$resizeCluster__5() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.resizeCluster(resourceGroupName, clusterName, targetInstanceCount, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.listPersistedScripts = function listPersistedScripts__6(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "listPersistedScripts__6", line: 166 }; return __func(_, this, arguments, listPersistedScripts__6, 3, __frame, function __$listPersistedScripts__6() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.listPersistedScripts(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.listScriptExecutionHistory = function listScriptExecutionHistory__7(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "listScriptExecutionHistory__7", line: 172 }; return __func(_, this, arguments, listScriptExecutionHistory__7, 3, __frame, function __$listScriptExecutionHistory__7() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.listScriptExecutionHistory(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.getScriptExecutionDetail = function getScriptExecutionDetail__8(resourceGroupName, clusterName, scriptExecutionId, options, _) { var hdInsight, result; var __frame = { name: "getScriptExecutionDetail__8", line: 178 }; return __func(_, this, arguments, getScriptExecutionDetail__8, 4, __frame, function __$getScriptExecutionDetail__8() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.getScriptExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.promoteScript = function promoteScript__9(resourceGroupName, clusterName, scriptExecutionId, options, _) { var hdInsight, result; var __frame = { name: "promoteScript__9", line: 184 }; return __func(_, this, arguments, promoteScript__9, 4, __frame, function __$promoteScript__9() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.promoteScript(resourceGroupName, clusterName, scriptExecutionId, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.deletePersistedScript = function deletePersistedScript__10(resourceGroupName, clusterName, name, options, _) { var hdInsight, result; var __frame = { name: "deletePersistedScript__10", line: 190 }; return __func(_, this, arguments, deletePersistedScript__10, 4, __frame, function __$deletePersistedScript__10() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.deletePersistedScript(resourceGroupName, clusterName, name, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.executeScriptActions = function executeScriptActions__11(resourceGroupName, clusterName, executeScriptActionParameters, options, _) { var hdInsight, result; var __frame = { name: "executeScriptActions__11", line: 196 }; return __func(_, this, arguments, executeScriptActions__11, 4, __frame, function __$executeScriptActions__11() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.executeScriptActions(resourceGroupName, clusterName, executeScriptActionParameters, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.enableHttp = function enableHttp__12(resourceGroupName, clusterName, userName, password, options, _) { var hdInsight, result; var __frame = { name: "enableHttp__12", line: 202 }; return __func(_, this, arguments, enableHttp__12, 5, __frame, function __$enableHttp__12() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.enableHttp(resourceGroupName, clusterName, userName, password, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.disableHttp = function disableHttp__13(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "disableHttp__13", line: 208 }; return __func(_, this, arguments, disableHttp__13, 3, __frame, function __$disableHttp__13() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.disableHttp(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.enableRdp = function enableRdp__14(resourceGroupName, clusterName, rdpUserName, rdpPassword, rdpExpiryDate, options, _) { var hdInsight, result; var __frame = { name: "enableRdp__14", line: 214 }; return __func(_, this, arguments, enableRdp__14, 6, __frame, function __$enableRdp__14() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.enableRdp(resourceGroupName, clusterName, rdpUserName, rdpPassword, rdpExpiryDate, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.disableRdp = function disableRdp__15(resourceGroupName, clusterName, options, _) { var hdInsight, result; var __frame = { name: "disableRdp__15", line: 220 }; return __func(_, this, arguments, disableRdp__15, 3, __frame, function __$disableRdp__15() {
      hdInsight = self.createHdiClient(cli, options.subscription);
      return hdInsight.disableRdp(resourceGroupName, clusterName, __cb(_, __frame, 2, 27, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); };


  this.createConfigFile = function(configFilePath, options) {
    var hdInsight = self.createHdiClient(cli, options.subscription);
    var result = hdInsight.createConfigFile(configFilePath, options);
    return result; };


  this.addConfigValue = function(configFilePath, options) {
    var hdInsight = self.createHdiClient(cli, options.subscription);
    var result = hdInsight.addConfigValue(configFilePath, options);
    return result; };


  this.addScriptAction = function(configFilePath, options) {
    var hdInsight = self.createHdiClient(cli, options.subscription);
    var result = hdInsight.addScriptAction(configFilePath, options);
    return result; };};



var hdInsightCommandLine = function(cli, userInteractor, executionProcessor) {
  this.cli = cli;
  this.log = cli.output;
  var self = this;
  if (userInteractor) {
    this.user = userInteractor; }
   else {
    this.user = new UserInteractor(this.cli); } ;


  if (executionProcessor) {
    this.processor = executionProcessor; }
   else {
    this.processor = new ExecutionProcessor(this.cli); } ;


  this.createClusterCommand = function createClusterCommand__1(clusterName, options, _) { var additionalStorageAccountsList, configurationsFileContent, clusterCreateParameters, result; var __frame = { name: "createClusterCommand__1", line: 261 }; return __func(_, this, arguments, createClusterCommand__1, 2, __frame, function __$createClusterCommand__1() {

      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 3, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("OS type: "), options.osType, __cb(_, __frame, 4, 31, function ___(__0, __3) { options.osType = __3;
            return self.user.promptIfNotGiven($("Data center location: "), options.location, __cb(_, __frame, 5, 33, function ___(__0, __4) { options.location = __4;
              return self.user.promptIfNotGiven($("storage account url: "), options.defaultStorageAccountName, __cb(_, __frame, 6, 50, function ___(__0, __5) { options.defaultStorageAccountName = __5;
                return self.user.promptIfNotGiven($("storage account key: "), options.defaultStorageAccountKey, __cb(_, __frame, 7, 49, function ___(__0, __6) { options.defaultStorageAccountKey = __6;
                  return self.user.promptIfNotGiven($("storage container name: "), options.defaultStorageContainer, __cb(_, __frame, 8, 48, function ___(__0, __7) { options.defaultStorageContainer = __7;
                    return self.user.promptIfNotGiven($("Number of worker nodes: "), options.workerNodeCount, __cb(_, __frame, 9, 40, function ___(__0, __8) { options.workerNodeCount = __8;
                      return self.user.promptIfNotGiven($("User name: "), options.userName, __cb(_, __frame, 10, 33, function ___(__0, __9) { options.userName = __9;
                        return self.user.promptIfNotGiven($("Password: "), options.password, __cb(_, __frame, 11, 33, function ___(__0, __10) { options.password = __10;


                          if (utils.stringIsNullOrEmpty(options.osType)) {
                            options.osType = "Windows"; } ;


                          if (utils.stringIsNullOrEmpty(options.version)) {
                            options.version = "default"; } ; return (function __$createClusterCommand__1(__then) {


                            if (utils.ignoreCaseEquals(options.osType, "windows")) {
                              return self.user.promptIfNotGiven($("Head node size (string): "), options.headNodeSize, __cb(_, __frame, 23, 39, function ___(__0, __11) { options.headNodeSize = __11;
                                return self.user.promptIfNotGiven($("Data node size (string): "), options.workerNodeSize, __cb(_, __frame, 24, 41, function ___(__0, __12) { options.workerNodeSize = __12; __then(); }, true)); }, true)); } else { return (function __$createClusterCommand__1(__then) {

                                if (utils.ignoreCaseEquals(options.osType, "linux")) {
                                  return self.user.promptIfNotGiven($("SSH user name: "), options.sshUserName, __cb(_, __frame, 27, 38, function ___(__0, __13) { options.sshUserName = __13;
                                    return self.user.promptIfNotGiven($("SSH password: "), options.sshPassword, __cb(_, __frame, 28, 38, function ___(__0, __14) { options.sshPassword = __14; __then(); }, true)); }, true)); } else { __then(); } ; })(__then); } ; })(function __$createClusterCommand__1() {


                            if (!utils.stringIsNullOrEmpty(options.additionalStorageAccounts)) {
                              additionalStorageAccountsList = [];
                              options.additionalStorageAccounts.split(";").forEach(function(account) {
                                var kvp = account.split("#");
                                var item = {
                                  key: kvp[0],
                                  value: kvp[1] };

                                additionalStorageAccountsList.push(item); });

                              options.additionalStorageAccounts = additionalStorageAccountsList; } ; return (function __$createClusterCommand__1(__then) {


                              if ((((!utils.stringIsNullOrEmpty(options.hiveMetastoreServerName) || !utils.stringIsNullOrEmpty(options.hiveMetastoreDatabaseName)) || !utils.stringIsNullOrEmpty(options.hiveMetastoreUserName)) || !utils.stringIsNullOrEmpty(options.hiveMetastorePassword))) {
                                return self.user.promptIfNotGiven($("Hive metastore Server name: "), options.hiveMetastoreServerName, __cb(_, __frame, 45, 50, function ___(__0, __15) { options.hiveMetastoreServerName = __15;
                                  return self.user.promptIfNotGiven($("Hive metastore database name: "), options.hiveMetastoreDatabaseName, __cb(_, __frame, 46, 52, function ___(__0, __16) { options.hiveMetastoreDatabaseName = __16;
                                    return self.user.promptIfNotGiven($("Hive metastore database username: "), options.hiveMetastoreUserName, __cb(_, __frame, 47, 48, function ___(__0, __17) { options.hiveMetastoreUserName = __17;
                                      return self.user.promptIfNotGiven($("Hive metastore database password: "), options.hiveMetastorePassword, __cb(_, __frame, 48, 48, function ___(__0, __18) { options.hiveMetastorePassword = __18;

                                        options.hiveMetastore = {
                                          server: options.hiveMetastoreServerName,
                                          database: options.hiveMetastoreDatabaseName,
                                          user: options.hiveMetastoreUserName,
                                          password: options.hiveMetastorePassword }; __then(); }, true)); }, true)); }, true)); }, true)); } else { __then(); } ; })(function __$createClusterCommand__1() { return (function __$createClusterCommand__1(__then) {



                                if ((((!utils.stringIsNullOrEmpty(options.oozieMetastoreServerName) || !utils.stringIsNullOrEmpty(options.oozieMetastoreDatabaseName)) || !utils.stringIsNullOrEmpty(options.oozieMetastoreUserName)) || !utils.stringIsNullOrEmpty(options.oozieMetastorePassword))) {
                                  return self.user.promptIfNotGiven($("Oozie metastore Server name: "), options.oozieMetastoreServerName, __cb(_, __frame, 59, 51, function ___(__0, __19) { options.oozieMetastoreServerName = __19;
                                    return self.user.promptIfNotGiven($("Oozie metastore database name: "), options.oozieMetastoreDatabaseName, __cb(_, __frame, 60, 53, function ___(__0, __20) { options.oozieMetastoreDatabaseName = __20;
                                      return self.user.promptIfNotGiven($("Oozie metastore database username: "), options.oozieMetastoreUserName, __cb(_, __frame, 61, 49, function ___(__0, __21) { options.oozieMetastoreUserName = __21;
                                        return self.user.promptIfNotGiven($("Oozie metastore database password: "), options.oozieMetastorePassword, __cb(_, __frame, 62, 49, function ___(__0, __22) { options.oozieMetastorePassword = __22;

                                          options.oozieMetastore = {
                                            server: options.oozieMetastoreServerName,
                                            database: options.oozieMetastoreDatabaseName,
                                            user: options.oozieMetastoreUserName,
                                            password: options.oozieMetastorePassword }; __then(); }, true)); }, true)); }, true)); }, true)); } else { __then(); } ; })(function __$createClusterCommand__1() {



                                if (!utils.stringIsNullOrEmpty(options.configurationPath)) {
                                  configurationsFileContent = self.user.readConfig(options.configurationPath);
                                  options.configurations = configurationsFileContent["configurations"];
                                  options.scriptActions = configurationsFileContent["scriptActions"]; } ;


                                self.user.startProgress($("Submitting the request to create cluster..."));

                                clusterCreateParameters = {
                                  location: options.location,
                                  defaultStorageAccountName: options.defaultStorageAccountName,
                                  defaultStorageAccountKey: options.defaultStorageAccountKey,
                                  defaultStorageContainer: options.defaultStorageContainer,
                                  userName: options.userName,
                                  password: options.password,
                                  rdpUserName: options.rdpUserName,
                                  rdpPassword: options.rdpPassword,
                                  rdpAccessExpiry: options.rdpAccessExpiry,
                                  clusterSizeInNodes: options.workerNodeCount,
                                  version: options.version,
                                  headNodeSize: options.headNodeSize,
                                  workerNodeSize: options.workerNodeSize,
                                  zookeeperNodeSize: options.zookeeperNodeSize,
                                  clusterType: options.clusterType,
                                  virtualNetworkId: options.virtualNetworkId,
                                  subnetName: options.subnetName,
                                  osType: options.osType,
                                  clusterTier: options.clusterTier,
                                  sshUserName: options.sshUserName,
                                  sshPassword: options.sshPassword,
                                  sshPublicKey: options.sshPublicKey,
                                  oozieMetastore: options.oozieMetastore,
                                  hiveMetastore: options.hiveMetastore,
                                  additionalStorageAccounts: options.additionalStorageAccounts,
                                  configurations: options.configurations,
                                  scriptActions: options.scriptActions };


                                return self.processor.createCluster(options.resourceGroup, clusterName, clusterCreateParameters, options, __cb(_, __frame, 110, 32, function ___(__0, __23) { result = __23;
                                  self.user.endProgress();

                                  if (self.log.format().json) {
                                    self.log.json(result); }
                                   else {

                                    if (((result !== null) && (result !== undefined))) {
                                      self.log.data($("Cluster ID  :"), result.id);
                                      self.log.data($("Status      :"), result.status); }
                                     else {
                                      self.log.data($("Cluster creation response is empty.")); } ; } ; _(); }, true)); }); }); }); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); };




  this.showClusterCommand = function showClusterCommand__2(clusterName, options, _) { var result, cluster, clusterInfo; var __frame = { name: "showClusterCommand__2", line: 387 }; return __func(_, this, arguments, showClusterCommand__2, 2, __frame, function __$showClusterCommand__2() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Getting HDInsight cluster details"));

          return self.processor.getCluster(options.resourceGroup, clusterName, options, __cb(_, __frame, 6, 32, function ___(__0, __3) { result = __3;

            cluster = null;
            if (((result !== null) && (result !== undefined))) {
              cluster = result.cluster; } ;

            self.user.endProgress();

            if (((cluster === undefined) || (cluster === null))) {
              self.log.data($("Cluster could not be found.")); }
             else {
              clusterInfo = cluster;
              if (self.log.format().json) {
                self.log.json(clusterInfo); }
               else {
                self.log.data($("HDInsight Cluster Info"));
                self.log.data($("----------------------"));
                self.log.data($("Name          :"), (clusterInfo.id || clusterInfo.dnsName));
                self.log.data($("State         :"), clusterInfo.state);
                self.log.data($("Location      :"), clusterInfo.location);
                self.log.data($("Version       :"), (clusterInfo.version || clusterInfo.hdiVersion)); } ; } ; _(); }, true)); }, true)); }, true)); }); };




  this.listClustersCommand = function listClustersCommand__3(options, _) { var result, clusters; var __frame = { name: "listClustersCommand__3", line: 418 }; return __func(_, this, arguments, listClustersCommand__3, 1, __frame, function __$listClustersCommand__3() {
      self.user.startProgress($("Getting HDInsight servers"));
      return self.processor.listClusters(options.resourceGroup, options, __cb(_, __frame, 2, 32, function ___(__0, __1) { result = __1;
        self.user.endProgress();

        if ((result.length === 0)) {
          self.log.data($("No clusters found.")); } else {
          if (self.log.format().json) {
            self.log.json(result); }
           else {

            clusters = [];
            result.clusters.forEach(function(c) {
              var cluster = { };
              cluster.eTag = c.eTag;
              cluster.id = c.id;
              cluster.location = c.location;
              cluster.name = c.name;
              cluster.clusterState = c.properties.clusterState;
              cluster.clusterVersion = c.properties.clusterVersion;
              cluster.createdDate = c.properties.createdDate;
              cluster.osType = c.properties.operatingSystemType;
              cluster.clusterTier = c.properties.clusterTier;
              cluster.provisioningState = c.properties.provisioningState;
              clusters.push(cluster); });


            self.cli.interaction.formatOutput(clusters, function(outputData) {
              self.log.table(outputData, function(row, item) {
                row.cell("Name", item.name);
                row.cell("ETag", item.eTag);
                row.cell("ID", item.id);
                row.cell("State", item.clusterState);
                row.cell("ProvisioningState", item.provisioningState);
                row.cell("CreatedDate", item.createdDate);
                row.cell("Location", item.location);
                row.cell("Version", item.clusterVersion);
                row.cell("OsType", (item.osType || "Windows Server 2012"));
                row.cell("Tier", item.clusterTier); }); }); } ; } ; _(); }, true)); }); };





  this.deleteClusterCommand = function deleteClusterCommand__4(clusterName, options, _) { var __frame = { name: "deleteClusterCommand__4", line: 462 }; return __func(_, this, arguments, deleteClusterCommand__4, 2, __frame, function __$deleteClusterCommand__4() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Deleting HDInsight Cluster"));

          return self.processor.deleteCluster(options.resourceGroup, clusterName, options, __cb(_, __frame, 6, 19, function __$deleteClusterCommand__4() {

            self.user.endProgress(); _(); }, true)); }, true)); }, true)); }); };


  this.resizeClusterCommand = function resizeClusterCommand__5(clusterName, targetInstanceCount, options, _) { var result; var __frame = { name: "resizeClusterCommand__5", line: 473 }; return __func(_, this, arguments, resizeClusterCommand__5, 3, __frame, function __$resizeClusterCommand__5() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("TargetInstanceCount: "), clusterName, __cb(_, __frame, 3, 44, function ___(__0, __3) { options.targetInstanceCount = __3;
            self.user.startProgress($("Resizing HDInsight Cluster"));

            return self.processor.resizeCluster(options.resourceGroup, clusterName, targetInstanceCount, options, __cb(_, __frame, 6, 32, function ___(__0, __4) { result = __4;

              self.user.logClusterOperationInfo(result);

              self.user.endProgress(); _(); }, true)); }, true)); }, true)); }, true)); }); };


  this.listPersistedScriptsCommand = function listPersistedScriptsCommand__6(clusterName, options, _) { var result; var __frame = { name: "listPersistedScriptsCommand__6", line: 486 }; return __func(_, this, arguments, listPersistedScriptsCommand__6, 2, __frame, function __$listPersistedScriptsCommand__6() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Getting persisted script actions"));
          return self.processor.listPersistedScripts(options.resourceGroup, clusterName, options, __cb(_, __frame, 5, 32, function ___(__0, __3) { result = __3;
            self.user.endProgress();

            if (((result === null) || (result === undefined))) {
              self.log.info($("Cluster not found.")); return _(null); } ;



            if ((result.length === 0)) {
              self.log.data($("No script found.")); } else {
              if (self.log.format().json) {
                self.log.json(result); }
               else {
                self.cli.interaction.formatOutput(result.persistedScriptActions, function(outputData) {
                  self.log.table(outputData, function(row, item) {
                    if (((item.applicationName === null) || (item.applicationName === undefined))) { item.applicationName = ""; } ;
                    row.cell("Name", item.name);
                    row.cell("Uri", item.uri);
                    row.cell("Parameters", item.parameters);
                    row.cell("Roles", JSON.stringify(item.roles));
                    row.cell("Application Name", item.applicationName); }); }); } ; } ; _(); }, true)); }, true)); }, true)); }); };





  this.showPersistedScriptsCommand = function showPersistedScriptsCommand__7(clusterName, name, options, _) { var result, filteredScripts, item; var __frame = { name: "showPersistedScriptsCommand__7", line: 517 }; return __func(_, this, arguments, showPersistedScriptsCommand__7, 3, __frame, function __$showPersistedScriptsCommand__7() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Script name: "), name, __cb(_, __frame, 2, 21, function ___(__0, __2) { name = __2;
          return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 3, 28, function ___(__0, __3) { clusterName = __3;

            self.user.startProgress($("Getting persisted script action"));
            return self.processor.listPersistedScripts(options.resourceGroup, clusterName, options, __cb(_, __frame, 6, 32, function ___(__0, __4) { result = __4;
              self.user.endProgress();

              if (((result === null) || (result === undefined))) {
                self.log.info($("Cluster not found.")); return _(null); } ;



              filteredScripts = result.persistedScriptActions.filter(function(script) {
                return (script.name.toUpperCase() === name.toUpperCase()); });

              if ((filteredScripts.length === 0)) {
                self.log.data($("No script with corresponding name found.")); } else {
                if (self.log.format().json) {
                  self.log.json(filteredScripts[0]); }
                 else {
                  item = filteredScripts[0];
                  self.log.data($("Persisted Script Info"));
                  self.log.data($("---------------------"));
                  self.log.data($("Name             :"), item.name);
                  self.log.data($("Uri              :"), item.uri);
                  self.log.data($("Parameters       :"), item.parameters);
                  self.log.data($("Roles            :"), JSON.stringify(item.roles));
                  self.log.data($("Application Name :"), item.applicationName); } ; } ; _(); }, true)); }, true)); }, true)); }, true)); }); };



  this.promoteScriptCommand = function promoteScriptCommand__8(clusterName, scriptExecutionId, options, _) { var __frame = { name: "promoteScriptCommand__8", line: 550 }; return __func(_, this, arguments, promoteScriptCommand__8, 3, __frame, function __$promoteScriptCommand__8() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Script Execution Id: "), scriptExecutionId, __cb(_, __frame, 2, 34, function ___(__0, __2) { scriptExecutionId = __2;
          return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 3, 28, function ___(__0, __3) { clusterName = __3;

            self.user.startProgress($("Promoting script to persisted"));
            return self.processor.promoteScript(options.resourceGroup, clusterName, scriptExecutionId, options, __cb(_, __frame, 6, 19, function __$promoteScriptCommand__8() {
              self.user.endProgress(); _(); }, true)); }, true)); }, true)); }, true)); }); };


  this.deletePersistedScriptCommand = function deletePersistedScriptCommand__9(clusterName, name, options, _) { var __frame = { name: "deletePersistedScriptCommand__9", line: 560 }; return __func(_, this, arguments, deletePersistedScriptCommand__9, 3, __frame, function __$deletePersistedScriptCommand__9() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Script name: "), name, __cb(_, __frame, 2, 21, function ___(__0, __2) { name = __2;
          return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 3, 28, function ___(__0, __3) { clusterName = __3;

            self.user.startProgress($("Deleting persisted script"));
            return self.processor.deletePersistedScript(options.resourceGroup, clusterName, name, options, __cb(_, __frame, 6, 19, function __$deletePersistedScriptCommand__9() {
              self.user.endProgress(); _(); }, true)); }, true)); }, true)); }, true)); }); };


  this.listScriptExecutionHistoryCommand = function listScriptExecutionHistoryCommand__10(clusterName, options, _) { var result; var __frame = { name: "listScriptExecutionHistoryCommand__10", line: 570 }; return __func(_, this, arguments, listScriptExecutionHistoryCommand__10, 2, __frame, function __$listScriptExecutionHistoryCommand__10() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Getting script action execution history"));
          return self.processor.listScriptExecutionHistory(options.resourceGroup, clusterName, options, __cb(_, __frame, 5, 32, function ___(__0, __3) { result = __3;
            self.user.endProgress();

            if (((result === null) || (result === undefined))) {
              self.log.info($("Cluster not found.")); return _(null); } ;



            if ((result.length === 0)) {
              self.log.data($("No script execution found.")); } else {
              if (self.log.format().json) {
                self.log.json(result); }
               else {
                self.cli.interaction.formatOutput(result.runtimeScriptActionDetail, function(outputData) {
                  self.log.table(outputData, function(row, item) {
                    if (((item.applicationName === null) || (item.applicationName === undefined))) { item.applicationName = ""; } ;
                    if (((item.startTime === null) || (item.startTime === undefined))) { item.startTime = ""; } ;
                    if (((item.endTime === null) || (item.endTime === undefined))) { item.endTime = ""; } ;
                    row.cell("ScriptExecutionId", item.scriptExecutionId);
                    row.cell("Name", item.name);
                    row.cell("ApplicationName", item.applicationName);
                    row.cell("Uri", item.uri);
                    row.cell("Roles", JSON.stringify(item.roles));
                    row.cell("StartTime", item.startTime);
                    row.cell("EndTime", item.endTime);
                    row.cell("Status", item.status);
                    row.cell("Operation", item.operation);
                    row.cell("ExecutionSummary", JSON.stringify(item.executionSummary)); }); }); } ; } ; _(); }, true)); }, true)); }, true)); }); };





  this.showScriptExecutionDetailCommand = function showScriptExecutionDetailCommand__11(clusterName, scriptExecutionId, options, _) { var result, item; var __frame = { name: "showScriptExecutionDetailCommand__11", line: 608 }; return __func(_, this, arguments, showScriptExecutionDetailCommand__11, 3, __frame, function __$showScriptExecutionDetailCommand__11() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("Script Execution Id: "), scriptExecutionId, __cb(_, __frame, 3, 34, function ___(__0, __3) { scriptExecutionId = __3;

            self.user.startProgress($("Getting script action execution detail"));
            return self.processor.getScriptExecutionDetail(options.resourceGroup, clusterName, scriptExecutionId, options, __cb(_, __frame, 6, 32, function ___(__0, __4) { result = __4;
              self.user.endProgress();

              if (((result === undefined) || (result === null))) {
                self.log.data($("Script execution could not be found.")); }
               else {
                if (self.log.format().json) {
                  self.log.json(result); }
                 else {
                  item = result.runtimeScriptActionDetail;
                  self.log.data($("Script Execution Detail:"));
                  self.log.data($("----------------------"));
                  self.log.data($("ScriptExecutionId :"), item.scriptExecutionId);
                  self.log.data($("Name              :"), item.name);
                  self.log.data($("ApplicationName   :"), item.applicationName);
                  self.log.data($("Uri               :"), item.uri);
                  self.log.data($("Roles             :"), JSON.stringify(item.roles));
                  self.log.data($("StartTime         :"), item.startTime);
                  self.log.data($("EndTime           :"), item.endTime);
                  self.log.data($("Status            :"), item.status);
                  self.log.data($("Operation         :"), item.operation);
                  self.log.data($("ExecutionSummary  :"), JSON.stringify(item.executionSummary));
                  self.log.data($("DebugInformation  :"), item.debugInformation); } ; } ; _(); }, true)); }, true)); }, true)); }, true)); }); };




  this.executeScriptActionsCommand = function executeScriptActionsCommand__12(clusterName, options, _) { var nodeTypesList, executeScriptActionParameters, scriptAction, result; var __frame = { name: "executeScriptActionsCommand__12", line: 641 }; return __func(_, this, arguments, executeScriptActionsCommand__12, 2, __frame, function __$executeScriptActionsCommand__12() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("Script name: "), options.name, __cb(_, __frame, 3, 29, function ___(__0, __3) { options.name = __3;
            return self.user.promptIfNotGiven($("Script uri: "), options.uri, __cb(_, __frame, 4, 28, function ___(__0, __4) { options.uri = __4;
              return self.user.promptIfNotGiven($("Node types: "), options.nodeTypes, __cb(_, __frame, 5, 34, function ___(__0, __5) { options.nodeTypes = __5;
                if ((options.applicationName && options.persistOnSuccess)) {
                  return _(new Error($("--applicationName and --persistOnSuccess are mutually exclusive."))); } ;


                nodeTypesList = [];
                options.nodeTypes.split(";").forEach(function(nodeType) {
                  nodeTypesList.push(nodeType); });


                executeScriptActionParameters = { };
                executeScriptActionParameters.persistOnSuccess = (options.persistOnSuccess ? true : false);
                scriptAction = { };
                scriptAction.name = options.name;
                scriptAction.uri = options.uri;
                scriptAction.parameters = options.parameters;
                scriptAction.roles = nodeTypesList;
                scriptAction.applicationName = options.applicationName;
                executeScriptActionParameters.scriptActions = [];
                executeScriptActionParameters.scriptActions.push(scriptAction);

                self.user.startProgress($("Executing Script Action on HDInsight cluster"));
                return self.processor.executeScriptActions(options.resourceGroup, clusterName, executeScriptActionParameters, options, __cb(_, __frame, 27, 32, function ___(__0, __6) { result = __6;
                  self.user.endProgress();

                  self.user.logClusterOperationInfo(result); _(); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); };


  this.enableHttpAccessCommand = function enableHttpAccessCommand__13(clusterName, userName, password, options, _) { var result; var __frame = { name: "enableHttpAccessCommand__13", line: 674 }; return __func(_, this, arguments, enableHttpAccessCommand__13, 4, __frame, function __$enableHttpAccessCommand__13() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("Http username: "), userName, __cb(_, __frame, 3, 25, function ___(__0, __3) { userName = __3;
            return self.user.promptIfNotGiven($("Http password: "), password, __cb(_, __frame, 4, 25, function ___(__0, __4) { password = __4;

              self.user.startProgress($("Enabling HTTP access for HDInsight cluster"));

              return self.processor.enableHttp(options.resourceGroup, clusterName, userName, password, options, __cb(_, __frame, 8, 32, function ___(__0, __5) { result = __5;

                self.user.endProgress();

                self.user.logClusterOperationInfo(result); _(); }, true)); }, true)); }, true)); }, true)); }, true)); }); };



  this.disableHttpAccessCommand = function disableHttpAccessCommand__14(clusterName, options, _) { var result; var __frame = { name: "disableHttpAccessCommand__14", line: 690 }; return __func(_, this, arguments, disableHttpAccessCommand__14, 2, __frame, function __$disableHttpAccessCommand__14() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Disabling HTTP access for HDInsight cluster"));

          return self.processor.disableHttp(options.resourceGroup, clusterName, options, __cb(_, __frame, 6, 32, function ___(__0, __3) { result = __3;

            self.user.endProgress();

            self.user.logClusterOperationInfo(result); _(); }, true)); }, true)); }, true)); }); };



  this.enableRdpAccessCommand = function enableRdpAccessCommand__15(clusterName, rdpUserName, rdpPassword, rdpExpiryDate, options, _) { var rdpAccessExpiryDate, parsedExpiryDate, result; var __frame = { name: "enableRdpAccessCommand__15", line: 704 }; return __func(_, this, arguments, enableRdpAccessCommand__15, 5, __frame, function __$enableRdpAccessCommand__15() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;
          return self.user.promptIfNotGiven($("RDP username: "), rdpUserName, __cb(_, __frame, 3, 28, function ___(__0, __3) { rdpUserName = __3;
            return self.user.promptIfNotGiven($("RDP password: "), rdpPassword, __cb(_, __frame, 4, 28, function ___(__0, __4) { rdpPassword = __4;
              return self.user.promptIfNotGiven($("RDP expiry date: "), rdpExpiryDate, __cb(_, __frame, 5, 30, function ___(__0, __5) { rdpExpiryDate = __5;

                rdpAccessExpiryDate = new Date();
                parsedExpiryDate = Date.parse(rdpExpiryDate);
                if (__.isNaN(parsedExpiryDate)) {
                  return _(new Error(util.format($("%s parameter is not a valid Date \"%s\""), "rdpExpiryDate", rdpExpiryDate))); } ;

                rdpAccessExpiryDate = new Date(parsedExpiryDate);

                self.user.startProgress($("Enabling RDP access for HDInsight cluster"));

                return self.processor.enableRdp(options.resourceGroup, clusterName, rdpUserName, rdpPassword, rdpAccessExpiryDate, options, __cb(_, __frame, 16, 32, function ___(__0, __6) { result = __6;

                  self.user.endProgress();

                  self.user.logClusterOperationInfo(result); _(); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); };


  this.disableRdpAccessCommand = function disableRdpAccessCommand__16(clusterName, options, _) { var result; var __frame = { name: "disableRdpAccessCommand__16", line: 727 }; return __func(_, this, arguments, disableRdpAccessCommand__16, 2, __frame, function __$disableRdpAccessCommand__16() {
      return self.user.promptIfNotGiven($("Resource Group name: "), options.resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { options.resourceGroup = __1;
        return self.user.promptIfNotGiven($("Cluster name: "), clusterName, __cb(_, __frame, 2, 28, function ___(__0, __2) { clusterName = __2;

          self.user.startProgress($("Disabling RDP access for HDInsight cluster"));

          return self.processor.disableRdp(options.resourceGroup, clusterName, options, __cb(_, __frame, 6, 32, function ___(__0, __3) { result = __3;

            self.user.endProgress();

            self.user.logClusterOperationInfo(result); _(); }, true)); }, true)); }, true)); }); };


  this.createClusterConfigCommand = function createClusterConfigCommand__17(configFilePath, options, _) { var __frame = { name: "createClusterConfigCommand__17", line: 740 }; return __func(_, this, arguments, createClusterConfigCommand__17, 2, __frame, function __$createClusterConfigCommand__17() {
      return self.user.promptIfNotGiven($("Config file path: "), configFilePath, __cb(_, __frame, 1, 31, function ___(__0, __1) { configFilePath = __1;
        if (fs.existsSync(configFilePath)) {
          if (!options.overwrite) {
            self.user.logError($("File already exists. Choose overwrite option to overwrite the file.")); }
           else {
            self.user.logData($("File already exists and overwrite option is specified. Overwriting file."));
            self.processor.createConfigFile(configFilePath, options); } ; }

         else {
          self.user.startProgress($("Creates a new HDInsight cluster config file."));
          self.processor.createConfigFile(configFilePath, options); } ; _(); }, true)); }); };



  this.addConfigValue = function addConfigValue__18(configFilePath, options, _) { var __frame = { name: "addConfigValue__18", line: 755 }; return __func(_, this, arguments, addConfigValue__18, 2, __frame, function __$addConfigValue__18() {
      return self.user.promptIfNotGiven($("Config file path: "), configFilePath, __cb(_, __frame, 1, 31, function ___(__0, __1) { configFilePath = __1;

        if (!fs.existsSync(configFilePath)) {
          self.user.logError($("Config file does not exist")); }
         else {
          self.user.startProgress($("Adding config value to HDInsight cluster config file."));
          self.processor.addConfigValue(configFilePath, options); } ;

        self.user.endProgress(); _(); }, true)); }); };


  this.addScriptAction = function addScriptAction__19(configFilePath, options, _) { var __frame = { name: "addScriptAction__19", line: 767 }; return __func(_, this, arguments, addScriptAction__19, 2, __frame, function __$addScriptAction__19() {
      return self.user.promptIfNotGiven($("Config file path: "), configFilePath, __cb(_, __frame, 1, 31, function ___(__0, __1) { configFilePath = __1;
        return self.user.promptIfNotGiven($("Node type (Example: HeadNode, WorkerNode, ZookeeperNode): "), options.nodeType, __cb(_, __frame, 2, 33, function ___(__0, __2) { options.nodeType = __2;
          return self.user.promptIfNotGiven($("Name: "), options.name, __cb(_, __frame, 3, 29, function ___(__0, __3) { options.name = __3;
            return self.user.promptIfNotGiven($("Uri: "), options.uri, __cb(_, __frame, 4, 28, function ___(__0, __4) { options.uri = __4;

              if (!fs.existsSync(configFilePath)) {
                self.user.logError($("Config file does not exist")); }
               else {
                self.user.startProgress($("Adding script action to HDInsight cluster config file."));
                self.processor.addScriptAction(configFilePath, options); } ;


              self.user.endProgress(); _(); }, true)); }, true)); }, true)); }, true)); }); };};



module.exports = hdInsightCommandLine;

hdInsightCommandLine.init = function(cli) {
  var self = new hdInsightCommandLine(cli);

  var hdInsight = cli.category("hdinsight").description($("Commands to manage HDInsight clusters and jobs"));


  var cluster = hdInsight.category("cluster").description($("Commands to manage HDInsight clusters"));


  cluster.command("create [clusterName]").description($("Create a cluster in a resource group")).usage("[options] <clusterName>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-l, --location <location>", $("Data center location for the cluster")).option("-y, --osType <osType>", $("HDInsight cluster operating system - 'Windows' or 'Linux'")).option("--version <version>", $("HDInsight cluster version")).option("--clusterType <clusterType>", $("HDInsight cluster type. Hadoop | HBase | Spark | Storm")).option("--clusterTier <clusterTier>", $("HDInsight cluster tier. Standard | Premium")).option("--defaultStorageAccountName <storageAccountName>", $("Storage account url to use for default HDInsight storage")).option("--defaultStorageAccountKey <storageAccountKey>", $("Key to the storage account to use for default HDInsight storage")).option("--defaultStorageContainer <storageContainer>", $("Container in the storage account to use for HDInsight default storage")).option("--headNodeSize <headNodeSize>", $("(Optional) Head node size for the cluster")).option("--workerNodeCount <workerNodeCount>", $("Number of worker nodes to use for the cluster")).option("--workerNodeSize <workerNodeSize>", $("(Optional) Worker node size for the cluster)")).option("--zookeeperNodeSize <zookeeperNodeSize>", $("(Optional) Zookeeper node size for the cluster")).option("--userName <userName>", $("Cluster username")).option("--password <password>", $("Cluster password")).option("--sshUserName <sshUserName>", $("SSH username (only for Linux clusters)")).option("--sshPassword <sshPassword>", $("SSH password (only for Linux clusters)")).option("--sshPublicKey <sshPublicKey>", $("SSH public key (only for Linux clusters)")).option("--rdpUserName <rdpUserName>", $("RDP username (only for Windows clusters)")).option("--rdpPassword <rdpPassword>", $("RDP password (only for Windows clusters)")).option("--rdpAccessExpiry <rdpAccessExpiry>", $("RDP access expiry. For example 12/12/2015 (only for Windows clusters)")).option("--virtualNetworkId <virtualNetworkId>", $(("(Optional) Virtual network ID for the cluster. " + "Value is a GUID for Windows cluster and ARM resource ID for Linux cluster) "))).option("--subnetName <subnetName>", $("(Optional) Subnet for the cluster")).option("--additionalStorageAccounts <additionalStorageAccounts>", $(("(Optional) Additional storage accounts. Can be multiple. " + "In the format of 'accountName#accountKey'. For example, --additionalStorageAccounts \"acc1#key1;acc2#key2\""))).option("--hiveMetastoreServerName <hiveMetastoreServerName>", $("(Optional) SQL Server name for the external metastore for Hive")).option("--hiveMetastoreDatabaseName <hiveMetastoreDatabaseName>", $("(Optional) Database name for the external metastore for Hive")).option("--hiveMetastoreUserName <hiveMetastoreUserName>", $("(Optional) Database username for the external metastore for Hive")).option("--hiveMetastorePassword <hiveMetastorePassword>", $("(Optional) Database password for the external metastore for Hive")).option("--oozieMetastoreServerName <oozieMetastoreServerName>", $("(Optional) SQL Server name for the external metastore for Oozie")).option("--oozieMetastoreDatabaseName <oozieMetastoreDatabaseName>", $("(Optional) Database name for the external metastore for Oozie")).option("--oozieMetastoreUserName <oozieMetastoreUserName>", $("(Optional) Database username for the external metastore for Oozie")).option("--oozieMetastorePassword <oozieMetastorePassword>", $("(Optional) Database password for the external metastore for Oozie")).option("--configurationPath <configurationPath>", $("(Optional) HDInsight cluster configuration file path")).option("-s, --subscription <id>", $("The subscription id")).option("--tags <tags>", $(("Tags to set to the cluster. Can be multiple. " + "In the format of 'name=value'. Name is required and value is optional. For example, --tags tag1=value1;tag2"))).execute(function __1(clusterName, options, _) { var __frame = { name: "__1", line: 837 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() {










































      return self.createClusterCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__1() { _(); }, true)); }); });


  cluster.command("delete [clusterName]").description($("Delete a cluster")).usage("[options] <clusterName>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("--clusterName <clusterName>", $("Cluster name")).option("-q, --quiet", $("quiet mode (do not ask for delete confirmation)")).option("-s, --subscription <id>", $("The subscription id")).execute(function __2(clusterName, options, _) { var __frame = { name: "__2", line: 848 }; return __func(_, this, arguments, __2, 2, __frame, function __$__2() {







      return self.deleteClusterCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__2() { _(); }, true)); }); });


  cluster.command("show [clusterName]").description($("Show cluster details")).usage("[options] <clusterName>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __3(clusterName, options, _) { var __frame = { name: "__3", line: 858 }; return __func(_, this, arguments, __3, 2, __frame, function __$__3() {






      return self.showClusterCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__3() { _(); }, true)); }); });


  cluster.command("list").description($("List all the clusters (in a specific resource group if provided) .")).usage("[options]").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-s, --subscription <id>", $("The subscription id")).execute(function __4(options, _) { var __frame = { name: "__4", line: 867 }; return __func(_, this, arguments, __4, 1, __frame, function __$__4() {





      return self.listClustersCommand(options, __cb(_, __frame, 1, 11, function __$__4() { _(); }, true)); }); });


  cluster.command("resize [clusterName] [targetInstanceCount]").description($("Resizes the cluster")).usage("[options] <clusterName> <targetInstanceCount>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("--targetInstanceCount <targetInstanceCount>", $("Target instance count.")).option("-s, --subscription <id>", $("The subscription id")).execute(function __5(clusterName, targetInstanceCount, options, _) { var __frame = { name: "__5", line: 878 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() {







      return self.resizeClusterCommand(clusterName, targetInstanceCount, options, __cb(_, __frame, 1, 11, function __$__5() { _(); }, true)); }); });


  cluster.command("enable-http-access [clusterName] [userName] [password]").description($("Enable HTTP access for cluster")).usage("[options] <clusterName> <userName> <password>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("--userName <userName>", $("Cluster username")).option("--password <password>", $("Cluster password")).option("-s, --subscription <id>", $("The subscription id")).execute(function __6(clusterName, userName, password, options, _) { var __frame = { name: "__6", line: 890 }; return __func(_, this, arguments, __6, 4, __frame, function __$__6() {








      return self.enableHttpAccessCommand(clusterName, userName, password, options, __cb(_, __frame, 1, 11, function __$__6() { _(); }, true)); }); });


  cluster.command("disable-http-access [clusterName]").description($("Disable HTTP access for cluster")).usage("[options] <clusterName>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __7(clusterName, options, _) { var __frame = { name: "__7", line: 900 }; return __func(_, this, arguments, __7, 2, __frame, function __$__7() {






      return self.disableHttpAccessCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__7() { _(); }, true)); }); });


  cluster.command("enable-rdp-access [clusterName] [rdpUserName] [rdpPassword] [rdpExpiryDate]").description($("Enable RDP access for cluster")).usage("[options] <clusterName> <rdpUserName> <rdpPassword> <rdpExpiryDate>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("--rdpUserName <rdpUserName>", $("RDP username")).option("--rdpPassword <rdpPassword>", $("RDP password")).option("--rdpExpiryDate <rdpExpiryDate>", $("RDP access expiry date")).option("-s, --subscription <id>", $("The subscription id")).execute(function __8(clusterName, rdpUserName, rdpPassword, rdpExpiryDate, options, _) { var __frame = { name: "__8", line: 913 }; return __func(_, this, arguments, __8, 5, __frame, function __$__8() {









      return self.enableRdpAccessCommand(clusterName, rdpUserName, rdpPassword, rdpExpiryDate, options, __cb(_, __frame, 1, 11, function __$__8() { _(); }, true)); }); });


  cluster.command("disable-rdp-access [clusterName]").description($("Disable HTTP access for cluster")).usage("[options] <clusterName>").option("-g --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __9(clusterName, options, _) { var __frame = { name: "__9", line: 923 }; return __func(_, this, arguments, __9, 2, __frame, function __$__9() {






      return self.disableRdpAccessCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__9() { _(); }, true)); }); });


  var scriptAction = hdInsight.category("script-action").description($("Commands to manage HDInsight script actions"));


  var persistedScriptAction = scriptAction.category("persisted").description($("Commands to manage HDInsight persisted script actions"));


  var historyScriptAction = scriptAction.category("history").description($("Commands to manage HDInsight script action history"));


  persistedScriptAction.command("list [clusterName]").description($("Lists all persisted script actions")).usage("[options] <clusterName>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __10(clusterName, options, _) { var __frame = { name: "__10", line: 942 }; return __func(_, this, arguments, __10, 2, __frame, function __$__10() {






      return self.listPersistedScriptsCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__10() { _(); }, true)); }); });


  persistedScriptAction.command("show [clusterName] [name]").description($("Shows a persisted script action")).usage("[options] <clusterName> <name>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-n, --name <name>", $("Script name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __11(clusterName, name, options, _) { var __frame = { name: "__11", line: 953 }; return __func(_, this, arguments, __11, 3, __frame, function __$__11() {







      return self.showPersistedScriptsCommand(clusterName, name, options, __cb(_, __frame, 1, 11, function __$__11() { _(); }, true)); }); });


  persistedScriptAction.command("set [clusterName] [scriptExecutionId]").description($("Promotes script action to persisted")).usage("[options] <clusterName> <scriptExecutionId>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-e, --scriptExecutionId <scriptExecutionId>", $("Script execution id")).option("-s, --subscription <id>", $("The subscription id")).execute(function __12(clusterName, scriptExecutionId, options, _) { var __frame = { name: "__12", line: 964 }; return __func(_, this, arguments, __12, 3, __frame, function __$__12() {







      return self.promoteScriptCommand(clusterName, scriptExecutionId, options, __cb(_, __frame, 1, 11, function __$__12() { _(); }, true)); }); });


  persistedScriptAction.command("delete [clusterName] [name]").description($("Deletes persisted script")).usage("[options] <clusterName> <name>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-n, --name <name>", $("Script name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __13(clusterName, name, options, _) { var __frame = { name: "__13", line: 975 }; return __func(_, this, arguments, __13, 3, __frame, function __$__13() {







      return self.deletePersistedScriptCommand(clusterName, name, options, __cb(_, __frame, 1, 11, function __$__13() { _(); }, true)); }); });


  historyScriptAction.command("list [clusterName]").description($("Lists latest script action history")).usage("[options] <clusterName>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-s, --subscription <id>", $("The subscription id")).execute(function __14(clusterName, options, _) { var __frame = { name: "__14", line: 985 }; return __func(_, this, arguments, __14, 2, __frame, function __$__14() {






      return self.listScriptExecutionHistoryCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__14() { _(); }, true)); }); });


  historyScriptAction.command("show [clusterName] [scriptExecutionId]").description($("Shows script execution detail")).usage("[options] <clusterName> <scriptExecutionId>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-e, --scriptExecutionId <scriptExecutionId>", $("Script execution id")).option("-s, --subscription <id>", $("The subscription id")).execute(function __15(clusterName, scriptExecutionId, options, _) { var __frame = { name: "__15", line: 996 }; return __func(_, this, arguments, __15, 3, __frame, function __$__15() {







      return self.showScriptExecutionDetailCommand(clusterName, scriptExecutionId, options, __cb(_, __frame, 1, 11, function __$__15() { _(); }, true)); }); });


  scriptAction.command("create [clusterName]").description($("Submits script action")).usage("[options] <clusterName>").option("-g, --resource-group <resource-group>", $("The name of the resource group")).option("-c, --clusterName <clusterName>", $("HDInsight cluster name")).option("-n, --name <name>", $("Script name")).option("-u, --uri <uri>", $("Script URI")).option("-p, --parameters <parameters>", $("(Optional) Script parameters")).option("-t, --nodeTypes <nodeTypes>", $("Specifies the nodes on which this cmdlet applies the action separated by \";\". For example, \"headnode;workernode\" is a valid input.")).option("-a, --applicationName <applicationName>", $("Application name. When application name is specified, persistOnSuccess cannot be specified, and nodeTypes must contain only \"edgenode\"")).option("--persistOnSuccess", $("When persistOnSuccess is specified, the script action will be persisted if it successfully executes on the cluster.")).option("-s, --subscription <id>", $("The subscription id")).execute(function __16(clusterName, scriptExecutionId, options, _) { var __frame = { name: "__16", line: 1012 }; return __func(_, this, arguments, __16, 3, __frame, function __$__16() {












      return self.executeScriptActionsCommand(clusterName, options, __cb(_, __frame, 1, 11, function __$__16() { _(); }, true)); }); });


  var config = hdInsight.category("config").description($("Commands to manage HDInsight cluster configuration"));


  config.command("create [configFilePath]").description($("Creates a persisted Azure HDInsight cluster configuration file.")).usage("[options] <configFilePath> <overwrite>").option("--configFilePath <configFilePath>", $("HdInsight configuration file path")).option("--overwrite <overwrite>", $("Overwrites existing configuration file")).execute(function __17(configFilePath, options, _) { var __frame = { name: "__17", line: 1024 }; return __func(_, this, arguments, __17, 2, __frame, function __$__17() {





      return self.createClusterConfigCommand(configFilePath, options, __cb(_, __frame, 1, 11, function __$__17() { _(); }, true)); }); });


  config.command("add-config-values [configFilePath]").description($("Adds a Hadoop configuration value customization or a Hive shared library customization to an HDInsight cluster configuration. Each component config is in the format of 'name=value'. For example, parameter1=value1;parameter2=value2")).usage("[options] <configFilePath>").option("--configFilePath <configFilePath>", $("Configuration file path")).option("--core-site <core-site>", $("Config values in the format of 'name=value'")).option("--hive-site <hive-site>", $("Config values in the format of 'name=value'")).option("--hive-env <hive-env>", $("Config values in the format of 'name=value'")).option("--hdfs-site <hdfs-site>", $("Config values in the format of 'name=value'")).option("--hbase-env <hbase-env>", $("Config values in the format of 'name=value'")).option("--hbase-site <hbase-site>", $("Config values in the format of 'name=value'")).option("--mapred-site <mapred-site>", $("Config values in the format of 'name=value'")).option("--oozie-env <oozie-env>", $("Config values in the format of 'name=value'")).option("--oozie-site <oozie-site>", $("Config values in the format of 'name=value'")).option("--storm-site <storm-site>", $("Config values in the format of 'name=value'")).option("--tez-site <tez-site>", $("Config values in the format of 'name=value'")).option("--webhcat-site <webhcat-site>", $("Config values in the format of 'name=value'")).option("--gateway <gateway>", $("Config values in the format of 'name=value'")).option("--yarn <yarn>", $("Config values in the format of 'name=value'")).option("-s, --subscription <id>", $("The subscription id")).execute(function __18(configFilePath, options, _) { var __frame = { name: "__18", line: 1047 }; return __func(_, this, arguments, __18, 2, __frame, function __$__18() {



















      return self.addConfigValue(configFilePath, options, __cb(_, __frame, 1, 11, function __$__18() { _(); }, true)); }); });


  config.command("add-script-action [configFilePath]").description($("Adds a HDInsight script action.")).usage("[options] <configFilePath>").option("--configFilePath <configFilePath>", $("Configuration file path")).option("--nodeType <nodeType>", $("Specifies the node on which this cmdlet applies the action. Supported node types: HeadNode | WorkerNode | ZookeeperNode")).option("--uri <uri>", $("Specifies the URI for the action")).option("--name <name>", $("Specifies the name of the action")).option("--parameters <parameters>", $("Specifies the parameters for the action")).option("-s, --subscription <id>", $("The subscription id")).execute(function __19(configFilePath, options, _) { var __frame = { name: "__19", line: 1060 }; return __func(_, this, arguments, __19, 2, __frame, function __$__19() {









      return self.addScriptAction(configFilePath, options, __cb(_, __frame, 1, 11, function __$__19() { _(); }, true)); }); });};
