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
















var profile = require("../../../util/profile");
var utils = require("../../../util/utils");
var HdiCustomization = require("./hdiCustomization");
var HdiConfigClient = require("./hdiConfigClient");

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


__.extend(HdiClient.prototype, {
  createCluster: function createCluster__1(resourceGroupName, clusterName, clusterCreateParameters, _) { var customization, result, __this = this; var __frame = { name: "createCluster__1", line: 29 }; return __func(_, this, arguments, createCluster__1, 3, __frame, function __$createCluster__1() {
      customization = new HdiCustomization(__this.cli);
      return customization.createCluster(resourceGroupName, clusterName, clusterCreateParameters, __cb(_, __frame, 2, 31, function ___(__0, __1) { result = __1;
        return _(null, result); }, true)); }); },


  getCluster: function getCluster__2(resourceGroupName, clusterName, _) { var subscription, client, __this = this; var __frame = { name: "getCluster__2", line: 35 }; return __func(_, this, arguments, getCluster__2, 2, __frame, function __$getCluster__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$getCluster__2() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            return client.clusters.get(resourceGroupName, clusterName, __cb(_, __frame, 4, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$getCluster__2() { if (e) {


              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$getCluster__2() { _(); }); }); }); },



  listClusters: function listClusters__3(resourceGroupName, _) { var subscription, client, __this = this; var __frame = { name: "listClusters__3", line: 49 }; return __func(_, this, arguments, listClusters__3, 1, __frame, function __$listClusters__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$listClusters__3() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription); return (function __$listClusters__3(__then) {
              if (((resourceGroupName !== undefined) && (resourceGroupName !== null))) {
                return client.clusters.listByResourceGroup(resourceGroupName, __cb(_, __frame, 5, 31, _, true)); } else { __then(); } ; })(function __$listClusters__3() {

              return client.clusters.list(__cb(_, __frame, 7, 29, _, true)); }); }); })(function ___(e, __result) { __catch(function __$listClusters__3() { if (e) {


              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$listClusters__3() { _(); }); }); }); },



  deleteCluster: function deleteCluster__4(resourceGroupName, clusterName, _) { var subscription, client, __this = this; var __frame = { name: "deleteCluster__4", line: 66 }; return __func(_, this, arguments, deleteCluster__4, 2, __frame, function __$deleteCluster__4() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$deleteCluster__4() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            return client.clusters.deleteMethod(resourceGroupName, clusterName, __cb(_, __frame, 4, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$deleteCluster__4() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$deleteCluster__4() { _(); }); }); }); },



  resizeCluster: function resizeCluster__5(resourceGroupName, clusterName, targetInstanceCount, _) { var subscription, client, resizeParameter, __this = this; var __frame = { name: "resizeCluster__5", line: 79 }; return __func(_, this, arguments, resizeCluster__5, 3, __frame, function __$resizeCluster__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$resizeCluster__5() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            resizeParameter = {
              targetInstanceCount: targetInstanceCount };

            return client.clusters.resize(resourceGroupName, clusterName, resizeParameter, __cb(_, __frame, 7, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$resizeCluster__5() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$resizeCluster__5() { _(); }); }); }); },



  listPersistedScripts: function listPersistedScripts__6(resourceGroupName, clusterName, _) { var subscription, client, __this = this; var __frame = { name: "listPersistedScripts__6", line: 95 }; return __func(_, this, arguments, listPersistedScripts__6, 2, __frame, function __$listPersistedScripts__6() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$listPersistedScripts__6() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            return client.clusters.listPersistedScripts(resourceGroupName, clusterName, __cb(_, __frame, 4, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$listPersistedScripts__6() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$listPersistedScripts__6() { _(); }); }); }); },



  listScriptExecutionHistory: function listScriptExecutionHistory__7(resourceGroupName, clusterName, _) { var subscription, client, __this = this; var __frame = { name: "listScriptExecutionHistory__7", line: 108 }; return __func(_, this, arguments, listScriptExecutionHistory__7, 2, __frame, function __$listScriptExecutionHistory__7() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$listScriptExecutionHistory__7() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            return client.clusters.listScriptExecutionHistory(resourceGroupName, clusterName, __cb(_, __frame, 4, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$listScriptExecutionHistory__7() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$listScriptExecutionHistory__7() { _(); }); }); }); },



  getScriptExecutionDetail: function getScriptExecutionDetail__8(resourceGroupName, clusterName, scriptExecutionId, _) { var subscription, client, __this = this; var __frame = { name: "getScriptExecutionDetail__8", line: 121 }; return __func(_, this, arguments, getScriptExecutionDetail__8, 3, __frame, function __$getScriptExecutionDetail__8() {
      subscription = profile.current.getSubscription(__this.subscription);
      client = utils.createHDInsightManagementClient(subscription);
      return client.clusters.getScriptExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, __cb(_, __frame, 3, 27, _, true)); }); },


  promoteScript: function promoteScript__9(resourceGroupName, clusterName, scriptExecutionId, _) { var subscription, client, __this = this; var __frame = { name: "promoteScript__9", line: 127 }; return __func(_, this, arguments, promoteScript__9, 3, __frame, function __$promoteScript__9() {
      subscription = profile.current.getSubscription(__this.subscription);
      client = utils.createHDInsightManagementClient(subscription);
      return client.clusters.promoteScript(resourceGroupName, clusterName, scriptExecutionId, __cb(_, __frame, 3, 27, _, true)); }); },


  deletePersistedScript: function deletePersistedScript__10(resourceGroupName, clusterName, scriptName, _) { var subscription, client, __this = this; var __frame = { name: "deletePersistedScript__10", line: 133 }; return __func(_, this, arguments, deletePersistedScript__10, 3, __frame, function __$deletePersistedScript__10() {
      subscription = profile.current.getSubscription(__this.subscription);
      client = utils.createHDInsightManagementClient(subscription);
      return client.clusters.deletePersistedScript(resourceGroupName, clusterName, scriptName, __cb(_, __frame, 3, 27, _, true)); }); },


  executeScriptActions: function executeScriptActions__11(resourceGroupName, clusterName, executeScriptActionParameters, _) { var subscription, client, __this = this; var __frame = { name: "executeScriptActions__11", line: 139 }; return __func(_, this, arguments, executeScriptActions__11, 3, __frame, function __$executeScriptActions__11() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$executeScriptActions__11() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            return client.clusters.executeScriptActions(resourceGroupName, clusterName, executeScriptActionParameters, __cb(_, __frame, 4, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$executeScriptActions__11() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$executeScriptActions__11() { _(); }); }); }); },



  enableHttp: function enableHttp__12(resourceGroupName, clusterName, userName, password, _) { var subscription, client, httpSettingsParameters, __this = this; var __frame = { name: "enableHttp__12", line: 152 }; return __func(_, this, arguments, enableHttp__12, 4, __frame, function __$enableHttp__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$enableHttp__12() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            httpSettingsParameters = {
              httpUserEnabled: true,
              httpUsername: userName,
              httpPassword: password };

            return client.clusters.configureHttpSettings(resourceGroupName, clusterName, httpSettingsParameters, __cb(_, __frame, 9, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$enableHttp__12() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$enableHttp__12() { _(); }); }); }); },



  disableHttp: function disableHttp__13(resourceGroupName, clusterName, _) { var subscription, client, httpSettingsParameters, __this = this; var __frame = { name: "disableHttp__13", line: 170 }; return __func(_, this, arguments, disableHttp__13, 2, __frame, function __$disableHttp__13() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$disableHttp__13() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            httpSettingsParameters = {
              httpUserEnabled: false };

            return client.clusters.configureHttpSettings(resourceGroupName, clusterName, httpSettingsParameters, __cb(_, __frame, 7, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$disableHttp__13() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$disableHttp__13() { _(); }); }); }); },



  enableRdp: function enableRdp__14(resourceGroupName, clusterName, rdpUserName, rdpPassword, rdpExpiryDate, _) { var subscription, client, rdpSettingsParameters, __this = this; var __frame = { name: "enableRdp__14", line: 186 }; return __func(_, this, arguments, enableRdp__14, 5, __frame, function __$enableRdp__14() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$enableRdp__14() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            rdpSettingsParameters = {
              osProfile: {
                windowsOperatingSystemProfile: {
                  rdpSettings: {
                    userName: rdpUserName,
                    password: rdpPassword,
                    expiryDate: rdpExpiryDate } } } };




            return client.clusters.configureRdpSettings(resourceGroupName, clusterName, rdpSettingsParameters, __cb(_, __frame, 15, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$enableRdp__14() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$enableRdp__14() { _(); }); }); }); },



  disableRdp: function disableRdp__15(resourceGroupName, clusterName, _) { var subscription, client, rdpSettingsParameters, __this = this; var __frame = { name: "disableRdp__15", line: 210 }; return __func(_, this, arguments, disableRdp__15, 2, __frame, function __$disableRdp__15() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$disableRdp__15() {

            subscription = profile.current.getSubscription(__this.subscription);
            client = utils.createHDInsightManagementClient(subscription);
            rdpSettingsParameters = {
              osProfile: {
                windowsOperatingSystemProfile: {
                  rdpSettings: null } } };



            return client.clusters.configureRdpSettings(resourceGroupName, clusterName, rdpSettingsParameters, __cb(_, __frame, 11, 29, _, true)); }); })(function ___(e, __result) { __catch(function __$disableRdp__15() { if (e) {

              if (((e.code === "ResourceNotFound") || (e.code === "NotFound"))) {
                return _(null, null); } ;

              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$disableRdp__15() { _(); }); }); }); },



  createConfigFile: function(configFilePath) {
    var configClient = new HdiConfigClient(this.cli);
    var result = configClient.createConfigFile(configFilePath);
    return result; },


  addConfigValue: function(configFilePath, options) {
    var configClient = new HdiConfigClient(this.cli);
    var result = configClient.addConfigValue(configFilePath, options);
    return result; },


  addScriptAction: function(configFilePath, options) {
    var configClient = new HdiConfigClient(this.cli);
    var result = configClient.addScriptAction(configFilePath, options);
    return result; }});



module.exports = HdiClient;
