UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

288 lines (121 loc) 21.3 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 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 applicationGateways = network.category("application-gateway").description($("Commands to manage application gateways")); applicationGateways.command("delete [resource-group] [name]").description($("Delete an application gateway")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the application gateway")).option("--nowait", $("do not wait for the operation to complete. Returns as soon as the intial request is received by the server")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__1", line: 45 }; return __func(_, this, arguments, __1, 3, __frame, function __$__1() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __2) { resourceGroup = __2; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 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 application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.applicationGateways.get(resourceGroup, name, null, __cb(_, __frame, 10, 73, function ___(__0, __4) { applicationGateway = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) { if ((e.statusCode === 404)) { applicationGateway = 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() { if (!applicationGateway) { return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; return (function __$__1(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete application gateway \"%s\"? [y/n] "), name), __cb(_, __frame, 25, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -44, 17, function ___(__0, __5) { return (function __$__1(__then) { if (__5) { cli.output.info(util.format($("application gateway \"%s\" was not deleted and still exists in the resource group \"%s\""), name, resourceGroup)); return _(null); } else { __then(); } ; })(function __$__1() { progress = cli.interaction.progress(util.format($("Deleting application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function __$__1(__then) { if (options.nowait) { return networkManagementClient.applicationGateways.beginDeleteMethod(resourceGroup, name, __cb(_, __frame, 33, 75, function ___(__0, __6) { applicationGateway = __6; __then(); }, true)); } else { return networkManagementClient.applicationGateways.deleteMethod(resourceGroup, name, __cb(_, __frame, 36, 75, function ___(__0, __7) { applicationGateway = __7; __then(); }, true)); } ; })(function __$__1() { cli.output.info(util.format($("application gateway \"%s\" was successfully deleted from resource group \"%s\""), name, resourceGroup)); _(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() { _(); }); }); }); }, true)); }); }); }, true)); }, true)); }); }); applicationGateways.command("show [resource-group] [name]").description($("Show an application gateway")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the application gateway")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__2", line: 95 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.applicationGateways.get(resourceGroup, name, null, __cb(_, __frame, 10, 73, function ___(__0, __3) { applicationGateway = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) { if ((e.statusCode === 404)) { applicationGateway = 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() { if (!applicationGateway) { cli.output.warn(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup)); } ; cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }); }); applicationGateways.command("list [resource-group]").description($("List application gateways")).usage("[options] <resource-group>").option("-g, --resource-group [resource-group]", $("the name of the resource group")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__3", line: 128 }; return __func(_, this, arguments, __3, 2, __frame, function __$__3() { options.resourceGroup = resourceGroup; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); applicationGateway = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function __$__3(__then) { if ((typeof networkManagementClient.applicationGateways.listAll != "function")) { return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 9, 42, function ___(__0, __1) { resourceGroup = __1; progress = cli.interaction.progress($("Getting the application gateways")); return networkManagementClient.applicationGateways.list(resourceGroup, __cb(_, __frame, 11, 75, function ___(__0, __2) { applicationGateway = __2; __then(); }, true)); }, true)); } else { return (function __$__3(__then) { if (options.resourceGroup) { progress = cli.interaction.progress($("Getting the application gateways")); return networkManagementClient.applicationGateways.list(resourceGroup, __cb(_, __frame, 15, 77, function ___(__0, __3) { applicationGateway = __3; __then(); }, true)); } else { progress = cli.interaction.progress($("Getting the application gateways")); return networkManagementClient.applicationGateways.listAll(__cb(_, __frame, 18, 77, function ___(__0, __4) { applicationGateway = __4; __then(); }, true)); } ; })(__then); } ; })(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() { cli.interaction.formatOutput(applicationGateway, function(applicationGateway) { if ((!applicationGateway || (applicationGateway.length === 0))) { cli.output.warn($("No application gateways found")); } else { cli.output.table(applicationGateway, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); }); var backendHealth = applicationGateways.category("backend-health").description($("Commands to manage backend health")); backendHealth.command("show [resource-group] [gateway-name]").description($("Perform backend health operation on an application gateway")).usage("[options] <resource-group> <gateway-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-w, --gateway-name <gateway-name>", $("the gateway name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, gatewayName, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__4", line: 173 }; return __func(_, this, arguments, __4, 3, __frame, function __$__4() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("gateway name : "), gatewayName, __cb(_, __frame, 2, 36, function ___(__0, __2) { gatewayName = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, null, __cb(_, __frame, 11, 73, function ___(__0, __3) { applicationGateway = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__4() { if (e) { if ((e.statusCode === 404)) { applicationGateway = 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() { if (!applicationGateway) { return _(new Error(util.format($("an application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ; progress = cli.interaction.progress(util.format($("Performing backend health operation on an application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return networkManagementClient.applicationGateways.backendHealth(resourceGroup, gatewayName, __cb(_, __frame, 27, 73, function ___(__0, __4) { applicationGateway = __4; _(null, null, true); }, 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() { cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); }); applicationGateways.command("start [resource-group] [name]").description($("Perform start operation on an application gateway")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the application gateway")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__5", line: 214 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return networkManagementClient.applicationGateways.get(resourceGroup, name, null, __cb(_, __frame, 11, 73, function ___(__0, __3) { applicationGateway = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__5() { if (e) { if ((e.statusCode === 404)) { applicationGateway = 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() { if (!applicationGateway) { return _(new Error(util.format($("an application gateway with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; progress = cli.interaction.progress(util.format($("Performing start operation on an application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return networkManagementClient.applicationGateways.start(resourceGroup, name, __cb(_, __frame, 27, 73, function ___(__0, __4) { applicationGateway = __4; _(null, null, true); }, 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() { cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); }); applicationGateways.command("stop [resource-group] [name]").description($("Perform stop operation on an application gateway")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the application gateway")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __6(resourceGroup, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress; var __frame = { name: "__6", line: 255 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return networkManagementClient.applicationGateways.get(resourceGroup, name, null, __cb(_, __frame, 11, 73, function ___(__0, __3) { applicationGateway = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__6() { if (e) { if ((e.statusCode === 404)) { applicationGateway = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__6() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__6() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__6() { if (!applicationGateway) { return _(new Error(util.format($("an application gateway with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; progress = cli.interaction.progress(util.format($("Performing stop operation on an application gateway \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return networkManagementClient.applicationGateways.stop(resourceGroup, name, __cb(_, __frame, 27, 73, function ___(__0, __4) { applicationGateway = __4; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__6() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__6() { cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); });};