Skip to content

Commit bddd9d8

Browse files
matyang222Lei Jin
authored andcommitted
name fix
1 parent e0d784a commit bddd9d8

File tree

4 files changed

+43
-26
lines changed

4 files changed

+43
-26
lines changed

src/Network/Network/Generated/LoadBalancer/NewAzureRMLoadBalancerCommand.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public override void Execute()
247247
}
248248
}
249249

250-
List<string> resourceIds = new List<string>();
250+
List<string> resourceIdsRequiringAuthToken = new List<string>();
251251
Dictionary<string, List<string>> auxAuthHeader = null;
252252

253253
// Get aux token for each gateway lb references
@@ -256,15 +256,20 @@ public override void Execute()
256256
if (frontend.GatewayLoadBalancer != null)
257257
{
258258
//Get the aux header for the remote vnet
259-
resourceIds.Add(frontend.GatewayLoadBalancer.Id);
260-
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIds);
261-
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
262-
{
263-
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
264-
}
259+
resourceIdsRequiringAuthToken.Add(frontend.GatewayLoadBalancer.Id);
260+
}
261+
}
262+
263+
if (resourceIdsRequiringAuthToken.Count > 0)
264+
{
265+
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIdsRequiringAuthToken);
266+
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
267+
{
268+
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
265269
}
266270
}
267271

272+
268273
ConfirmAction(
269274
Force.IsPresent,
270275
string.Format(Properties.Resources.OverwritingResource, Name),

src/Network/Network/Generated/LoadBalancer/SetAzureRMLoadBalancerCommand.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,15 @@ public override void Execute()
138138
{
139139
//Get the aux header for the remote vnet
140140
resourceIds.Add(frontend.GatewayLoadBalancer.Id);
141-
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIds);
142-
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
143-
{
144-
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
145-
}
141+
}
142+
}
143+
144+
if (resourceIds.Count > 0)
145+
{
146+
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIds);
147+
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
148+
{
149+
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
146150
}
147151
}
148152

src/Network/Network/NetworkInterface/NewAzureNetworkInterfaceCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private PSNetworkInterface CreateNetworkInterface()
437437
networkInterface.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
438438
}
439439

440-
List<string> resourceIds = new List<string>();
440+
List<string> resourceIdsRequiringAuthToken = new List<string>();
441441
Dictionary<string, List<string>> auxAuthHeader = null;
442442

443443
// Get aux token for each gateway lb references
@@ -446,12 +446,16 @@ private PSNetworkInterface CreateNetworkInterface()
446446
if (ipConfiguration.GatewayLoadBalancer != null)
447447
{
448448
//Get the aux header for the remote vnet
449-
resourceIds.Add(ipConfiguration.GatewayLoadBalancer.Id);
450-
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIds);
451-
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
452-
{
453-
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
454-
}
449+
resourceIdsRequiringAuthToken.Add(ipConfiguration.GatewayLoadBalancer.Id);
450+
}
451+
}
452+
453+
if (resourceIdsRequiringAuthToken.Count > 0)
454+
{
455+
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIdsRequiringAuthToken);
456+
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
457+
{
458+
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
455459
}
456460
}
457461

src/Network/Network/NetworkInterface/SetAzureNetworkInterfaceCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override void Execute()
4444
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
4545
}
4646

47-
List<string> resourceIds = new List<string>();
47+
List<string> resourceIdsRequiringAuthToken = new List<string>();
4848
Dictionary<string, List<string>> auxAuthHeader = null;
4949

5050
foreach (var ipconfig in NetworkInterface.IpConfigurations)
@@ -59,12 +59,16 @@ public override void Execute()
5959
if (ipconfig.GatewayLoadBalancer != null)
6060
{
6161
//Get the aux header for the remote vnet
62-
resourceIds.Add(ipconfig.GatewayLoadBalancer.Id);
63-
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIds);
64-
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
65-
{
66-
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
67-
}
62+
resourceIdsRequiringAuthToken.Add(ipconfig.GatewayLoadBalancer.Id);
63+
}
64+
}
65+
66+
if (resourceIdsRequiringAuthToken.Count > 0)
67+
{
68+
var auxHeaderDictionary = GetAuxilaryAuthHeaderFromResourceIds(resourceIdsRequiringAuthToken);
69+
if (auxHeaderDictionary != null && auxHeaderDictionary.Count > 0)
70+
{
71+
auxAuthHeader = new Dictionary<string, List<string>>(auxHeaderDictionary);
6872
}
6973
}
7074

0 commit comments

Comments
 (0)