UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

699 lines (312 loc) 69 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 tagUtils = require("../tag/tagUtils"); 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 networkWatchers = network.category("watcher").description($("Commands to manage network watchers")); networkWatchers.command("create [resource-group] [name] [location]").description($("Create a network watcher")).usage("[options] <resource-group> <name> <location>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-l, --location <location>", $("the location")).option("-t, --tags [tags]", $("the list of tags.\n Can be multiple. In the format of \"name=value\".\n Name is required and value is optional.\n For example, -t \"tag1=value1;tag2\"")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, name, location, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__1", line: 47 }; 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($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("location : "), location, __cb(_, __frame, 3, 41, function ___(__0, __3) { options.location = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 11, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) { if ((e.statusCode === 404)) { networkWatcher = 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 (networkWatcher) { return _(new Error(util.format($("network watcher with name \"%s\" already exists in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.location) { parameters.location = options.location; } ; if ((options.tags && utils.argHasValue(options.tags))) { tagUtils.appendTags(parameters, options); } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Creating network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return networkManagementClient.networkWatchers.createOrUpdate(resourceGroup, name, parameters, __cb(_, __frame, 38, 65, function ___(__0, __5) { networkWatcher = __5; _(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(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); networkWatchers.command("delete [resource-group] [name]").description($("Delete a network watcher")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, name, options, _) { var subscription, networkManagementClient, networkWatcher, progress; var __frame = { name: "__2", line: 100 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __2) { resourceGroup = __2; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 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 network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 10, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) { if ((e.statusCode === 404)) { networkWatcher = 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 (!networkWatcher) { return _(new Error(util.format($("network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; return (function __$__2(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete network watcher \"%s\"? [y/n] "), name), __cb(_, __frame, 25, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -99, 17, function ___(__0, __5) { return (function __$__2(__then) { if (__5) { cli.output.info(util.format($("network watcher \"%s\" was not deleted and still exists in the resource group \"%s\""), name, resourceGroup)); return _(null); } else { __then(); } ; })(function __$__2() { progress = cli.interaction.progress(util.format($("Deleting network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return networkManagementClient.networkWatchers.deleteMethod(resourceGroup, name, __cb(_, __frame, 32, 65, function ___(__0, __6) { networkWatcher = __6; cli.output.info(util.format($("network watcher \"%s\" was successfully deleted from resource group \"%s\""), name, resourceGroup)); _(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() { _(); }); }); }); }, true)); }); }); }, true)); }, true)); }); }); networkWatchers.command("show [resource-group] [name]").description($("Show a network watcher")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, name, options, _) { var subscription, networkManagementClient, networkWatcher, progress; var __frame = { name: "__3", line: 145 }; return __func(_, this, arguments, __3, 3, __frame, function __$__3() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 10, 65, function ___(__0, __3) { networkWatcher = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) { if ((e.statusCode === 404)) { networkWatcher = 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 (!networkWatcher) { cli.output.warn(util.format($("network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup)); } ; cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }, true)); }, true)); }); }); networkWatchers.command("list [resource-group]").description($("List network watchers")).usage("[options] <resource-group>").option("-g, --resource-group [resource-group]", $("the name of the resource group")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, options, _) { var subscription, networkManagementClient, networkWatcher, progress; var __frame = { name: "__4", line: 178 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() { options.resourceGroup = resourceGroup; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); networkWatcher = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function __$__4(__then) { if ((typeof networkManagementClient.networkWatchers.listAll != "function")) { return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 9, 42, function ___(__0, __1) { resourceGroup = __1; progress = cli.interaction.progress($("Getting the network watchers")); return networkManagementClient.networkWatchers.list(resourceGroup, __cb(_, __frame, 11, 67, function ___(__0, __2) { networkWatcher = __2; __then(); }, true)); }, true)); } else { return (function __$__4(__then) { if (options.resourceGroup) { progress = cli.interaction.progress($("Getting the network watchers")); return networkManagementClient.networkWatchers.list(resourceGroup, __cb(_, __frame, 15, 69, function ___(__0, __3) { networkWatcher = __3; __then(); }, true)); } else { progress = cli.interaction.progress($("Getting the network watchers")); return networkManagementClient.networkWatchers.listAll(__cb(_, __frame, 18, 69, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); } ; })(__then); } ; })(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() { cli.interaction.formatOutput(networkWatcher, function(networkWatcher) { if ((!networkWatcher || (networkWatcher.length === 0))) { cli.output.warn($("No network watchers found")); } else { cli.output.table(networkWatcher, function(row, item) { generatorUtils.showTableRow(row, item); }); } ; }); _(); }); }); }); }); networkWatchers.command("check-connectivity [resource-group] [name] [source-id]").description($("Perform check connectivity operation on a network watcher")).usage("[options] <resource-group> <name> <source-id>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-i, --source-id <source-id>", $(("the ID of the resource from which a" + "\n connectivity check will be initiated"))).option("-p, --source-port [source-port]", $("sets source port")).option("-d, --destination-id [destination-id]", $(("the ID of the resource to which a" + "\n connection attempt will be made"))).option("-a, --destination-address [destination-address]", $(("the IP address or URI the resource to" + "\n which a connection attempt will be made"))).option("-o, --destination-port [destination-port]", $("sets destination port")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, name, sourceId, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__5", line: 228 }; return __func(_, this, arguments, __5, 4, __frame, function __$__5() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("source id : "), sourceId, __cb(_, __frame, 3, 41, function ___(__0, __3) { options.sourceId = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 12, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__5() { if (e) { if ((e.statusCode === 404)) { networkWatcher = 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() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (!parameters.source) { parameters.source = { }; } ; if (options.sourceId) { parameters.source.resourceId = options.sourceId; } ; if (options.sourcePort) { parameters.source.port = parseInt(options.sourcePort, 10); } ; if (!parameters.destination) { parameters.destination = { }; } ; if (options.destinationId) { parameters.destination.resourceId = options.destinationId; } ; if (options.destinationAddress) { parameters.destination.address = options.destinationAddress; } ; if (options.destinationPort) { parameters.destination.port = parseInt(options.destinationPort, 10); } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing check connectivity operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return networkManagementClient.networkWatchers.checkConnectivity(resourceGroup, name, parameters, __cb(_, __frame, 56, 65, function ___(__0, __5) { networkWatcher = __5; _(null, null, true); }, 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(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); networkWatchers.command("reachability-report [resource-group] [name] [start-time] [end-time]").description($("Perform get azure reachability report operation on a network watcher")).usage("[options] <resource-group> <name> <start-time> <end-time>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-c, --country [country]", $("country option value")).option("-a, --state [state]", $("state option value")).option("-i, --city [city]", $("city option value")).option("-p, --providers [providers]", $("list of Internet service providers")).option("-l, --azure-locations [azure-locations]", $(("optional Azure regions to scope the" + "\n query to"))).option("-t, --start-time <start-time>", $(("the start time for the Azure" + "\n reachability report"))).option("-e, --end-time <end-time>", $(("the end time for the Azure reachability" + "\n report"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __6(resourceGroup, name, startTime, endTime, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__6", line: 308 }; return __func(_, this, arguments, __6, 5, __frame, function __$__6() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("start time : "), startTime, __cb(_, __frame, 3, 42, function ___(__0, __3) { options.startTime = __3; return cli.interaction.promptIfNotGiven($("end time : "), endTime, __cb(_, __frame, 4, 40, function ___(__0, __4) { options.endTime = __4; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 13, 65, function ___(__0, __5) { networkWatcher = __5; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__6() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__6() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__6() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__6() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (!parameters.providerLocation) { parameters.providerLocation = { }; } ; if (options.country) { parameters.providerLocation.country = options.country; } ; if (options.state) { parameters.providerLocation.state = options.state; } ; if (options.city) { parameters.providerLocation.city = options.city; } ; if (options.providers) { parameters.providers = generatorUtils.splitStringByCharacter(options.providers, ","); } ; if (options.azureLocations) { parameters.azureLocations = generatorUtils.splitStringByCharacter(options.azureLocations, ","); } ; if (options.startTime) { parameters.startTime = options.startTime; } ; if (options.endTime) { parameters.endTime = options.endTime; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get azure reachability report operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return networkManagementClient.networkWatchers.getAzureReachabilityReport(resourceGroup, name, parameters, __cb(_, __frame, 62, 65, function ___(__0, __6) { networkWatcher = __6; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__6() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__6() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }, true)); }); }); networkWatchers.command("flow-log-status [resource-group] [name] [target]").description($("Perform get flow log status operation on a network watcher")).usage("[options] <resource-group> <name> <target>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-t, --target <target>", $(("the target resource where getting the" + "\n flow logging status"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __7(resourceGroup, name, target, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__7", line: 386 }; return __func(_, this, arguments, __7, 4, __frame, function __$__7() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("target : "), target, __cb(_, __frame, 3, 39, function ___(__0, __3) { options.target = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 12, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__7() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__7() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__7() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__7() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.target) { parameters.targetResourceId = options.target; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get flow log status operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return networkManagementClient.networkWatchers.getFlowLogStatus(resourceGroup, name, parameters, __cb(_, __frame, 34, 65, function ___(__0, __5) { networkWatcher = __5; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__7() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__7() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); networkWatchers.command("next-hop [resource-group] [name] [target] [source-ip-address] [destination-ip-address]").description($("Perform get next hop operation on a network watcher")).usage("[options] <resource-group> <name> <target> <source-ip-address> <destination-ip-address>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-t, --target <target>", $(("the resource identifier of the target" + "\n resource against which the action is to be performed"))).option("-a, --source-ip-address <source-ip-address>", $("the source IP address")).option("-d, --destination-ip-address <destination-ip-address>", $("the destination IP address")).option("-i, --nic-id [nic-id]", $((("the NIC ID. (If VM has multiple NICs" + "\n and IP forwarding is enabled on any of the nics, then this parameter must be") + "\n specified. Otherwise optional)"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __8(resourceGroup, name, target, sourceIpAddress, destinationIpAddress, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__8", line: 441 }; return __func(_, this, arguments, __8, 6, __frame, function __$__8() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("target : "), target, __cb(_, __frame, 3, 39, function ___(__0, __3) { options.target = __3; return cli.interaction.promptIfNotGiven($("source ip address : "), sourceIpAddress, __cb(_, __frame, 4, 48, function ___(__0, __4) { options.sourceIpAddress = __4; return cli.interaction.promptIfNotGiven($("destination ip address : "), destinationIpAddress, __cb(_, __frame, 5, 53, function ___(__0, __5) { options.destinationIpAddress = __5; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 14, 65, function ___(__0, __6) { networkWatcher = __6; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__8() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__8() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__8() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__8() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.target) { parameters.targetResourceId = options.target; } ; if (options.sourceIpAddress) { parameters.sourceIPAddress = options.sourceIpAddress; } ; if (options.destinationIpAddress) { parameters.destinationIPAddress = options.destinationIpAddress; } ; if (options.nicId) { parameters.targetNicResourceId = options.nicId; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get next hop operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return networkManagementClient.networkWatchers.getNextHop(resourceGroup, name, parameters, __cb(_, __frame, 48, 65, function ___(__0, __7) { networkWatcher = __7; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__8() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__8() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }, true)); }, true)); }); }); networkWatchers.command("topology [resource-group] [name]").description($("Perform get topology operation on a network watcher")).usage("[options] <resource-group> <name>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-r, --topology-resource-group [topology-resource-group]", $(("the name of the target resource group" + "\n to perform topology on"))).option("-e, --target-vnet-id [target-vnet-id]", $("sets target virtual network.")).option("-u, --target-subnet-id [target-subnet-id]", $("sets target subnet.")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __9(resourceGroup, name, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__9", line: 507 }; return __func(_, this, arguments, __9, 3, __frame, function __$__9() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 11, 65, function ___(__0, __3) { networkWatcher = __3; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__9() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__9() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__9() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__9() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.topologyResourceGroup) { parameters.targetResourceGroupName = options.topologyResourceGroup; } ; if (!parameters.targetVirtualNetwork) { parameters.targetVirtualNetwork = { }; } ; if (options.targetVnetId) { parameters.targetVirtualNetwork.id = options.targetVnetId; } ; if (!parameters.targetSubnet) { parameters.targetSubnet = { }; } ; if (options.targetSubnetId) { parameters.targetSubnet.id = options.targetSubnetId; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get topology operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return networkManagementClient.networkWatchers.getTopology(resourceGroup, name, parameters, __cb(_, __frame, 47, 65, function ___(__0, __4) { networkWatcher = __4; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__9() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__9() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }); }); networkWatchers.command("troubleshoot [resource-group] [name] [target] [storage-id] [storage-path]").description($("Perform get troubleshooting operation on a network watcher")).usage("[options] <resource-group> <name> <target> <storage-id> <storage-path>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-t, --target <target>", $("the target resource to troubleshoot")).option("-i, --storage-id <storage-id>", $(("the ID for the storage account to save" + "\n the troubleshoot result"))).option("-p, --storage-path <storage-path>", $(("the path to the blob to save the" + "\n troubleshoot result in"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __10(resourceGroup, name, target, storageId, storagePath, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__10", line: 573 }; return __func(_, this, arguments, __10, 6, __frame, function __$__10() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("target : "), target, __cb(_, __frame, 3, 39, function ___(__0, __3) { options.target = __3; return cli.interaction.promptIfNotGiven($("storage id : "), storageId, __cb(_, __frame, 4, 42, function ___(__0, __4) { options.storageId = __4; return cli.interaction.promptIfNotGiven($("storage path : "), storagePath, __cb(_, __frame, 5, 44, function ___(__0, __5) { options.storagePath = __5; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 14, 65, function ___(__0, __6) { networkWatcher = __6; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__10() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__10() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__10() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__10() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.target) { parameters.targetResourceId = options.target; } ; if (options.storageId) { parameters.storageId = options.storageId; } ; if (options.storagePath) { parameters.storagePath = options.storagePath; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get troubleshooting operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return networkManagementClient.networkWatchers.getTroubleshooting(resourceGroup, name, parameters, __cb(_, __frame, 44, 65, function ___(__0, __7) { networkWatcher = __7; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__10() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__10() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }, true)); }, true)); }); }); networkWatchers.command("troubleshoot-result [resource-group] [name] [target]").description($("Perform get troubleshooting result operation on a network watcher")).usage("[options] <resource-group> <name> <target>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-t, --target <target>", $(("the target resource ID to query the" + "\n troubleshooting result"))).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __11(resourceGroup, name, target, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__11", line: 633 }; return __func(_, this, arguments, __11, 4, __frame, function __$__11() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("target : "), target, __cb(_, __frame, 3, 39, function ___(__0, __3) { options.target = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 12, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__11() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__11() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__11() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__11() { if (!networkWatcher) { return _(new Error(util.format($("a network watcher with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup))); } ; parameters = { }; if (options.target) { parameters.targetResourceId = options.target; } ; generatorUtils.removeEmptyObjects(parameters); progress = cli.interaction.progress(util.format($("Performing get troubleshooting result operation on a network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return networkManagementClient.networkWatchers.getTroubleshootingResult(resourceGroup, name, parameters, __cb(_, __frame, 34, 65, function ___(__0, __5) { networkWatcher = __5; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__11() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__11() { cli.interaction.formatOutput(networkWatcher, generatorUtils.traverse); _(); }); }); }); }); }, true)); }, true)); }, true)); }); }); networkWatchers.command("security-group-view [resource-group] [name] [target]").description($("Perform get vm security rules operation on a network watcher")).usage("[options] <resource-group> <name> <target>").option("-g, --resource-group <resource-group>", $("the name of the resource group")).option("-n, --name <name>", $("the name of the network watcher")).option("-t, --target <target>", $("id of the target VM")).option("-s, --subscription <subscription>", $("the subscription identifier")).execute(function __12(resourceGroup, name, target, options, _) { var subscription, networkManagementClient, networkWatcher, progress, parameters; var __frame = { name: "__12", line: 682 }; return __func(_, this, arguments, __12, 4, __frame, function __$__12() { return cli.interaction.promptIfNotGiven($("resource group : "), resourceGroup, __cb(_, __frame, 1, 38, function ___(__0, __1) { resourceGroup = __1; return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 2, 29, function ___(__0, __2) { name = __2; return cli.interaction.promptIfNotGiven($("target : "), target, __cb(_, __frame, 3, 39, function ___(__0, __3) { options.target = __3; subscription = profile.current.getSubscription(options.subscription); networkManagementClient = utils.createNetworkManagementClient(subscription); progress = cli.interaction.progress(util.format($("Looking up the network watcher \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return networkManagementClient.networkWatchers.get(resourceGroup, name, null, __cb(_, __frame, 12, 65, function ___(__0, __4) { networkWatcher = __4; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$__12() { if (e) { if ((e.statusCode === 404)) { networkWatcher = null; } else { return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__12() { _(null, null, true); }); }); }); })(function ___(__e, __r, __co