UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

264 lines (117 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 expressRoutes = network.category("express-route").description($("Commands to manage express routes")); var expressRouteCircuitAuthorizations = expressRoutes.category("authorization").description($("Commands to manage express route circuit authorizations")); expressRouteCircuitAuthorizations.command("create [resource-group] [circuit-name] [auth-name] [key]").description($("Create an express route circuit authorization")).usage("[options] <resource-group> <circuit-name> <auth-name> <key>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-c, --circuit-name <circuit-name>", $("the circuit name")).option("-n, --auth-name <auth-name>", $("the auth name")).option("-k, --key <key>", $("the authorization key")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, circuitName, authName, key, options, _) { var subscription, networkManagementClient, expressRouteCircuitAuthorization, progress, parameters; var __frame = { name: "__1", line: 47 }; return __func(_, this, arguments, __1, 5, __frame, function __$__1() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("circuit name : "), circuitName, __cb(_, __frame, 2, 36, function ___(__0, __2) { circuitName = __2; return cli.interaction.promptIfNotGiven($("auth name : "), authName, __cb(_, __frame, 3, 33, function ___(__0, __3) { authName = __3; return cli.interaction.promptIfNotGiven($("key : "), key, __cb(_, __frame, 4, 36, function ___(__0, __4) { options.key = __4; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.expressRouteCircuitAuthorizations.get(resourceGroup, circuitName, authName, null, __cb(_, __frame, 12, 101, function ___(__0, __5) { expressRouteCircuitAuthorization = __5; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) { if ((e.statusCode === 404)) { expressRouteCircuitAuthorization = 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 (expressRouteCircuitAuthorization) { return _(new Error(util.format($("express route circuit authorization with name \"%s\" already exists in the resource group \"%s\""), authName, resourceGroup))); } ; parameters = { }; if (options.key) { parameters.authorizationKey = options.key.toString("base64"); } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Creating express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.expressRouteCircuitAuthorizations.createOrUpdate(resourceGroup, circuitName, authName, parameters, __cb(_, __frame, 35, 101, function ___(__0, __6) { expressRouteCircuitAuthorization = __6; _(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() { cli.interaction.formatOutput(expressRouteCircuitAuthorization, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }, true)); }); }); expressRouteCircuitAuthorizations.command("set [resource-group] [circuit-name] [auth-name]").description($("Update an express route circuit authorization")).usage("[options] <resource-group> <circuit-name> <auth-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-c, --circuit-name <circuit-name>", $("the circuit name")).option("-n, --auth-name <auth-name>", $("the auth name")).option("-k, --key [key]", $("the authorization key")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, circuitName, authName, options, _) { var subscription, networkManagementClient, expressRouteCircuitAuthorization, progress, parameters; var __frame = { name: "__2", line: 98 }; 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($("circuit name : "), circuitName, __cb(_, __frame, 2, 36, function ___(__0, __2) { circuitName = __2; return cli.interaction.promptIfNotGiven($("auth name : "), authName, __cb(_, __frame, 3, 33, function ___(__0, __3) { authName = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.expressRouteCircuitAuthorizations.get(resourceGroup, circuitName, authName, null, __cb(_, __frame, 11, 101, function ___(__0, __4) { expressRouteCircuitAuthorization = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) { if ((e.statusCode === 404)) { expressRouteCircuitAuthorization = 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 (!expressRouteCircuitAuthorization) { return _(new Error(util.format($("express route circuit authorization with name \"%s\" not found in the resource group \"%s\""), authName, resourceGroup))); } ; parameters = expressRouteCircuitAuthorization; if (options.key) { parameters.authorizationKey = options.key.toString("base64"); } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Updating express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.expressRouteCircuitAuthorizations.createOrUpdate(resourceGroup, circuitName, authName, parameters, __cb(_, __frame, 34, 101, function ___(__0, __5) { expressRouteCircuitAuthorization = __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() { cli.interaction.formatOutput(expressRouteCircuitAuthorization, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); expressRouteCircuitAuthorizations.command("delete [resource-group] [circuit-name] [auth-name]").description($("Delete an express route circuit authorization")).usage("[options] <resource-group> <circuit-name> <auth-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-c, --circuit-name <circuit-name>", $("the circuit name")).option("-n, --auth-name <auth-name>", $("the auth name")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, circuitName, authName, options, _) { var subscription, networkManagementClient, expressRouteCircuitAuthorization, progress; var __frame = { name: "__3", line: 148 }; 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($("circuit name : "), circuitName, __cb(_, __frame, 2, 36, function ___(__0, __3) { circuitName = __3; return cli.interaction.promptIfNotGiven($("auth name : "), authName, __cb(_, __frame, 3, 33, function ___(__0, __4) { authName = __4; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.expressRouteCircuitAuthorizations.get(resourceGroup, circuitName, authName, null, __cb(_, __frame, 11, 101, function ___(__0, __5) { expressRouteCircuitAuthorization = __5; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) { if ((e.statusCode === 404)) { expressRouteCircuitAuthorization = 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() { if (!expressRouteCircuitAuthorization) { return _(new Error(util.format($("express route circuit authorization with name \"%s\" not found in the resource group \"%s\""), authName, resourceGroup))); } ; return (function __$__3(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete express route circuit authorization \"%s\"? [y/n] "), authName), __cb(_, __frame, 26, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -147, 17, function ___(__0, __6) { return (function __$__3(__then) { if (__6) { cli.output.info(util.format($("express route circuit authorization \"%s\" was not deleted and still exists in the resource group \"%s\""), authName, resourceGroup)); return _(null); } else { __then(); } ; })(function __$__3() { progress = cli.interaction.progress(util.format($("Deleting express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.expressRouteCircuitAuthorizations.deleteMethod(resourceGroup, circuitName, authName, __cb(_, __frame, 33, 101, function ___(__0, __7) { expressRouteCircuitAuthorization = __7; cli.output.info(util.format($("express route circuit authorization \"%s\" was successfully deleted from resource group \"%s\""), authName, resourceGroup)); _(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)); }); }); expressRouteCircuitAuthorizations.command("show [resource-group] [circuit-name] [auth-name]").description($("Show an express route circuit authorization")).usage("[options] <resource-group> <circuit-name> <auth-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-c, --circuit-name <circuit-name>", $("the circuit name")).option("-n, --auth-name <auth-name>", $("the auth name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, circuitName, authName, options, _) { var subscription, networkManagementClient, expressRouteCircuitAuthorization, progress; var __frame = { name: "__4", line: 195 }; 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($("circuit name : "), circuitName, __cb(_, __frame, 2, 36, function ___(__0, __2) { circuitName = __2; return cli.interaction.promptIfNotGiven($("auth name : "), authName, __cb(_, __frame, 3, 33, function ___(__0, __3) { authName = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the express route circuit authorization \"%s\""), authName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return networkManagementClient.expressRouteCircuitAuthorizations.get(resourceGroup, circuitName, authName, null, __cb(_, __frame, 11, 101, function ___(__0, __4) { expressRouteCircuitAuthorization = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__4() { if (e) { if ((e.statusCode === 404)) { expressRouteCircuitAuthorization = 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 (!expressRouteCircuitAuthorization) { cli.output.warn(util.format($("express route circuit authorization with name \"%s\" not found in the resource group \"%s\""), authName, resourceGroup)); } ; cli.interaction.formatOutput(expressRouteCircuitAuthorization, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }, true)); }); }); expressRouteCircuitAuthorizations.command("list [resource-group] [circuit-name]").description($("List express route circuit authorizations")).usage("[options] <resource-group> <circuit-name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-c, --circuit-name <circuit-name>", $("the circuit name")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, circuitName, options, _) { var subscription, networkManagementClient, expressRouteCircuitAuthorization, progress; var __frame = { name: "__5", line: 230 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { options.resourceGroup = resourceGroup; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); expressRouteCircuitAuthorization = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function __$__5(__then) { if ((typeof networkManagementClient.expressRouteCircuitAuthorizations.listAll != "function")) { return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 9, 42, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("express route circuit : "), circuitName, __cb(_, __frame, 10, 40, function ___(__0, __2) { circuitName = __2; progress = cli.interaction.progress($("Getting the express route circuit authorizations")); return networkManagementClient.expressRouteCircuitAuthorizations.list(resourceGroup, circuitName, __cb(_, __frame, 12, 103, function ___(__0, __3) { expressRouteCircuitAuthorization = __3; __then(); }, true)); }, true)); }, true)); } else { return (function __$__5(__then) { if (options.resourceGroup) { return cli.interaction.promptIfNotGiven($("express route circuit : "), circuitName, __cb(_, __frame, 15, 42, function ___(__0, __4) { circuitName = __4; progress = cli.interaction.progress($("Getting the express route circuit authorizations")); return networkManagementClient.expressRouteCircuitAuthorizations.list(resourceGroup, circuitName, __cb(_, __frame, 17, 105, function ___(__0, __5) { expressRouteCircuitAuthorization = __5; __then(); }, true)); }, true)); } else { return cli.interaction.promptIfNotGiven($("express route circuit : "), circuitName, __cb(_, __frame, 19, 42, function ___(__0, __6) { circuitName = __6; progress = cli.interaction.progress($("Getting the express route circuit authorizations")); return networkManagementClient.expressRouteCircuitAuthorizations.listAll(circuitName, __cb(_, __frame, 21, 105, function ___(__0, __7) { expressRouteCircuitAuthorization = __7; __then(); }, true)); }, true)); } ; })(__then); } ; })(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() { cli.interaction.formatOutput(expressRouteCircuitAuthorization, function(expressRouteCircuitAuthorization) { if ((!expressRouteCircuitAuthorization || (expressRouteCircuitAuthorization.length === 0))) { cli.output.warn($("No express route circuit authorizations found")); } else { cli.output.table(expressRouteCircuitAuthorization, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); });};