UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

72 lines (28 loc) 3.24 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,__tryCatch=__rt.__tryCatch; var generatorUtils = require("../../../util/generatorUtils"); 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 usages = network.category("usage").description($("Commands to manage usages")); usages.command("list [location]").description($("List usages")).usage("[options] <location>").option("-l, --location <location>", $("the location")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(location, options, _) { var subscription, networkManagementClient, usage, progress; var __frame = { name: "__1", line: 41 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { return cli.interaction.promptIfNotGiven($("location : "), location, __cb(_, __frame, 1, 41, function ___(__0, __1) { options.location = __1; location = options.location; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); usage = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function __$__1(__then) { if ((typeof networkManagementClient.usages.listAll != "function")) { progress = cli.interaction.progress($("Getting the usages")); return networkManagementClient.usages.list(location, __cb(_, __frame, 11, 49, function ___(__0, __2) { usage = __2; __then(); }, true)); } else { return (function __$__1(__then) { if (options.resourceGroup) { progress = cli.interaction.progress($("Getting the usages")); return networkManagementClient.usages.list(location, __cb(_, __frame, 15, 51, function ___(__0, __3) { usage = __3; __then(); }, true)); } else { progress = cli.interaction.progress($("Getting the usages")); return networkManagementClient.usages.listAll(__cb(_, __frame, 18, 51, function ___(__0, __4) { usage = __4; __then(); }, true)); } ; })(__then); } ; })(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(usage, function(usage) { if ((!usage || (usage.length === 0))) { cli.output.warn($("No usages found")); } else { cli.output.table(usage, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }, true)); }); });};