UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

104 lines (43 loc) 6.99 kB
/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; var __ = require("underscore"); var util = require("util"); var utils = require("../../../util/utils"); var $ = utils.getLocaleString; var generatorUtils = require("../../../util/generatorUtils"); function PublicIPAddress(cli, networkManagementClient) { this.output = cli.output; this.interaction = cli.interaction; this.networkManagementClient = networkManagementClient;}; __.extend(PublicIPAddress.prototype, { get: function get__1(resourceGroup, name, _) { var self, progress, publicIP, __this = this; var __frame = { name: "get__1", line: 30 }; return __func(_, this, arguments, get__1, 2, __frame, function __$get__1() { self = __this; progress = self.interaction.progress(util.format($("Looking up the public ip \"%s\""), name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$get__1() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$get__1() { return self.networkManagementClient.publicIPAddresses.get(resourceGroup, name, null, __cb(_, __frame, 4, 68, function ___(__0, __1) { publicIP = __1; return _(null, publicIP); }, true)); }); })(function ___(e, __result) { __catch(function __$get__1() { if (e) { if ((e.statusCode === 404)) { return _(null, null); } ; return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$get__1() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$get__1() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$get__1() { _(); }); }); }); }, show: function show__2(resourceGroup, name, options, _) { var self, publicIPAddress, progress, __this = this; var __frame = { name: "show__2", line: 46 }; return __func(_, this, arguments, show__2, 3, __frame, function __$show__2() { self = __this; return (function __$show__2(__then) { if ((((options.vmssName && options.vmIndex) && options.nicName) && options.ipConfigName)) { progress = self.interaction.progress(util.format($("Looking up the public ip address \"%s\" on VMSS \"%s\""), name, options.vmssName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$show__2() { return self.networkManagementClient.publicIPAddresses.getVirtualMachineScaleSetPublicIPAddress(resourceGroup, options.vmssName, options.vmIndex, options.nicName, options.ipConfigName, name, __cb(_, __frame, 7, 73, function ___(__0, __1) { publicIPAddress = __1; _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$show__2() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } else { return self.get(resourceGroup, name, __cb(_, __frame, 12, 29, function ___(__0, __2) { publicIPAddress = __2; if (!publicIPAddress) { self.output.warn(util.format($("public ip address with name \"%s\" not found in the resource group \"%s\""), name, resourceGroup)); } ; __then(); }, true)); } ; })(function __$show__2() { self.interaction.formatOutput(publicIPAddress, generatorUtils.traverse); _(); }); }); }, list: function list__3(resourceGroup, options, _) { var self, progress, publicIPAddresses, __this = this; var __frame = { name: "list__3", line: 67 }; return __func(_, this, arguments, list__3, 2, __frame, function __$list__3() { self = __this; return (function __$list__3(__then) { if ((resourceGroup && options.vmssName)) { progress = self.interaction.progress(util.format($("Looking up public ip addresses on VMSS \"%s\""), options.vmssName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$list__3() { return (function __$list__3(__then) { if (((options.vmIndex && options.nicName) && options.ipConfigName)) { return self.networkManagementClient.publicIPAddresses.listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroup, options.vmssName, options.vmIndex, options.nicName, options.ipConfigName, __cb(_, __frame, 9, 77, function ___(__0, __1) { publicIPAddresses = __1; __then(); }, true)); } else { return self.networkManagementClient.publicIPAddresses.listVirtualMachineScaleSetPublicIPAddresses(resourceGroup, options.vmssName, __cb(_, __frame, 11, 77, function ___(__0, __2) { publicIPAddresses = __2; __then(); }, true)); } ; })(function __$list__3() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$list__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } else { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$list__3() { return (function __$list__3(__then) { if ((typeof self.networkManagementClient.publicIPAddresses.listAll !== "function")) { return self.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 19, 43, function ___(__0, __3) { resourceGroup = __3; __then(); }, true)); } else { __then(); } ; })(function __$list__3() { progress = self.interaction.progress($("Getting public ip addresses")); return (function __$list__3(__then) { if (resourceGroup) { return self.networkManagementClient.publicIPAddresses.list(resourceGroup, __cb(_, __frame, 23, 77, function ___(__0, __4) { publicIPAddresses = __4; __then(); }, true)); } else { return self.networkManagementClient.publicIPAddresses.listAll(__cb(_, __frame, 25, 77, function ___(__0, __5) { publicIPAddresses = __5; __then(); }, true)); } ; })(function __$list__3() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$list__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } ; })(function __$list__3() { self.interaction.formatOutput(publicIPAddresses, generatorUtils.traverse); _(); }); }); }}); module.exports = PublicIPAddress;