azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
425 lines (250 loc) • 27.2 kB
JavaScript
/*** 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 NetworkPublicIP = require("./networkPublicIP");
var NetworkVNet = require("./networkVNet");
var NetworkVNetSubnet = require("./networkVNetSubnet");
var $ = utils.getLocaleString;
function NetworkNic(cli, networkResourceProviderClient, resourceGroupName, params) {
this.cli = cli;
this.networkResourceProviderClient = networkResourceProviderClient;
this.resourceGroupName = resourceGroupName;
this.params = params;};
__.extend(NetworkNic.prototype, {
createOrUpdateNICIfRequired: function createOrUpdateNICIfRequired__1(_) { var hasNicIdParam, nicInfo, nicLocation, nicAttachedVMRef, vmResourceInfo, updateInfo, createInfo, __this = this; var __frame = { name: "createOrUpdateNICIfRequired__1", line: 34 }; return __func(_, this, arguments, createOrUpdateNICIfRequired__1, 0, __frame, function __$createOrUpdateNICIfRequired__1() {
hasNicIdParam = !utils.stringIsNullOrEmpty(__this.params.nicId);
if (hasNicIdParam) {
__this.cli.output.info($("Found NIC Id parameter, NIC name if specified will be ignored")); }
else {
if (utils.stringIsNullOrEmpty(__this.params.nicName)) {
return _(new Error($("Either NIC Id or NIC name is required"))); } ; } ;
nicInfo = null; return (function __$createOrUpdateNICIfRequired__1(__then) {
if (hasNicIdParam) {
return __this.getNICInfoById(__this.params.nicId, __cb(_, __frame, 12, 23, function ___(__0, __1) { nicInfo = __1; __then(); }, true)); } else { return (function __$createOrUpdateNICIfRequired__1(__then) {
if (utils.stringIsNullOrEmpty(__this.params.location)) {
return __this.cli.interaction.prompt($("Enter location: "), __cb(_, __frame, 15, 54, function ___(__0, __2) { __this.params.location = __2; __then(); }, true)); } else { __then(); } ; })(function __$createOrUpdateNICIfRequired__1() {
return __this.getNICInfoByName(__this.resourceGroupName, __this.params.nicName, __cb(_, __frame, 18, 23, function ___(__0, __3) { nicInfo = __3; __then(); }, true)); }); } ; })(function __$createOrUpdateNICIfRequired__1() { return (function __$createOrUpdateNICIfRequired__1(__then) {
if (nicInfo.profile) {
__this.cli.output.info(util.format($("Found an existing NIC \"%s\""), nicInfo.nicName));
nicLocation = nicInfo.profile.location;
if (!utils.ignoreCaseAndSpaceEquals(nicLocation, __this.params.location)) {
return _(new Error(util.format($("Existing NIC with name \"%s\" is hosted in a different region \"%s\""), nicInfo.nicName, nicLocation))); } ;
nicAttachedVMRef = nicInfo.profile.virtualMachine;
if ((((nicAttachedVMRef !== undefined)) && ((nicAttachedVMRef.id !== undefined)))) {
vmResourceInfo = utils.parseResourceReferenceUri(nicAttachedVMRef.id);
return _(new Error(util.format($("The nic \"%s\" already attached to a VM \"%s\""), nicInfo.nicName, vmResourceInfo.resourceName))); } ;
return __this._updateNICIfRequired(nicInfo.resourceGroupName, nicInfo.profile, __this.params, false, __cb(_, __frame, 36, 30, function ___(__0, __4) { updateInfo = __4; return (function __$createOrUpdateNICIfRequired__1(__then) {
if (updateInfo.updated) {
return __this.getNICInfoByName(nicInfo.resourceGroupName, nicInfo.nicName, __cb(_, __frame, 38, 25, function ___(__0, __5) { nicInfo = __5; __then(); }, true)); } else { __then(); } ; })(function __$createOrUpdateNICIfRequired__1() {
nicInfo.updated = updateInfo.updated;
nicInfo.vnetInfo = updateInfo.vnetInfo;
nicInfo.publicipInfo = updateInfo.publicipInfo; __then(); }); }, true)); } else {
if (hasNicIdParam) {
return _(new Error(util.format($("An NIC with Id \"%s\" not found"), __this.params.nicId))); } ;
__this.cli.output.info(util.format($("An nic with given name \"%s\" not found, creating a new one"), nicInfo.nicName));
return __this._createNewNIC(nicInfo.resourceGroupName, __this.params, __cb(_, __frame, 50, 30, function ___(__0, __6) { createInfo = __6;
return __this.getNICInfoByName(nicInfo.resourceGroupName, nicInfo.nicName, __cb(_, __frame, 53, 23, function ___(__0, __7) { nicInfo = __7;
nicInfo.createRequestProfile = createInfo.createRequestProfile;
nicInfo.createdNew = true;
nicInfo.vnetInfo = createInfo.vnetInfo;
nicInfo.publicipInfo = createInfo.publicipInfo; __then(); }, true)); }, true)); } ; })(function __$createOrUpdateNICIfRequired__1() {
return _(null, nicInfo); }); }); }); },
getNICInfoById: function getNICInfoById__2(referenceUri, _) { var resourceInfo, __this = this; var __frame = { name: "getNICInfoById__2", line: 98 }; return __func(_, this, arguments, getNICInfoById__2, 1, __frame, function __$getNICInfoById__2() {
resourceInfo = utils.parseResourceReferenceUri(referenceUri);
if (!utils.allParamsAreSet([resourceInfo.subscriptionId,resourceInfo.resourceGroupName,resourceInfo.provider,resourceInfo.parentResource,resourceInfo.resourceName,])) {
return _(new Error(util.format($("\"%s\" is not a valid NIC ID, example: /subscriptions/<subscriptipn-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/networkInterfaces/<nic-name>"), referenceUri))); } ;
return __this.getNICInfoByName(resourceInfo.resourceGroupName, resourceInfo.resourceName, __cb(_, __frame, 6, 18, _, true)); }); },
getNICInfoByName: function getNICInfoByName__3(resourceGroupName, nicName, _) { var nicInfo, nic, __this = this; var __frame = { name: "getNICInfoByName__3", line: 107 }; return __func(_, this, arguments, getNICInfoByName__3, 2, __frame, function __$getNICInfoByName__3() {
nicInfo = {
nicName: nicName,
resourceGroupName: resourceGroupName,
createdNew: false,
updated: false,
createRequestProfile: { },
profile: null,
vnetInfo: null,
publicipInfo: null };
return __this._getNIC(resourceGroupName, nicName, __cb(_, __frame, 12, 21, function ___(__0, __1) { nic = __1;
if (nic) {
nicInfo.profile = nic; } ;
return _(null, nicInfo); }, true)); }); },
getNICByIdExpanded: function getNICByIdExpanded__4(referenceUri, depth, memoize, dependencies, _) { var resourceInfo, expandedNIC, __this = this; var __frame = { name: "getNICByIdExpanded__4", line: 127 }; return __func(_, this, arguments, getNICByIdExpanded__4, 4, __frame, function __$getNICByIdExpanded__4() {
referenceUri = referenceUri.toLowerCase();
if (memoize[referenceUri]) {
return _(null, memoize[referenceUri]); } ;
resourceInfo = utils.parseResourceReferenceUri(referenceUri);
return __this.getNICByNameExpanded(resourceInfo.resourceGroupName, resourceInfo.resourceName, depth, memoize, dependencies, __cb(_, __frame, 7, 29, function ___(__0, __1) { expandedNIC = __1;
return _(null, expandedNIC); }, true)); }); },
getNICByNameExpanded: function getNICByNameExpanded__5(resourceGroupName, nicName, depth, memoize, dependencies, _) { var nic, expandedNIC, __this = this; var __frame = { name: "getNICByNameExpanded__5", line: 138 }; return __func(_, this, arguments, getNICByNameExpanded__5, 5, __frame, function __$getNICByNameExpanded__5() {
return __this._getNIC(resourceGroupName, nicName, __cb(_, __frame, 1, 21, function ___(__0, __1) { nic = __1;
return __this._expandNIC(nic, depth, memoize, dependencies, __cb(_, __frame, 2, 29, function ___(__0, __2) { expandedNIC = __2;
return _(null, expandedNIC); }, true)); }, true)); }); },
_getNIC: function _getNIC__6(resourceGroupName, nicName, _) { var progress, nic, __this = this; var __frame = { name: "_getNIC__6", line: 144 }; return __func(_, this, arguments, _getNIC__6, 2, __frame, function __$_getNIC__6() {
progress = __this.cli.interaction.progress(util.format($("Looking up the NIC \"%s\""), nicName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$_getNIC__6() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$_getNIC__6() {
return __this.networkResourceProviderClient.networkInterfaces.get(resourceGroupName, nicName, __cb(_, __frame, 3, 71, function ___(__0, __1) { nic = __1;
return _(null, nic); }, true)); }); })(function ___(e, __result) { __catch(function __$_getNIC__6() { if (e) {
if ((e.code === "ResourceNotFound")) {
return _(null, null); } ;
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$_getNIC__6() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$_getNIC__6() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$_getNIC__6() { _(); }); }); }); },
_updateNICIfRequired: function _updateNICIfRequired__7(resourceGroupName, networkInterface, params, allowNewIpConfig, _) { var nicUpdateInfo, existingIpConfiguration, nic, ipConfigInfo, networkVNet, subnetId, networkPublicIP, publicipId, partialPublicIdFromParams, __this = this; var __frame = { name: "_updateNICIfRequired__7", line: 159 }; return __func(_, this, arguments, _updateNICIfRequired__7, 4, __frame, function __$_updateNICIfRequired__7() {
nicUpdateInfo = {
updated: false,
vnetInfo: null,
publicipInfo: null };
nic = { networkInterface: networkInterface };
ipConfigInfo = null; return (function __$_updateNICIfRequired__7(__then) {
if (allowNewIpConfig) {
networkVNet = new NetworkVNet(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, __this.params);
if (!networkVNet.hasAnyVNetParameters(params)) {
return _(null, nicUpdateInfo); } ;
__this.cli.output.info($("Found virtual network parameters, assuming user wants to configure NIC with a virtual network"));
return networkVNet.createOrUpdateVNetIfRequired(__cb(_, __frame, 21, 45, function ___(__0, __1) { nicUpdateInfo.vnetInfo = __1;
subnetId = nicUpdateInfo.vnetInfo.subnetInfo.profile.id;
existingIpConfiguration = __this._lookupIPConfiguration(networkInterface.ipConfigurations, subnetId); return (function __$_updateNICIfRequired__7(__then) {
if (existingIpConfiguration) {
__this.cli.output.info(util.format($("Found an IP configuration with virtual network subnet name \"%s\" in the NIC \"%s\""), __this.params.vnetSubnetName, __this.params.nicName)); __then(); } else {
__this.cli.output.info(util.format($("NIC does not contain an ip configuration with virtual network subnet having ID \"%s\"\""), subnetId));
return __this._createNewIPConfigurationTrySetPublicIP(subnetId, __this.params.nicName, __cb(_, __frame, 29, 30, function ___(__0, __2) { ipConfigInfo = __2;
if (!ipConfigInfo.ipConfiguration.publicIPAddress) {
__this.cli.output.info($("public ip parameters is ignored or absent, a new ip configuration with only virtual network subnet will be added to NIC")); }
else {
nicUpdateInfo.publicipInfo = ipConfigInfo.publicipInfo; } ;
networkInterface.ipConfigurations.push(ipConfigInfo.ipConfiguration);
return __this._updateNIC(resourceGroupName, nic, __cb(_, __frame, 37, 15, function __$_updateNICIfRequired__7() {
nicUpdateInfo.updated = true;
return _(null, nicUpdateInfo); }, true)); }, true)); } ; })(__then); }, true)); } else {
existingIpConfiguration = networkInterface.ipConfigurations[0];
__this.cli.output.info(util.format($("Found an IP configuration with virtual network subnet id \"%s\" in the NIC \"%s\""), existingIpConfiguration.subnet.id, networkInterface.name)); __then(); } ; })(function __$_updateNICIfRequired__7() {
networkPublicIP = new NetworkPublicIP(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, __this.params);
if (utils.hasValidProperty(existingIpConfiguration.publicIPAddress, "id")) {
publicipId = existingIpConfiguration.publicIPAddress.id.toLowerCase();
if (utils.stringIsNullOrEmpty(__this.params.publicipName)) {
__this.cli.output.info(util.format($("This NIC IP configuration has a public ip already configured \"%s\", any public ip parameters if provided, will be ignored."), publicipId)); }
else {
partialPublicIdFromParams = networkPublicIP.buildIdFromParams();
if (utils.stringEndsWith(publicipId, partialPublicIdFromParams)) {
__this.cli.output.info(util.format($("This NIC IP configuration is already configured with the provided public ip \"%s\""), __this.params.publicipName)); }
else {
__this.cli.output.info(util.format($("This NIC IP configuration already has a public ip configured \"%s\", using this public ip"), publicipId)); } ; } ;
return _(null, nicUpdateInfo); } ;
if ((!networkPublicIP.hasAnyPubIPParameters(__this.params) && utils.stringIsNullOrEmpty(__this.params.publicIpId))) {
__this.cli.output.info($("This is an NIC without publicIP configured"));
return _(null, nicUpdateInfo); } ;
return __this._createNewIPConfigurationTrySetPublicIP(existingIpConfiguration.subnet.id, networkInterface.name, __cb(_, __frame, 70, 26, function ___(__0, __3) { ipConfigInfo = __3;
if (!ipConfigInfo.ipConfiguration.publicIPAddress) {
__this.cli.output.info($("public ip parameters is ignored or absent, using this NIC with subnet"));
return _(null, nicUpdateInfo); }
else {
__this.cli.output.info(util.format($("Configuring identified NIC IP configuration with PublicIP \"%s\""), ipConfigInfo.publicipInfo.profile.name)); } ;
existingIpConfiguration.publicIPAddress = ipConfigInfo.ipConfiguration.publicIPAddress;
return __this._updateNIC(resourceGroupName, nic, __cb(_, __frame, 79, 11, function __$_updateNICIfRequired__7() {
nicUpdateInfo.publicipInfo = ipConfigInfo.publicipInfo;
nicUpdateInfo.updated = true;
return _(null, nicUpdateInfo); }, true)); }, true)); }); }); },
_createNewIPConfigurationTrySetSubnetPublicIP: function _createNewIPConfigurationTrySetSubnetPublicIP__8(nicName, _) { var vnetInfo, ipConfigInfo, __this = this; var __frame = { name: "_createNewIPConfigurationTrySetSubnetPublicIP__8", line: 244 }; return __func(_, this, arguments, _createNewIPConfigurationTrySetSubnetPublicIP__8, 1, __frame, function __$_createNewIPConfigurationTrySetSubnetPublicIP__8() {
return __this._prepareSubnet(__cb(_, __frame, 1, 26, function ___(__0, __1) { vnetInfo = __1;
return __this._createNewIPConfigurationTrySetPublicIP(vnetInfo.subnetInfo.profile.id, nicName, __cb(_, __frame, 2, 30, function ___(__0, __2) { ipConfigInfo = __2;
ipConfigInfo.vnetInfo = vnetInfo;
return _(null, ipConfigInfo); }, true)); }, true)); }); },
_createNewIPConfigurationTrySetPublicIP: function _createNewIPConfigurationTrySetPublicIP__9(subnetId, nicName, _) { var newipConfiguration, ipConfigInfo, publicipInfo, ipConfigResourceInfo, connectedNicName, __this = this; var __frame = { name: "_createNewIPConfigurationTrySetPublicIP__9", line: 251 }; return __func(_, this, arguments, _createNewIPConfigurationTrySetPublicIP__9, 2, __frame, function __$_createNewIPConfigurationTrySetPublicIP__9() {
newipConfiguration = {
subnet: {
id: subnetId },
name: ("ipconfig" + (new Date()).getTime()) };
ipConfigInfo = {
publicipInfo: null,
ipConfiguration: newipConfiguration };
return __this._preparePublicIP(__cb(_, __frame, 13, 39, function ___(__0, __1) { ipConfigInfo.publicipInfo = __1;
publicipInfo = ipConfigInfo.publicipInfo;
if (publicipInfo) {
newipConfiguration.publicIPAddress = {
id: publicipInfo.profile.id };
if (utils.hasValidProperty(publicipInfo.profile.ipConfiguration, "id")) {
ipConfigResourceInfo = utils.parseResourceReferenceUri(publicipInfo.profile.ipConfiguration.id);
connectedNicName = ipConfigResourceInfo.parentResource.split("/")[1];
if ((utils.ignoreCaseEquals(connectedNicName, nicName) && utils.ignoreCaseEquals(ipConfigResourceInfo.resourceGroupName, __this.resourceGroupName))) {
__this.cli.output.info($("The public ip is already attached to this NIC")); }
else {
__this.cli.output.info(util.format($("The identified PublicIP will not be used since it is attached to a different NIC \"%s\" in the resource group \"%s\""), connectedNicName, ipConfigResourceInfo.resourceGroupName));
newipConfiguration.publicIPAddress = null; } ; } ; } ;
return _(null, ipConfigInfo); }, true)); }); },
_preparePublicIP: function _preparePublicIP__10(_) { var publicipInfo, networkPublicIP, anyPublicIpParams, __this = this; var __frame = { name: "_preparePublicIP__10", line: 287 }; return __func(_, this, arguments, _preparePublicIP__10, 0, __frame, function __$_preparePublicIP__10() {
publicipInfo = null;
networkPublicIP = new NetworkPublicIP(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, __this.params);
anyPublicIpParams = networkPublicIP.hasAnyPubIPParameters(__this.params); return (function __$_preparePublicIP__10(__then) {
if (__this.params.publicIpId) {
__this.cli.output.warn($("found publicIpId parameter, any other public-ip-* parameters will be ignored"));
return networkPublicIP.getPublicIPInfoById(__this.params.publicIpId, __cb(_, __frame, 6, 39, function ___(__0, __1) { publicipInfo = __1;
if (!publicipInfo.profile) {
return _(new Error(util.format($("a PublicIP with id \"%s\" not found"), __this.params.publicIpId))); } ; __then(); }, true)); } else { return (function __$_preparePublicIP__10(__then) {
if (anyPublicIpParams) {
__this.cli.output.info($("Found public ip parameters, trying to setup PublicIP profile"));
return networkPublicIP.createPublicIPIfRequired(__cb(_, __frame, 13, 41, function ___(__0, __2) { publicipInfo = __2; __then(); }, true)); } else { __then(); } ; })(__then); } ; })(function __$_preparePublicIP__10() {
return _(null, publicipInfo); }); }); },
_prepareSubnet: function _prepareSubnet__11(_) { var vnetInfo, networkVNetSubnet, subnetInfo, networkVNet, __this = this; var __frame = { name: "_prepareSubnet__11", line: 307 }; return __func(_, this, arguments, _prepareSubnet__11, 0, __frame, function __$_prepareSubnet__11() {
vnetInfo = null; return (function __$_prepareSubnet__11(__then) {
if (__this.params.subnetId) {
__this.cli.output.warn($("found subnetId parameter, any vnet parameters if specified will be ignored"));
networkVNetSubnet = new NetworkVNetSubnet(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, __this.params);
return networkVNetSubnet.getSubnetInfoById(__this.params.subnetId, __cb(_, __frame, 5, 43, function ___(__0, __1) { subnetInfo = __1;
if (!subnetInfo.profile) {
return _(new Error(util.format($("a virtual network subnet with id \"%s\" not found"), __this.params.subnetId))); } ;
vnetInfo = {
subnetInfo: subnetInfo }; __then(); }, true)); } else {
networkVNet = new NetworkVNet(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, __this.params);
return networkVNet.createOrUpdateVNetIfRequired(__cb(_, __frame, 15, 31, function ___(__0, __2) { vnetInfo = __2; __then(); }, true)); } ; })(function __$_prepareSubnet__11() {
return _(null, vnetInfo); }); }); },
_lookupIPConfiguration: function(ipConfigurations, subnetId) {
var foundIpConfiguration;
if (((ipConfigurations !== null) && (ipConfigurations.length > 0))) {
for (var i = 0; (i < ipConfigurations.length); i++) {
if (ipConfigurations[i].subnet) {
if ((ipConfigurations[i].subnet.id === subnetId)) {
foundIpConfiguration = ipConfigurations[i];
break; } ; } ; }; } ;
return (foundIpConfiguration ? foundIpConfiguration : null); },
_updateNIC: function _updateNIC__12(resourceGroupName, nic, _) { var progress, __this = this; var __frame = { name: "_updateNIC__12", line: 346 }; return __func(_, this, arguments, _updateNIC__12, 2, __frame, function __$_updateNIC__12() {
progress = __this.cli.interaction.progress(util.format($("Updating NIC \"%s\""), nic.networkInterface.name)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$_updateNIC__12() {
return __this.networkResourceProviderClient.networkInterfaces.createOrUpdate(resourceGroupName, nic.networkInterface.name, nic.networkInterface, __cb(_, __frame, 3, 61, function __$_updateNIC__12() { _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$_updateNIC__12() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$_updateNIC__12() { _(); }); }); }); },
_createNewNIC: function _createNewNIC__13(resourceGroupName, params, _) { var createRequestProfile, ipConfigInfo, progress, __this = this; var __frame = { name: "_createNewNIC__13", line: 355 }; return __func(_, this, arguments, _createNewNIC__13, 2, __frame, function __$_createNewNIC__13() {
createRequestProfile = {
ipConfigurations: [],
location: params.location,
name: params.nicName };
return __this._createNewIPConfigurationTrySetSubnetPublicIP(params.nicName, __cb(_, __frame, 7, 30, function ___(__0, __1) { ipConfigInfo = __1;
if (!ipConfigInfo.ipConfiguration.publicIPAddress) {
__this.cli.output.info($("No public ip parameters found, the ip configuration of new NIC will have only subnet configured")); } ;
createRequestProfile.ipConfigurations.push(ipConfigInfo.ipConfiguration);
progress = __this.cli.interaction.progress(util.format($("Creating NIC \"%s\""), params.nicName)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$_createNewNIC__13() {
return __this.networkResourceProviderClient.networkInterfaces.createOrUpdate(resourceGroupName, params.nicName, createRequestProfile, __cb(_, __frame, 15, 61, function __$_createNewNIC__13() { _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$_createNewNIC__13() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$_createNewNIC__13() {
return _(null, {
createRequestProfile: createRequestProfile,
vnetInfo: ipConfigInfo.vnetInfo,
publicipInfo: ipConfigInfo.publicipInfo }); }); }); }, true)); }); },
_expandNIC: function _expandNIC__14(nic, depth, memoize, dependencies, _) { var networkInterface, referenceUri, ipConfigurations, networkVNetSubnet, networkPublicIP, i, ipConfiguration, subnetReferenceId, publicIpReferenceId, __this = this; var __frame = { name: "_expandNIC__14", line: 382 }; return __func(_, this, arguments, _expandNIC__14, 4, __frame, function __$_expandNIC__14() {
if (((depth === 0) || (nic === null))) {
return _(null, nic); } ;
if ((depth !== -1)) {
depth--; } ;
networkInterface = nic;
referenceUri = networkInterface.id.toLowerCase();
memoize[referenceUri] = nic;
ipConfigurations = networkInterface.ipConfigurations; return (function __$_expandNIC__14(__then) {
if ((ipConfigurations instanceof Array)) {
networkVNetSubnet = new NetworkVNetSubnet(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, { });
networkPublicIP = new NetworkPublicIP(__this.cli, __this.networkResourceProviderClient, __this.resourceGroupName, { });
i = 0; var __4 = false; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$_expandNIC__14() { __more = false; if (__4) { i++; } else { __4 = true; } ; var __3 = (i < ipConfigurations.length); if (__3) {
ipConfiguration = ipConfigurations[i]; return (function __$_expandNIC__14(__then) {
if (utils.hasValidProperty(ipConfiguration, "subnet")) {
subnetReferenceId = ipConfiguration.subnet.id.toLowerCase(); return (function __$_expandNIC__14(__then) {
if (!memoize[subnetReferenceId]) {
return networkVNetSubnet.getSubnetByIdExpanded(subnetReferenceId, depth, memoize, dependencies, __cb(_, __frame, 24, 66, function ___(__0, __1) { ipConfiguration.subnet.expanded = __1; __then(); }, true)); } else { __then(); } ; })(__then); } else { __then(); } ; })(function __$_expandNIC__14() { return (function __$_expandNIC__14(__then) {
if (utils.hasValidProperty(ipConfiguration, "publicIPAddress")) {
publicIpReferenceId = ipConfiguration.publicIPAddress.id.toLowerCase(); return (function __$_expandNIC__14(__then) {
if (!memoize[publicIpReferenceId]) {
return networkPublicIP.getPublicIPByIdExpanded(publicIpReferenceId, depth, memoize, dependencies, __cb(_, __frame, 31, 73, function ___(__0, __2) { ipConfiguration.publicIPAddress.expanded = __2; __then(); }, true)); } else { __then(); } ; })(__then); } else { __then(); } ; })(function __$_expandNIC__14() { while (__more) { __loop(); }; __more = true; }); }); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(__then); } else { __then(); } ; })(function __$_expandNIC__14() {
return _(null, memoize[referenceUri]); }); }); }});
module.exports = NetworkNic;