UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

543 lines (272 loc) 35.4 kB
/*** 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,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; var generatorUtils = require("../../../util/generatorUtils"); var util = require("util"); var validation = require("../../../util/validation"); var profile = require("../../../util/profile"); var utils = require("../../../util/utils"); var $ = utils.getLocaleString; exports.init = function(cli) { var network = cli.category("network").description($("Commands to manage network resources")); var loadBalancers = network.category("lb").description($("Commands to manage load balancers")); var loadBalancingRules = loadBalancers.category("rule").description($("Commands to manage load balancing rules")); var defaultProtocol = "TCP"; var defaultLoadDistribution = "Default"; var defaultFrontendPort = "80"; var defaultBackendPort = "80"; var defaultIdleTimeoutInMinutes = "4"; var defaultEnableFloatingIP = "false"; loadBalancingRules.command("create [resource-group] [lb-name] [name]").description($("Create a load balancing rule")).usage("[options] <resource-group> <lb-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-l, --lb-name <lb-name>", $("the lb name")).option("-n, --name <name>", $("the name of the load balancing rule")).option("-t, --frontend-ip-name [frontend-ip-name]", $(("sets frontend ip configuration. This" + "\n option is mutually exclusive with --frontend-ip-id"))).option("-r, --frontend-ip-id [frontend-ip-id]", $(("sets frontend ip configuration. This" + "\n option is mutually exclusive with --frontend-ip-name"))).option("-o, --backend-address-pool-name [backend-address-pool-name]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --backend-address-pool-id"))).option("-c, --backend-address-pool-id [backend-address-pool-id]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --backend-address-pool-name"))).option("-a, --probe-name [probe-name]", $(("sets probe. This option is mutually" + "\n exclusive with --probe-id"))).option("-k, --probe-id [probe-id]", $(("sets probe. This option is mutually" + "\n exclusive with --probe-name"))).option("-p, --protocol [protocol]", $(("the transport protocol for the" + "\n endpoint. Possible values are 'Udp' or 'Tcp' or 'All.'"))).option("-d, --load-distribution [load-distribution]", $(("the load distribution policy for this" + "\n rule. Possible values are 'Default', 'SourceIP', and 'SourceIPProtocol'"))).option("-f, --frontend-port [frontend-port]", $((("the port for the external endpoint." + "\n Port numbers for each rule must be unique within the Load Balancer. Acceptable") + "\n values are between 0 and 65534. Note that value 0 enables \"Any Port\""))).option("-b, --backend-port [backend-port]", $((("the port used for internal connections" + "\n on the endpoint. Acceptable values are between 0 and 65535. Note that value 0") + "\n enables \"Any Port\""))).option("-i, --idle-timeout [idle-timeout]", $((("the timeout for the TCP idle" + "\n connection. The value can be set between 4 and 30 minutes. The default value is") + "\n 4 minutes. This element is only used when the protocol is set to TCP"))).option("-e, --enable-floating-ip [enable-floating-ip]", $((((("configures a virtual machine's" + "\n endpoint for the floating IP capability required to configure a SQL AlwaysOn") + "\n Availability Group. This setting is required when using the SQL AlwaysOn") + "\n Availability Groups in SQL server. This setting can't be changed after you") + "\n create the endpoint"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, lbName, name, options, _) { var useDefaults, subscription, networkManagementClient, loadBalancer, progress, parentItem, loadBalancingRule, parameters, referredFrontendIPConfiguration, idContainerFrontendIPConfiguration, referredBackendAddressPool, idContainerBackendAddressPool, referredProbe, idContainerProbe; var __frame = { name: "__1", line: 84 }; return __func(_, this, arguments, __1, 4, __frame, function __$__1() { useDefaults = true; return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("lb name : "), lbName, __cb(_, __frame, 3, 31, function ___(__0, __2) { lbName = __2; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 4, 29, function ___(__0, __3) { name = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.loadBalancers.get(resourceGroup, lbName, null, __cb(_, __frame, 12, 61, function ___(__0, __4) { loadBalancer = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) { if ((e.statusCode === 404)) { loadBalancer = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__1() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__1() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__1() { parentItem = loadBalancer; if (!parentItem) { return _(new Error(util.format($("load balancer with name \"%s\" not found in the resource group \"%s\""), lbName, resourceGroup))); } ; loadBalancingRule = utils.findFirstCaseIgnore(parentItem.loadBalancingRules, { name: name }); if (loadBalancingRule) { return _(new Error(util.format($("load balancing rule with name \"%s\" already exists in load balancer \"%s\""), name, lbName))); } ; parameters = { }; if (!parameters.frontendIPConfiguration) { parameters.frontendIPConfiguration = { }; } ; if (options.frontendIpId) { if (options.frontendIpName) { cli.output.warn($("--frontend-ip-name parameter will be ignored because --frontend-ip-id and --frontend-ip-name are mutually exclusive")); } ; parameters.frontendIPConfiguration.id = options.frontendIpId; } else { if (options.frontendIpName) { referredFrontendIPConfiguration = utils.findFirstCaseIgnore(loadBalancer.frontendIPConfigurations, { name: options.frontendIpName }); if (!referredFrontendIPConfiguration) { return _(new Error(util.format($("No frontend ip configuration with name \"%s\" found"), options.frontendIpName))); } ; idContainerFrontendIPConfiguration = referredFrontendIPConfiguration; parameters.frontendIPConfiguration.id = idContainerFrontendIPConfiguration.id; } else { if (useDefaults) { if ((loadBalancer.frontendIPConfigurations.length !== 0)) { parameters.frontendIPConfiguration.id = loadBalancer.frontendIPConfigurations[0].id; } else { return _(new Error(util.format($("Resource has no frontend ip configuration defined")))); } ; } ; } ; } ; if (!parameters.backendAddressPool) { parameters.backendAddressPool = { }; } ; if (options.backendAddressPoolId) { if (options.backendAddressPoolName) { cli.output.warn($("--backend-address-pool-name parameter will be ignored because --backend-address-pool-id and --backend-address-pool-name are mutually exclusive")); } ; parameters.backendAddressPool.id = options.backendAddressPoolId; } else { if (options.backendAddressPoolName) { referredBackendAddressPool = utils.findFirstCaseIgnore(loadBalancer.backendAddressPools, { name: options.backendAddressPoolName }); if (!referredBackendAddressPool) { return _(new Error(util.format($("No backend address pool with name \"%s\" found"), options.backendAddressPoolName))); } ; idContainerBackendAddressPool = referredBackendAddressPool; parameters.backendAddressPool.id = idContainerBackendAddressPool.id; } else { if (useDefaults) { if ((loadBalancer.backendAddressPools.length !== 0)) { parameters.backendAddressPool.id = loadBalancer.backendAddressPools[0].id; } else { return _(new Error(util.format($("Resource has no backend address pool defined")))); } ; } ; } ; } ; if (!parameters.probe) { parameters.probe = { }; } ; if (options.probeId) { if (options.probeName) { cli.output.warn($("--probe-name parameter will be ignored because --probe-id and --probe-name are mutually exclusive")); } ; parameters.probe.id = options.probeId; } else { if (options.probeName) { referredProbe = utils.findFirstCaseIgnore(loadBalancer.probes, { name: options.probeName }); if (!referredProbe) { return _(new Error(util.format($("No probe with name \"%s\" found"), options.probeName))); } ; idContainerProbe = referredProbe; parameters.probe.id = idContainerProbe.id; } ; } ; if (options.protocol) { parameters.protocol = validation.isIn(options.protocol, ["Udp","Tcp","All",], "--protocol"); } else { if (useDefaults) { parameters.protocol = defaultProtocol; } ; } ; if (options.loadDistribution) { parameters.loadDistribution = validation.isIn(options.loadDistribution, ["Default","SourceIP","SourceIPProtocol",], "--load-distribution"); } else { if (useDefaults) { parameters.loadDistribution = defaultLoadDistribution; } ; } ; if (options.frontendPort) { parameters.frontendPort = parseInt(options.frontendPort, 10); } else { if (useDefaults) { parameters.frontendPort = parseInt(defaultFrontendPort, 10); } ; } ; if (options.backendPort) { parameters.backendPort = parseInt(options.backendPort, 10); } else { if (useDefaults) { parameters.backendPort = parseInt(defaultBackendPort, 10); } ; } ; if (options.idleTimeout) { parameters.idleTimeoutInMinutes = parseInt(options.idleTimeout, 10); } else { if (useDefaults) { parameters.idleTimeoutInMinutes = parseInt(defaultIdleTimeoutInMinutes, 10); } ; } ; if (options.enableFloatingIp) { parameters.enableFloatingIP = utils.parseBool(options.enableFloatingIp); } else { if (useDefaults) { parameters.enableFloatingIP = utils.parseBool(defaultEnableFloatingIP); } ; } ; parameters.name = name; parentItem.loadBalancingRules.push(parameters); generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Creating load balancing rule in load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.loadBalancers.createOrUpdate(resourceGroup, lbName, loadBalancer, __cb(_, __frame, 140, 61, function ___(__0, __5) { loadBalancer = __5; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__1() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__1() { parentItem = loadBalancer; cli.interaction.formatOutput(utils.findFirstCaseIgnore(parentItem.loadBalancingRules, { name: name }), generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); loadBalancingRules.command("set [resource-group] [lb-name] [name]").description($("Update a load balancing rule")).usage("[options] <resource-group> <lb-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-l, --lb-name <lb-name>", $("the lb name")).option("-n, --name <name>", $("the name of the load balancing rule")).option("-t, --frontend-ip-name [frontend-ip-name]", $(("sets frontend ip configuration. This" + "\n option is mutually exclusive with --frontend-ip-id"))).option("-r, --frontend-ip-id [frontend-ip-id]", $(("sets frontend ip configuration. This" + "\n option is mutually exclusive with --frontend-ip-name"))).option("-o, --backend-address-pool-name [backend-address-pool-name]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --backend-address-pool-id"))).option("-c, --backend-address-pool-id [backend-address-pool-id]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --backend-address-pool-name"))).option("-a, --probe-name [probe-name]", $(("sets probe. This option is mutually" + "\n exclusive with --probe-id"))).option("-k, --probe-id [probe-id]", $(("sets probe. This option is mutually" + "\n exclusive with --probe-name"))).option("-p, --protocol [protocol]", $(("the transport protocol for the" + "\n endpoint. Possible values are 'Udp' or 'Tcp' or 'All.'"))).option("-d, --load-distribution [load-distribution]", $(("the load distribution policy for this" + "\n rule. Possible values are 'Default', 'SourceIP', and 'SourceIPProtocol'"))).option("-f, --frontend-port [frontend-port]", $((("the port for the external endpoint." + "\n Port numbers for each rule must be unique within the Load Balancer. Acceptable") + "\n values are between 0 and 65534. Note that value 0 enables \"Any Port\""))).option("-b, --backend-port [backend-port]", $((("the port used for internal connections" + "\n on the endpoint. Acceptable values are between 0 and 65535. Note that value 0") + "\n enables \"Any Port\""))).option("-i, --idle-timeout [idle-timeout]", $((("the timeout for the TCP idle" + "\n connection. The value can be set between 4 and 30 minutes. The default value is") + "\n 4 minutes. This element is only used when the protocol is set to TCP"))).option("-e, --enable-floating-ip [enable-floating-ip]", $((((("configures a virtual machine's" + "\n endpoint for the floating IP capability required to configure a SQL AlwaysOn") + "\n Availability Group. This setting is required when using the SQL AlwaysOn") + "\n Availability Groups in SQL server. This setting can't be changed after you") + "\n create the endpoint"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, lbName, name, options, _) { var useDefaults, subscription, networkManagementClient, loadBalancer, progress, parentItem, loadBalancingRule, parameters, referredFrontendIPConfiguration, idContainerFrontendIPConfiguration, referredBackendAddressPool, idContainerBackendAddressPool, referredProbe, idContainerProbe; var __frame = { name: "__2", line: 270 }; return __func(_, this, arguments, __2, 4, __frame, function __$__2() { useDefaults = false; return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("lb name : "), lbName, __cb(_, __frame, 3, 31, function ___(__0, __2) { lbName = __2; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 4, 29, function ___(__0, __3) { name = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.loadBalancers.get(resourceGroup, lbName, null, __cb(_, __frame, 12, 61, function ___(__0, __4) { loadBalancer = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) { if ((e.statusCode === 404)) { loadBalancer = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__2() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__2() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__2() { parentItem = loadBalancer; if (!parentItem) { return _(new Error(util.format($("load balancer with name \"%s\" not found in the resource group \"%s\""), lbName, resourceGroup))); } ; loadBalancingRule = utils.findFirstCaseIgnore(parentItem.loadBalancingRules, { name: name }); if (!loadBalancingRule) { return _(new Error(util.format($("load balancing rule with name \"%s\" not found in load balancer \"%s\""), name, lbName))); } ; parameters = loadBalancingRule; if (!parameters.frontendIPConfiguration) { parameters.frontendIPConfiguration = { }; } ; if (options.frontendIpId) { if (options.frontendIpName) { cli.output.warn($("--frontend-ip-name parameter will be ignored because --frontend-ip-id and --frontend-ip-name are mutually exclusive")); } ; parameters.frontendIPConfiguration.id = options.frontendIpId; } else { if (options.frontendIpName) { referredFrontendIPConfiguration = utils.findFirstCaseIgnore(loadBalancer.frontendIPConfigurations, { name: options.frontendIpName }); if (!referredFrontendIPConfiguration) { return _(new Error(util.format($("No frontend ip configuration with name \"%s\" found"), options.frontendIpName))); } ; idContainerFrontendIPConfiguration = referredFrontendIPConfiguration; parameters.frontendIPConfiguration.id = idContainerFrontendIPConfiguration.id; } ; } ; if (!parameters.backendAddressPool) { parameters.backendAddressPool = { }; } ; if (options.backendAddressPoolId) { if (options.backendAddressPoolName) { cli.output.warn($("--backend-address-pool-name parameter will be ignored because --backend-address-pool-id and --backend-address-pool-name are mutually exclusive")); } ; parameters.backendAddressPool.id = options.backendAddressPoolId; } else { if (options.backendAddressPoolName) { referredBackendAddressPool = utils.findFirstCaseIgnore(loadBalancer.backendAddressPools, { name: options.backendAddressPoolName }); if (!referredBackendAddressPool) { return _(new Error(util.format($("No backend address pool with name \"%s\" found"), options.backendAddressPoolName))); } ; idContainerBackendAddressPool = referredBackendAddressPool; parameters.backendAddressPool.id = idContainerBackendAddressPool.id; } ; } ; if (!parameters.probe) { parameters.probe = { }; } ; if (options.probeId) { if (options.probeName) { cli.output.warn($("--probe-name parameter will be ignored because --probe-id and --probe-name are mutually exclusive")); } ; if (!utils.argHasValue(options.probeId)) { delete parameters.probe; } else { parameters.probe.id = options.probeId; } ; } else { if (options.probeName) { if (!utils.argHasValue(options.probeName)) { delete parameters.probe; } else { referredProbe = utils.findFirstCaseIgnore(loadBalancer.probes, { name: options.probeName }); if (!referredProbe) { return _(new Error(util.format($("No probe with name \"%s\" found"), options.probeName))); } ; idContainerProbe = referredProbe; parameters.probe.id = idContainerProbe.id; } ; } ; } ; if (options.protocol) { parameters.protocol = validation.isIn(options.protocol, ["Udp","Tcp","All",], "--protocol"); } else { if (useDefaults) { parameters.protocol = defaultProtocol; } ; } ; if (options.loadDistribution) { parameters.loadDistribution = validation.isIn(options.loadDistribution, ["Default","SourceIP","SourceIPProtocol",], "--load-distribution"); } else { if (useDefaults) { parameters.loadDistribution = defaultLoadDistribution; } ; } ; if (options.frontendPort) { parameters.frontendPort = parseInt(options.frontendPort, 10); } else { if (useDefaults) { parameters.frontendPort = parseInt(defaultFrontendPort, 10); } ; } ; if (options.backendPort) { parameters.backendPort = parseInt(options.backendPort, 10); } else { if (useDefaults) { parameters.backendPort = parseInt(defaultBackendPort, 10); } ; } ; if (options.idleTimeout) { parameters.idleTimeoutInMinutes = parseInt(options.idleTimeout, 10); } else { if (useDefaults) { parameters.idleTimeoutInMinutes = parseInt(defaultIdleTimeoutInMinutes, 10); } ; } ; if (options.enableFloatingIp) { parameters.enableFloatingIP = utils.parseBool(options.enableFloatingIp); } else { if (useDefaults) { parameters.enableFloatingIP = utils.parseBool(defaultEnableFloatingIP); } ; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Updating load balancing rule in \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.loadBalancers.createOrUpdate(resourceGroup, lbName, loadBalancer, __cb(_, __frame, 133, 61, function ___(__0, __5) { loadBalancer = __5; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__2() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__2() { parentItem = loadBalancer; cli.interaction.formatOutput(utils.findFirstCaseIgnore(parentItem.loadBalancingRules, { name: name }), generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); loadBalancingRules.command("delete [resource-group] [lb-name] [name]").description($("Delete a load balancing rule")).usage("[options] <resource-group> <lb-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-l, --lb-name <lb-name>", $("the lb name")).option("-n, --name <name>", $("the name of the load balancing rule")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, lbName, name, options, _) { var subscription, networkManagementClient, loadBalancer, progress, parentItem, index; var __frame = { name: "__3", line: 420 }; return __func(_, this, arguments, __3, 4, __frame, function __$__3() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __2) { resourceGroup = __2; return cli.interaction.promptIfNotGiven($("lb name : "), lbName, __cb(_, __frame, 2, 31, function ___(__0, __3) { lbName = __3; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 3, 29, function ___(__0, __4) { name = __4; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.loadBalancers.get(resourceGroup, lbName, null, __cb(_, __frame, 11, 61, function ___(__0, __5) { loadBalancer = __5; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) { if ((e.statusCode === 404)) { loadBalancer = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__3() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__3() { parentItem = loadBalancer; if (!parentItem) { return _(new Error(util.format($("load balancer with name \"%s\" not found in the resource group \"%s\""), lbName, resourceGroup))); } ; index = utils.indexOfCaseIgnore(parentItem.loadBalancingRules, { name: name }); if ((index === -1)) { return _(new Error(util.format($("load balancing rule \"%s\" not found in load balancer \"%s\""), name, lbName))); } ; return (function __$__3(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete load balancing rule with name \"%s\" from load balancer \"%s\"? [y/n] "), name, lbName), __cb(_, __frame, 32, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -419, 17, function ___(__0, __6) { return (function __$__3(__then) { if (__6) { return _(null); } else { __then(); } ; })(function __$__3() { parentItem.loadBalancingRules.splice(index, 1); progress = cli.interaction.progress("Deleting load balancing rule"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.loadBalancers.createOrUpdate(resourceGroup, lbName, loadBalancer, __cb(_, __frame, 40, 61, function ___(__0, __7) { loadBalancer = __7; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__3() { _(); }); }); }); }, true)); }); }); }, true)); }, true)); }, true)); }); }); loadBalancingRules.command("show [resource-group] [lb-name] [name]").description($("Show a load balancing rule")).usage("[options] <resource-group> <lb-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-l, --lb-name <lb-name>", $("the lb name")).option("-n, --name <name>", $("the name of the load balancing rule")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, lbName, name, options, _) { var subscription, networkManagementClient, loadBalancer, progress, parentItem, loadBalancingRule; var __frame = { name: "__4", line: 473 }; return __func(_, this, arguments, __4, 4, __frame, function __$__4() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("lb name : "), lbName, __cb(_, __frame, 2, 31, function ___(__0, __2) { lbName = __2; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 3, 29, function ___(__0, __3) { name = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return networkManagementClient.loadBalancers.get(resourceGroup, lbName, null, __cb(_, __frame, 11, 61, function ___(__0, __4) { loadBalancer = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__4() { if (e) { if ((e.statusCode === 404)) { loadBalancer = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__4() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__4() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__4() { parentItem = loadBalancer; if (!parentItem) { return _(new Error(util.format($("load balancer with name \"%s\" not found in the resource group \"%s\""), lbName, resourceGroup))); } ; loadBalancingRule = utils.findFirstCaseIgnore(parentItem.loadBalancingRules, { name: name }); if (!loadBalancingRule) { cli.output.warn(util.format($("load balancing rule with name \"%s\" not found in the load balancer \"%s\""), name, lbName)); } ; cli.interaction.formatOutput(loadBalancingRule, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }, true)); }); }); loadBalancingRules.command("list [resource-group] [lb-name]").description($("List load balancing rules")).usage("[options] <resource-group> <lb-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-l, --lb-name <lb-name>", $("the lb name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, lbName, options, _) { var subscription, networkManagementClient, loadBalancer, progress, parentItem; var __frame = { name: "__5", line: 514 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); loadBalancer = null; progress = cli.interaction.progress(util.format($("Looking up the load balancer \"%s\""), lbName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return networkManagementClient.loadBalancers.get(resourceGroup, lbName, null, __cb(_, __frame, 7, 61, function ___(__0, __1) { loadBalancer = __1; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__5() { if (e) { if ((e.statusCode === 404)) { loadBalancer = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__5() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__5() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__5() { parentItem = loadBalancer; if (!parentItem) { return _(new Error(util.format($("load balancer with name \"%s\" not found in the resource group \"%s\""), lbName, resourceGroup))); } ; cli.interaction.formatOutput(parentItem.loadBalancingRules, function(items) { if ((!items || (items.length === 0))) { cli.output.warn($("No load balancing rules found")); } else { cli.output.table(items, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); });};