/*** 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 profile = require("../../../util/profile");








































































var utils = require("../../../util/utils");

var $ = utils.getLocaleString;function capitalize(str) {
  if ((str && (str.length >= 1))) {
    return (str.charAt(0).toUpperCase() + str.slice(1)); }

   else {
    return str; } ;};



function makeTuple(k, v, d) {
  return { key: k, value: v, depth: d };};


function displayImpl(o, key, depth, arr) {
  if (((!!o) && (((o.constructor === Object) || (o.constructor === Array))))) {
    arr.push(makeTuple(key, "", depth));
    var len = 0;
    Object.keys(o).forEach(function(k1) {
      var v1 = o[k1];
      var p1 = ((o.constructor === Array) ? "#" : "");
      var w = displayImpl(v1, (p1 + k1), (depth + 1), arr);
      if ((w > len)) {
        len = w; } ; });


    return len; }

   else {
    arr.push(makeTuple(key, (o ? o.toString() : ""), depth));
    return ((depth * 2) + ((key ? key.toString().length : 0))); } ;};



function display(cli, o) {
  var arr = [];
  var width = displayImpl(o, "", 0, arr);
  for (var t in arr) {
    var prebuf = new Array((arr[t].depth * 2)).join(" ");
    var key = (arr[t].key ? arr[t].key : "");
    var postLen = (width - ((prebuf.length + key.length)));
    var postbuf = new Array(((postLen > 0) ? postLen : 0)).join(" ");
    var str = ((prebuf + capitalize(key)) + postbuf);
    if (arr[t].value) {
      str += (" : " + arr[t].value); } ;

    cli.output.data(str); };};

exports.init = function(cli) {







  var virtualMachineScaleSetVMsDeallocate = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsDeallocate.command("deallocate [resource-group] [name] [instance-id]").description($("Allows you to deallocate a virtual machine virtual machine scale set.Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine uses.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __1(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__1", line: 140 }; return __func(_, this, arguments, __1, 4, __frame, function __$__1() { return (function __$__1(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__1() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__1(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__1() {


          cli.output.verbose(("name = " + name)); return (function __$__1(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__1() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.deallocate(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsDelete = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsDelete.command("delete [resource-group] [name] [instance-id]").description($("Allows you to delete a virtual machine scale set.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __2(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__2", line: 178 }; return __func(_, this, arguments, __2, 4, __frame, function __$__2() { return (function __$__2(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__2() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__2(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__2() {


          cli.output.verbose(("name = " + name)); return (function __$__2(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__2() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.deleteMethod(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsGet = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsGet.command("show [resource-group] [name] [instance-id]").description($("Displays information about a virtual machine scale set virtual machine.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __3(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__3", line: 216 }; return __func(_, this, arguments, __3, 4, __frame, function __$__3() { return (function __$__3(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__3() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__3(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__3() {


          cli.output.verbose(("name = " + name)); return (function __$__3(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__3() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.get(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (cli.output.format().json) {
                cli.output.json(result); }

               else {
                display(cli, result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsGetInstanceView = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsGetInstanceView.command("get-instance-view [resource-group] [name] [instance-id]").description($("Displays the status of a virtual machine scale set virtual machine.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __4(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__4", line: 257 }; return __func(_, this, arguments, __4, 4, __frame, function __$__4() { return (function __$__4(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__4() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__4(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__4() {


          cli.output.verbose(("name = " + name)); return (function __$__4(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__4() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.getInstanceView(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (cli.output.format().json) {
                cli.output.json(result); }

               else {
                display(cli, result); } ; _(); }, true)); }); }); }); }); });







  var virtualMachineScaleSetVMsList = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsList.command("list [resource-group] [name]").description($("Lists all virtual machines in a VM scale sets.")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __5(resourceGroup, name, options, _) { var subscription, computeManagementClient, result, nextPageLink, pageResult; var __frame = { name: "__5", line: 296 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { return (function __$__5(__then) {






        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__5() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__5(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__5() {


          cli.output.verbose(("name = " + name));
          subscription = profile.current.getSubscription(options.subscription);
          computeManagementClient = utils.createComputeManagementClient(subscription);
          return computeManagementClient.virtualMachineScaleSetVMs.list(resourceGroup, name, __cb(_, __frame, 13, 67, function ___(__0, __3) { result = __3;
            nextPageLink = result.nextLink; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$__5() { __more = false;
                var __8 = nextPageLink; if (__8) {
                  return computeManagementClient.virtualMachineScaleSetVMs.listNext(nextPageLink, __cb(_, __frame, 16, 73, function ___(__0, __4) { pageResult = __4;
                    pageResult.forEach(function(item) {
                      result.push(item); });

                    nextPageLink = pageResult.nextLink; while (__more) { __loop(); }; __more = true; }, true)); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(function __$__5() {


              if (cli.output.format().json) {
                cli.output.json(result); }

               else {
                cli.output.table(result, function(row, item) {
                  var rgName = (item.id ? utils.parseResourceReferenceUri(item.id).resourceGroupName : null);
                  row.cell($("ResourceGroupName"), rgName);
                  row.cell($("Name"), item.name);
                  row.cell($("ProvisioningState"), item.provisioningState);
                  row.cell($("Location"), item.location); }); } ; _(); }); }, true)); }); }); }); });









  var virtualMachineScaleSetVMsPowerOff = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsPowerOff.command("power-off [resource-group] [name] [instance-id]").description($("Allows you to power off (stop) a virtual machine in a VM scale set.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __6(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__6", line: 347 }; return __func(_, this, arguments, __6, 4, __frame, function __$__6() { return (function __$__6(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__6() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__6(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__6() {


          cli.output.verbose(("name = " + name)); return (function __$__6(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__6() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.powerOff(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsReimage = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsReimage.command("reimage [resource-group] [name] [instance-id]").description($("Allows you to re-image(update the version of the installed operating system) a virtual machine scale set instance.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __7(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__7", line: 385 }; return __func(_, this, arguments, __7, 4, __frame, function __$__7() { return (function __$__7(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__7() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__7(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__7() {


          cli.output.verbose(("name = " + name)); return (function __$__7(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__7() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.reimage(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsRestart = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsRestart.command("restart [resource-group] [name] [instance-id]").description($("Allows you to restart a virtual machine in a VM scale set.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __8(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__8", line: 423 }; return __func(_, this, arguments, __8, 4, __frame, function __$__8() { return (function __$__8(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__8() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__8(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__8() {


          cli.output.verbose(("name = " + name)); return (function __$__8(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__8() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.restart(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });








  var virtualMachineScaleSetVMsStart = cli.category("vmssvm").description($("Commands to manage your virtual machine scale set vm.  "));

  virtualMachineScaleSetVMsStart.command("start [resource-group] [name] [instance-id]").description($("Allows you to start a virtual machine in a VM scale set.")).usage("[options] <resource-group> <name> <instance-id>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-d, --instance-id <instance-id>", $("instance-id")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __9(resourceGroup, name, instanceId, options, _) { var subscription, computeManagementClient, result; var __frame = { name: "__9", line: 461 }; return __func(_, this, arguments, __9, 4, __frame, function __$__9() { return (function __$__9(__then) {







        if (!resourceGroup) {
          return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__9() {


        cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__9(__then) {
          if (!name) {
            return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__9() {


          cli.output.verbose(("name = " + name)); return (function __$__9(__then) {
            if (!instanceId) {
              return cli.interaction.promptIfNotGiven($("instance-id : "), instanceId, __cb(_, __frame, 12, 35, function ___(__0, __3) { instanceId = __3; __then(); }, true)); } else { __then(); } ; })(function __$__9() {


            cli.output.verbose(("instanceId = " + instanceId));
            subscription = profile.current.getSubscription(options.subscription);
            computeManagementClient = utils.createComputeManagementClient(subscription);
            return computeManagementClient.virtualMachineScaleSetVMs.start(resourceGroup, name, instanceId, __cb(_, __frame, 18, 67, function ___(__0, __4) { result = __4;
              if (result) {
                cli.output.json(result); } ; _(); }, true)); }); }); }); }); });};
