UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

67 lines (33 loc) 3.04 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; var profile = require("../../../util/profile"); var utils = require("../../../util/utils"); var providerUtils = require("../providers/providerUtils"); var locationUtils = require("./locationUtils"); var $ = utils.getLocaleString; exports.init = function(cli) { var log = cli.output; var withProgress = cli.interaction.withProgress.bind(cli.interaction); var location = cli.category("location").description($("Commands to get the available locations")); location.command("list").description($("list the available locations")).option("--subscription <subscription>", $("the subscription identifier")).option("--details", $("shows full provider list with latitude and longitude")).execute(function __1(client, options, _) { var providers, subscription, resourceClient, subscriptionClient, listOfLocations, listLength; var __frame = { name: "__1", line: 36 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { subscription = profile.current.getSubscription(options.subscription); resourceClient = utils.createResourceClient(subscription); subscriptionClient = utils.createSubscriptionClient(subscription); return subscriptionClient.subscriptions.listLocations(subscription.id, __cb(_, __frame, 5, 61, function ___(__0, __2) { listOfLocations = __2; return withProgress($("Getting ARM registered providers"), function __1(log, _) { var __frame = { name: "__1", line: 44 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return providerUtils.getAllProviders(resourceClient, __cb(_, __frame, 1, 36, function ___(__0, __1) { providers = __1; listOfLocations = locationUtils.addProviders(listOfLocations, providers); _(); }, true)); }); }, __cb(_, __frame, 7, 6, function __$__1() { if (!options.json) { log.warn(("The \"location list\" commands is changed to list subscription's locations. " + "For old information, use \"provider list or show\" commands.")); log.info("Getting locations..."); } ; listLength = (options.details ? "all" : 4); cli.interaction.formatOutput(listOfLocations, function(data) { if ((data.length === 0)) { log.info($("No location found")); } else { data.forEach(function(location) { log.data(""); log.data($("Location : "), location.name); log.data($("DisplayName : "), location.displayName); if (options.details) { log.data($("Latitude : "), location.latitude); log.data($("Longitude : "), location.longitude); } ; log.data($("Providers : "), locationUtils.showList(location.providers, listLength)); }); } ; }); _(); }, true)); }, true)); }); });};