UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

342 lines (155 loc) 21.6 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 applicationGateways = network.category("application-gateway").description($("Commands to manage application gateways")); var sslPolicy = applicationGateways.category("ssl-policy").description($("Commands to manage ssl policy")); sslPolicy.command("create [resource-group] [gateway-name]").description($("Create a ssl policy")).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("-d, --disable-ssl-protocols [disable-ssl-protocols]", $(("ssl protocols to be disabled on" + "\n application gateway"))).option("-p, --policy-type [policy-type]", $("type of Ssl Policy")).option("-r, --policy-name [policy-name]", $("name of Ssl predefined policy")).option("-c, --cipher-suites [cipher-suites]", $(("ssl cipher suites to be enabled in the" + "\n specified order to application gateway"))).option("-m, --min-protocol-version [min-protocol-version]", $(("minimum version of Ssl protocol to be" + "\n supported on application gateway"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, gatewayName, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, sslPolicy, parameters; var __frame = { name: "__1", line: 54 }; return __func(_, this, arguments, __1, 3, __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; 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, 10, 73, function ___(__0, __3) { applicationGateway = __3; __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))); } ; sslPolicy = parentItem.sslPolicy; if (sslPolicy) { return _(new Error(util.format($("ssl policy already exists in application gateway \"%s\""), gatewayName))); } ; parameters = { }; if (options.disableSslProtocols) { parameters.disabledSslProtocols = generatorUtils.splitStringByCharacter(options.disableSslProtocols, ","); } ; if (options.policyType) { parameters.policyType = validation.isIn(options.policyType, ["Predefined","Custom",], "--policy-type"); } ; if (options.policyName) { parameters.name = options.policyName; } ; if (options.cipherSuites) { parameters.cipherSuites = generatorUtils.splitStringByCharacter(options.cipherSuites, ","); } ; if (options.minProtocolVersion) { parameters.minProtocolVersion = options.minProtocolVersion; } ; parentItem.sslPolicy = parameters; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Creating ssl policy in application gateway \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 58, 73, function ___(__0, __4) { applicationGateway = __4; _(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 = applicationGateway; cli.interaction.formatOutput(parentItem.sslPolicy, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); }); sslPolicy.command("set [resource-group] [gateway-name]").description($("Update a ssl policy")).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("-d, --disable-ssl-protocols [disable-ssl-protocols]", $(("ssl protocols to be disabled on" + "\n application gateway"))).option("-p, --policy-type [policy-type]", $("type of Ssl Policy")).option("-r, --policy-name [policy-name]", $("name of Ssl predefined policy")).option("-c, --cipher-suites [cipher-suites]", $(("ssl cipher suites to be enabled in the" + "\n specified order to application gateway"))).option("-m, --min-protocol-version [min-protocol-version]", $(("minimum version of Ssl protocol to be" + "\n supported on application gateway"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, gatewayName, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem, sslPolicy, parameters; var __frame = { name: "__2", line: 135 }; 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($("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 __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.applicationGateways.get(resourceGroup, gatewayName, 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() { parentItem = applicationGateway; if (!parentItem) { return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ; sslPolicy = parentItem.sslPolicy; if (!sslPolicy) { return _(new Error(util.format($("ssl policy not found in application gateway \"%s\""), gatewayName))); } ; parameters = sslPolicy; if (options.disableSslProtocols) { if (!utils.argHasValue(options.disableSslProtocols)) { delete parameters.disabledSslProtocols; } else { parameters.disabledSslProtocols = generatorUtils.splitStringByCharacter(options.disableSslProtocols, ","); } ; } ; if (options.policyType) { if (!utils.argHasValue(options.policyType)) { delete parameters.policyType; } else { parameters.policyType = validation.isIn(options.policyType, ["Predefined","Custom",], "--policy-type"); } ; } ; if (options.policyName) { if (!utils.argHasValue(options.policyName)) { delete parameters.name; } else { parameters.name = options.policyName; } ; } ; if (options.cipherSuites) { if (!utils.argHasValue(options.cipherSuites)) { delete parameters.cipherSuites; } else { parameters.cipherSuites = generatorUtils.splitStringByCharacter(options.cipherSuites, ","); } ; } ; if (options.minProtocolVersion) { if (!utils.argHasValue(options.minProtocolVersion)) { delete parameters.minProtocolVersion; } else { parameters.minProtocolVersion = options.minProtocolVersion; } ; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Updating ssl policy in \"%s\""), gatewayName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 76, 73, function ___(__0, __4) { applicationGateway = __4; _(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 = applicationGateway; cli.interaction.formatOutput(parentItem.sslPolicy, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); }); sslPolicy.command("delete [resource-group] [gateway-name]").description($("Delete a ssl policy")).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("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, gatewayName, options, _) { var subscription, networkManagementClient, applicationGateway, progress, parentItem; var __frame = { name: "__3", line: 227 }; return __func(_, this, arguments, __3, 3, __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; 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, 10, 73, function ___(__0, __4) { applicationGateway = __4; __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))); } ; return (function __$__3(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete ssl policy from application gateway \"%s\"? [y/n] "), gatewayName), __cb(_, __frame, 26, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -226, 17, function ___(__0, __5) { return (function __$__3(__then) { if (__5) { return _(null); } else { __then(); } ; })(function __$__3() { delete parentItem.sslPolicy; progress = cli.interaction.progress("Deleting ssl policy"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.applicationGateways.createOrUpdate(resourceGroup, gatewayName, applicationGateway, __cb(_, __frame, 34, 73, function ___(__0, __6) { applicationGateway = __6; _(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)); }); }); sslPolicy.command("show [resource-group] [gateway-name]").description($("Show a ssl policy")).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, parentItem, sslPolicy; var __frame = { name: "__4", line: 273 }; 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, 10, 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() { parentItem = applicationGateway; if (!parentItem) { return _(new Error(util.format($("application gateway with name \"%s\" not found in the resource group \"%s\""), gatewayName, resourceGroup))); } ; sslPolicy = parentItem.sslPolicy; if (!sslPolicy) { cli.output.warn(util.format($("ssl policy not found in the \"%s\""), gatewayName)); } ; cli.interaction.formatOutput(sslPolicy, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }); }); sslPolicy.command("list [resource-group] [gateway-name]").description($("List ssl policies")).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: 313 }; 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.sslPolicy, function(items) { if ((!items || (items.length === 0))) { cli.output.warn($("No ssl policies found")); } else { cli.output.table(items, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); });};