azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
556 lines (287 loc) • 38 kB
JavaScript
/*** 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 applicationGateways = network.category("application-gateway").description($("Commands to manage application gateways"));
var requestRoutingRules = applicationGateways.category("rule").description($("Commands to manage request routing rules"));
requestRoutingRules.command("create [resource-group] [gateway-name] [name]").description($("Create a request routing rule")).usage("[options] <resource-group> <gateway-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-w, --gateway-name <gateway-name>", $("the gateway name")).option("-n, --name <name>", $("the name of the request routing rule")).option("-t, --type [type]", $("rule type")).option("-p, --address-pool-name [address-pool-name]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --address-pool-id"))).option("-a, --address-pool-id [address-pool-id]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --address-pool-name"))).option("-i, --http-settings-name [http-settings-name]", $(("sets backend http settings. This option" + "\n is mutually exclusive with --http-settings-id"))).option("-e, --http-settings-id [http-settings-id]", $(("sets backend http settings. This option" + "\n is mutually exclusive with --http-settings-name"))).option("-l, --http-listener-name [http-listener-name]", $(("sets http listener. This option is" + "\n mutually exclusive with --http-listener-id"))).option("-r, --http-listener-id [http-listener-id]", $(("sets http listener. This option is" + "\n mutually exclusive with --http-listener-name"))).option("-u, --url-path-map-name [url-path-map-name]", $(("sets url path map. This option is" + "\n mutually exclusive with --url-path-map-id"))).option("-m, --url-path-map-id [url-path-map-id]", $(("sets url path map. This option is" + "\n mutually exclusive with --url-path-map-name"))).option("-b, --redirect-configuration-name [redirect-configuration-name]", $(("sets redirect configuration. This" + "\n option is mutually exclusive with --redirect-configuration-id"))).option("-c, --redirect-configuration-id [redirect-configuration-id]", $(("sets redirect configuration. This" + "\n option is mutually exclusive with --redirect-configuration-name"))).option("--nowait", $("do not wait for the operation to complete. Returns as soon as the intial request is received by the server")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, gatewayName, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, requestRoutingRule, parameters, referredBackendAddressPool, idContainerBackendAddressPool, referredBackendHttpSettings, idContainerBackendHttpSettings, referredHttpListener, idContainerHttpListener, referredUrlPathMap, idContainerUrlPathMap, referredRedirectConfiguration, idContainerRedirectConfiguration; var __frame = { name: "__1", line: 69 }; return __func(_, this, arguments, __1, 4, __frame, function __$__1() {
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;
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 application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() {
return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, null, __cb(_, __frame, 11, 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() {
parentItem = applicationGateway;
if (!parentItem) {
return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ;
requestRoutingRule = utils.findFirstCaseIgnore(parentItem.requestRoutingRules, { name: name });
if (requestRoutingRule) {
return _(new Error(util.format($("request routing rule with name \"%s\" already exists in application gateway \"%s\""), name, gatewayName))); } ;
parameters = { };
if (options.type) {
parameters.ruleType = validation.isIn(options.type, ["Basic","PathBasedRouting",], "--type"); } ;
if (!parameters.backendAddressPool) {
parameters.backendAddressPool = { }; } ;
if (options.addressPoolId) {
if (options.addressPoolName) {
cli.output.warn($("--address-pool-name parameter will be ignored because --address-pool-id and --address-pool-name are mutually exclusive")); } ;
parameters.backendAddressPool.id = options.addressPoolId; } else {
if (options.addressPoolName) {
referredBackendAddressPool = utils.findFirstCaseIgnore(applicationGateway.backendAddressPools, { name: options.addressPoolName });
if (!referredBackendAddressPool) {
return _(new Error(util.format($("No backend address pool with name \"%s\" found"), options.addressPoolName))); } ;
idContainerBackendAddressPool = referredBackendAddressPool;
parameters.backendAddressPool.id = idContainerBackendAddressPool.id; } ; } ;
if (!parameters.backendHttpSettings) {
parameters.backendHttpSettings = { }; } ;
if (options.httpSettingsId) {
if (options.httpSettingsName) {
cli.output.warn($("--http-settings-name parameter will be ignored because --http-settings-id and --http-settings-name are mutually exclusive")); } ;
parameters.backendHttpSettings.id = options.httpSettingsId; } else {
if (options.httpSettingsName) {
referredBackendHttpSettings = utils.findFirstCaseIgnore(applicationGateway.backendHttpSettingsCollection, { name: options.httpSettingsName });
if (!referredBackendHttpSettings) {
return _(new Error(util.format($("No backend http settings with name \"%s\" found"), options.httpSettingsName))); } ;
idContainerBackendHttpSettings = referredBackendHttpSettings;
parameters.backendHttpSettings.id = idContainerBackendHttpSettings.id; } ; } ;
if (!parameters.httpListener) {
parameters.httpListener = { }; } ;
if (options.httpListenerId) {
if (options.httpListenerName) {
cli.output.warn($("--http-listener-name parameter will be ignored because --http-listener-id and --http-listener-name are mutually exclusive")); } ;
parameters.httpListener.id = options.httpListenerId; } else {
if (options.httpListenerName) {
referredHttpListener = utils.findFirstCaseIgnore(applicationGateway.httpListeners, { name: options.httpListenerName });
if (!referredHttpListener) {
return _(new Error(util.format($("No http listener with name \"%s\" found"), options.httpListenerName))); } ;
idContainerHttpListener = referredHttpListener;
parameters.httpListener.id = idContainerHttpListener.id; } ; } ;
if (!parameters.urlPathMap) {
parameters.urlPathMap = { }; } ;
if (options.urlPathMapId) {
if (options.urlPathMapName) {
cli.output.warn($("--url-path-map-name parameter will be ignored because --url-path-map-id and --url-path-map-name are mutually exclusive")); } ;
parameters.urlPathMap.id = options.urlPathMapId; } else {
if (options.urlPathMapName) {
referredUrlPathMap = utils.findFirstCaseIgnore(applicationGateway.urlPathMaps, { name: options.urlPathMapName });
if (!referredUrlPathMap) {
return _(new Error(util.format($("No url path map with name \"%s\" found"), options.urlPathMapName))); } ;
idContainerUrlPathMap = referredUrlPathMap;
parameters.urlPathMap.id = idContainerUrlPathMap.id; } ; } ;
if (!parameters.redirectConfiguration) {
parameters.redirectConfiguration = { }; } ;
if (options.redirectConfigurationId) {
if (options.redirectConfigurationName) {
cli.output.warn($("--redirect-configuration-name parameter will be ignored because --redirect-configuration-id and --redirect-configuration-name are mutually exclusive")); } ;
parameters.redirectConfiguration.id = options.redirectConfigurationId; } else {
if (options.redirectConfigurationName) {
referredRedirectConfiguration = utils.findFirstCaseIgnore(applicationGateway.redirectConfigurations, { name: options.redirectConfigurationName });
if (!referredRedirectConfiguration) {
return _(new Error(util.format($("No redirect configuration with name \"%s\" found"), options.redirectConfigurationName))); } ;
idContainerRedirectConfiguration = referredRedirectConfiguration;
parameters.redirectConfiguration.id = idContainerRedirectConfiguration.id; } ; } ;
parameters.name = name;
parentItem.requestRoutingRules.push(parameters);
generatorUtils.removeEmptyObjects(parameters);
progress = cli.interaction.progress(util.format($("Creating request routing rule in application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function __$__1(__then) {
if (options.nowait) {
return networkManagementClient.applicationGateways.beginCreateOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 130, 75, function ___(__0, __5) { applicationGateway = __5; __then(); }, true)); } else {
return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 132, 75, function ___(__0, __6) { applicationGateway = __6; __then(); }, true)); } ; })(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() {
cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); });
requestRoutingRules.command("set [resource-group] [gateway-name] [name]").description($("Update a request routing rule")).usage("[options] <resource-group> <gateway-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-w, --gateway-name <gateway-name>", $("the gateway name")).option("-n, --name <name>", $("the name of the request routing rule")).option("-t, --type [type]", $("rule type")).option("-p, --address-pool-name [address-pool-name]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --address-pool-id"))).option("-a, --address-pool-id [address-pool-id]", $(("sets backend address pool. This option" + "\n is mutually exclusive with --address-pool-name"))).option("-i, --http-settings-name [http-settings-name]", $(("sets backend http settings. This option" + "\n is mutually exclusive with --http-settings-id"))).option("-e, --http-settings-id [http-settings-id]", $(("sets backend http settings. This option" + "\n is mutually exclusive with --http-settings-name"))).option("-l, --http-listener-name [http-listener-name]", $(("sets http listener. This option is" + "\n mutually exclusive with --http-listener-id"))).option("-r, --http-listener-id [http-listener-id]", $(("sets http listener. This option is" + "\n mutually exclusive with --http-listener-name"))).option("-u, --url-path-map-name [url-path-map-name]", $(("sets url path map. This option is" + "\n mutually exclusive with --url-path-map-id"))).option("-m, --url-path-map-id [url-path-map-id]", $(("sets url path map. This option is" + "\n mutually exclusive with --url-path-map-name"))).option("-b, --redirect-configuration-name [redirect-configuration-name]", $(("sets redirect configuration. This" + "\n option is mutually exclusive with --redirect-configuration-id"))).option("-c, --redirect-configuration-id [redirect-configuration-id]", $(("sets redirect configuration. This" + "\n option is mutually exclusive with --redirect-configuration-name"))).option("--nowait", $("do not wait for the operation to complete. Returns as soon as the intial request is received by the server")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, gatewayName, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, requestRoutingRule, parameters, referredBackendAddressPool, idContainerBackendAddressPool, referredBackendHttpSettings, idContainerBackendHttpSettings, referredHttpListener, idContainerHttpListener, referredUrlPathMap, idContainerUrlPathMap, referredRedirectConfiguration, idContainerRedirectConfiguration; var __frame = { name: "__2", line: 239 }; return __func(_, this, arguments, __2, 4, __frame, function __$__2() {
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;
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 application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {
return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, null, __cb(_, __frame, 11, 73, function ___(__0, __4) { applicationGateway = __4; __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() {
parentItem = applicationGateway;
if (!parentItem) {
return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ;
requestRoutingRule = utils.findFirstCaseIgnore(parentItem.requestRoutingRules, { name: name });
if (!requestRoutingRule) {
return _(new Error(util.format($("request routing rule with name \"%s\" not found in application gateway \"%s\""), name, gatewayName))); } ;
parameters = requestRoutingRule;
if (options.type) {
parameters.ruleType = validation.isIn(options.type, ["Basic","PathBasedRouting",], "--type"); } ;
if (!parameters.backendAddressPool) {
parameters.backendAddressPool = { }; } ;
if (options.addressPoolId) {
if (options.addressPoolName) {
cli.output.warn($("--address-pool-name parameter will be ignored because --address-pool-id and --address-pool-name are mutually exclusive")); } ;
if (!utils.argHasValue(options.addressPoolId)) {
delete parameters.backendAddressPool.id; }
else {
parameters.backendAddressPool.id = options.addressPoolId; } ; } else {
if (options.addressPoolName) {
if (!utils.argHasValue(options.addressPoolName)) {
delete parameters.backendAddressPool.id; }
else {
referredBackendAddressPool = utils.findFirstCaseIgnore(applicationGateway.backendAddressPools, { name: options.addressPoolName });
if (!referredBackendAddressPool) {
return _(new Error(util.format($("No backend address pool with name \"%s\" found"), options.addressPoolName))); } ;
idContainerBackendAddressPool = referredBackendAddressPool;
parameters.backendAddressPool.id = idContainerBackendAddressPool.id; } ; } ; } ;
if (!parameters.backendHttpSettings) {
parameters.backendHttpSettings = { }; } ;
if (options.httpSettingsId) {
if (options.httpSettingsName) {
cli.output.warn($("--http-settings-name parameter will be ignored because --http-settings-id and --http-settings-name are mutually exclusive")); } ;
if (!utils.argHasValue(options.httpSettingsId)) {
delete parameters.backendHttpSettings.id; }
else {
parameters.backendHttpSettings.id = options.httpSettingsId; } ; } else {
if (options.httpSettingsName) {
if (!utils.argHasValue(options.httpSettingsName)) {
delete parameters.backendHttpSettings.id; }
else {
referredBackendHttpSettings = utils.findFirstCaseIgnore(applicationGateway.backendHttpSettingsCollection, { name: options.httpSettingsName });
if (!referredBackendHttpSettings) {
return _(new Error(util.format($("No backend http settings with name \"%s\" found"), options.httpSettingsName))); } ;
idContainerBackendHttpSettings = referredBackendHttpSettings;
parameters.backendHttpSettings.id = idContainerBackendHttpSettings.id; } ; } ; } ;
if (!parameters.httpListener) {
parameters.httpListener = { }; } ;
if (options.httpListenerId) {
if (options.httpListenerName) {
cli.output.warn($("--http-listener-name parameter will be ignored because --http-listener-id and --http-listener-name are mutually exclusive")); } ;
if (!utils.argHasValue(options.httpListenerId)) {
delete parameters.httpListener.id; }
else {
parameters.httpListener.id = options.httpListenerId; } ; } else {
if (options.httpListenerName) {
if (!utils.argHasValue(options.httpListenerName)) {
delete parameters.httpListener.id; }
else {
referredHttpListener = utils.findFirstCaseIgnore(applicationGateway.httpListeners, { name: options.httpListenerName });
if (!referredHttpListener) {
return _(new Error(util.format($("No http listener with name \"%s\" found"), options.httpListenerName))); } ;
idContainerHttpListener = referredHttpListener;
parameters.httpListener.id = idContainerHttpListener.id; } ; } ; } ;
if (!parameters.urlPathMap) {
parameters.urlPathMap = { }; } ;
if (options.urlPathMapId) {
if (options.urlPathMapName) {
cli.output.warn($("--url-path-map-name parameter will be ignored because --url-path-map-id and --url-path-map-name are mutually exclusive")); } ;
if (!utils.argHasValue(options.urlPathMapId)) {
delete parameters.urlPathMap.id; }
else {
parameters.urlPathMap.id = options.urlPathMapId; } ; } else {
if (options.urlPathMapName) {
if (!utils.argHasValue(options.urlPathMapName)) {
delete parameters.urlPathMap.id; }
else {
referredUrlPathMap = utils.findFirstCaseIgnore(applicationGateway.urlPathMaps, { name: options.urlPathMapName });
if (!referredUrlPathMap) {
return _(new Error(util.format($("No url path map with name \"%s\" found"), options.urlPathMapName))); } ;
idContainerUrlPathMap = referredUrlPathMap;
parameters.urlPathMap.id = idContainerUrlPathMap.id; } ; } ; } ;
if (!parameters.redirectConfiguration) {
parameters.redirectConfiguration = { }; } ;
if (options.redirectConfigurationId) {
if (options.redirectConfigurationName) {
cli.output.warn($("--redirect-configuration-name parameter will be ignored because --redirect-configuration-id and --redirect-configuration-name are mutually exclusive")); } ;
if (!utils.argHasValue(options.redirectConfigurationId)) {
delete parameters.redirectConfiguration.id; }
else {
parameters.redirectConfiguration.id = options.redirectConfigurationId; } ; } else {
if (options.redirectConfigurationName) {
if (!utils.argHasValue(options.redirectConfigurationName)) {
delete parameters.redirectConfiguration.id; }
else {
referredRedirectConfiguration = utils.findFirstCaseIgnore(applicationGateway.redirectConfigurations, { name: options.redirectConfigurationName });
if (!referredRedirectConfiguration) {
return _(new Error(util.format($("No redirect configuration with name \"%s\" found"), options.redirectConfigurationName))); } ;
idContainerRedirectConfiguration = referredRedirectConfiguration;
parameters.redirectConfiguration.id = idContainerRedirectConfiguration.id; } ; } ; } ;
generatorUtils.removeEmptyObjects(parameters);
progress = cli.interaction.progress(util.format($("Updating request routing rule in \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function __$__2(__then) {
if (options.nowait) {
return networkManagementClient.applicationGateways.beginCreateOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 167, 75, function ___(__0, __5) { applicationGateway = __5; __then(); }, true)); } else {
return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 169, 75, function ___(__0, __6) { applicationGateway = __6; __then(); }, true)); } ; })(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() {
cli.interaction.formatOutput(applicationGateway, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); });
requestRoutingRules.command("delete [resource-group] [gateway-name] [name]").description($("Delete a request routing rule")).usage("[options] <resource-group> <gateway-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-w, --gateway-name <gateway-name>", $("the gateway name")).option("-n, --name <name>", $("the name of the request routing rule")).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 __3(resourceGroup, gatewayName, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, index; var __frame = { name: "__3", line: 426 }; 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($("gateway name : "), gatewayName, __cb(_, __frame, 2, 36, function ___(__0, __3) { gatewayName = __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 application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() {
return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, null, __cb(_, __frame, 11, 73, function ___(__0, __5) { applicationGateway = __5; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) {
if ((e.statusCode === 404)) {
applicationGateway = 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 = applicationGateway;
if (!parentItem) {
return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ;
index = utils.indexOfCaseIgnore(parentItem.requestRoutingRules, { name: name });
if ((index === -1)) {
return _(new Error(util.format($("request routing rule \"%s\" not found in application gateway \"%s\""), name, gatewayName))); } ; return (function __$__3(_) {
var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete request routing rule with name \"%s\" from application gateway \"%s\"? [y/n] "), name, gatewayName), __cb(_, __frame, 32, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -425, 17, function ___(__0, __6) { return (function __$__3(__then) { if (__6) { return _(null); } else { __then(); } ; })(function __$__3() {
parentItem.requestRoutingRules.splice(index, 1);
progress = cli.interaction.progress("Deleting request routing rule"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function __$__3(__then) {
if (options.nowait) {
return networkManagementClient.applicationGateways.beginCreateOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 41, 75, function ___(__0, __7) { applicationGateway = __7; __then(); }, true)); } else {
return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 44, 75, function ___(__0, __8) { applicationGateway = __8; __then(); }, true)); } ; })(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, generatorUtils.traverse); _(); }); }); }); }, true)); }); }); }, true)); }, true)); }, true)); }); });
requestRoutingRules.command("show [resource-group] [gateway-name] [name]").description($("Show a request routing rule")).usage("[options] <resource-group> <gateway-name> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-w, --gateway-name <gateway-name>", $("the gateway name")).option("-n, --name <name>", $("the name of the request routing rule")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, gatewayName, name, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, requestRoutingRule; var __frame = { name: "__4", line: 486 }; 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($("gateway name : "), gatewayName, __cb(_, __frame, 2, 36, function ___(__0, __2) { gatewayName = __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 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, __4) { applicationGateway = __4; __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() {
parentItem = applicationGateway;
if (!parentItem) {
return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ;
requestRoutingRule = utils.findFirstCaseIgnore(parentItem.requestRoutingRules, { name: name });
if (!requestRoutingRule) {
cli.output.warn(util.format($("request routing rule with name \"%s\" not found in the application gateway \"%s\""), name, gatewayName)); } ;
cli.interaction.formatOutput(requestRoutingRule, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }, true)); }); });
requestRoutingRules.command("list [resource-group] [gateway-name]").description($("List request routing rules")).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 __5(resourceGroup, gatewayName, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem; var __frame = { name: "__5", line: 527 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() {
subscription = profile.current.getSubscription(options.subscription);
networkManagementClient = utils.createNetworkManagementClient(subscription);
applicationGateway = null;
progress = cli.interaction.progress(util.format($("Looking up the application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() {
return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, null, __cb(_, __frame, 7, 73, function ___(__0, __1) { applicationGateway = __1; __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() {
parentItem = applicationGateway;
if (!parentItem) {
return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ;
cli.interaction.formatOutput(parentItem.requestRoutingRules, function(items) {
if ((!items || (items.length === 0))) {
cli.output.warn($("No request routing rules found")); }
else {
cli.output.table(items, function(row, item) {
generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); });};