Skip to content

Commit 146f190

Browse files
committed
Update PR comments
1 parent 5f99d9d commit 146f190

10 files changed

+17
-27
lines changed

src/Network/Network.Test/Network.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
17-
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.0-preview" />
17+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="24.0.0-preview" />
1818
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
1919
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="25.0.0" />
2020
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />

src/Network/Network.Test/ScenarioTests/NatGatewayTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// <auto-generated>
2-
// Copyright (c) Microsoft and contributors. All rights reserved.
1+
// Copyright (c) Microsoft and contributors. All rights reserved.
32
//
43
// Licensed under the Apache License, Version 2.0 (the "License");
54
// you may not use this file except in compliance with the License.

src/Network/Network.Test/ScenarioTests/NatGatewayTests.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# <auto-generated>
2-
# Copyright (c) Microsoft and contributors. All rights reserved.
1+
# Copyright (c) Microsoft and contributors. All rights reserved.
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
@@ -151,22 +150,25 @@ function Test-NatGatewayWithSubnet
151150
$listNatGateway = Get-AzNatGateway -ResourceGroupName "*" -Name "*";
152151
Assert-NotNull ($listNatGateway | Where-Object { $_.ResourceGroupName -eq $rgname -and $_.Name -eq $rname });
153152

154-
# Create Subnet
153+
# Create Subnet
155154
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24 -NatGateway $vNatGateway
156155
New-AzvirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
157156
$vnet = Get-AzvirtualNetwork -Name $vnetName -ResourceGroupName $rgname
158157

159-
# Get Subnet
160-
$subnet2 = Get-AzvirtualNetwork -Name $vnetName -ResourceGroupName $rgname | Get-AzVirtualNetworkSubnetConfig -Name $subnetName;
158+
# Get Subnet
159+
$subnet2 = Get-AzvirtualNetwork -Name $vnetName -ResourceGroupName $rgname | Get-AzVirtualNetworkSubnetConfig -Name $subnetName;
160+
161+
Assert-AreEqual $vNatGateway @($subnet2.NatGateway.Name)
162+
163+
# Remove Subnet
164+
Remove-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $virtualNetwork
161165

162166
# Remove NatGateway
163167
$job = Remove-AzNatGateway -ResourceGroupName $rgname -Name $rname -PassThru -Force -AsJob;
164168
$job | Wait-Job;
165169
$removeNatGateway = $job | Receive-Job;
166170
Assert-AreEqual $true $removeNatGateway;
167171

168-
Assert-AreEqual $vNatGateway.Name @($subnet2.NatGateway.Name)
169-
170172
# Get NatGateway should fail
171173
Assert-ThrowsContains { Get-AzNatGateway -ResourceGroupName $rgname -Name $rname } "not found";
172174
}

src/Network/Network/NatGateway/GetAzureRMNatGatewayCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public override void Execute()
100100
this.Name = resourceIdentifier.ResourceName;
101101
}
102102

103-
if (!string.IsNullOrEmpty(this.Name))
103+
if (ShouldGetByName(this.ResourceGroupName, this.Name))
104104
{
105105
var vNatGateway = this.NetworkClient.NetworkManagementClient.NatGateways.Get(ResourceGroupName, Name, ExpandResource);
106106
var vNatGatewayModel = NetworkResourceManagerProfile.Mapper.Map<CNM.PSNatGateway>(vNatGateway);
@@ -111,7 +111,7 @@ public override void Execute()
111111
else
112112
{
113113
IPage<NatGateway> vNatGatewayPage;
114-
if(!string.IsNullOrEmpty(this.ResourceGroupName))
114+
if (ShouldGetByName(this.ResourceGroupName, this.Name))
115115
{
116116
vNatGatewayPage = this.NetworkClient.NetworkManagementClient.NatGateways.List(this.ResourceGroupName);
117117
}
@@ -130,7 +130,7 @@ public override void Execute()
130130
vNatGatewayModel.Tag = TagsConversionHelper.CreateTagHashtable(vNatGateway.Tags);
131131
psNatGatewayList.Add(vNatGatewayModel);
132132
}
133-
WriteObject(psNatGatewayList, true);
133+
WriteObject(TopLevelWildcardFilter(ResourceGroupName, Name, psNatGatewayList), true);
134134
}
135135
}
136136
}

src/Network/Network/NatGateway/RemoveAzureRMNatGatewayCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
namespace Microsoft.Azure.Commands.Network
4141
{
42-
[Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NatGateway", SupportsShouldProcess = true), OutputType(typeof(bool))]
42+
[Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NatGateway", SupportsShouldProcess = true, DefaultParameterSetName = "BackendSetByResource"), OutputType(typeof(bool))]
4343
public partial class RemoveAzureRmNatGateway : NetworkBaseCmdlet
4444
{
4545
private const string DeleteByNameParameterSet = "DeleteByNameParameterSet";

src/Network/Network/NatGateway/SetAzureRMNatGatewayCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
namespace Microsoft.Azure.Commands.Network
4343
{
4444

45-
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NatGateway", SupportsShouldProcess = true), OutputType(typeof(PSNatGateway))]
45+
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NatGateway", SupportsShouldProcess = true, DefaultParameterSetName = "SetByNameParameterSet"), OutputType(typeof(PSNatGateway))]
4646
public class SetAzureNatGatewayCommand : NetworkBaseCmdlet
4747
{
4848
private const string SetByNameParameterSet = "SetByNameParameterSet";

src/Network/Network/Network.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="AutoMapper" Version="6.2.2" />
15-
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="24.0.0-preview" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/Network/Network/VirtualNetwork/Subnet/SetAzureVirtualNetworkSubnetConfigCommand.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public override void Execute()
5959
{
6060
this.RouteTableId = this.RouteTable.Id;
6161
}
62-
63-
if (this.NatGateway != null)
64-
{
65-
this.NatGatewayId = this.NatGateway.Id;
66-
}
6762
}
6863

6964
subnet.AddressPrefix = this.AddressPrefix?.ToList();
@@ -80,12 +75,6 @@ public override void Execute()
8075
subnet.RouteTable.Id = this.RouteTableId;
8176
}
8277

83-
if (!string.IsNullOrEmpty(this.NatGatewayId))
84-
{
85-
subnet.NatGateway = new PSNatGateway();
86-
subnet.NatGateway.Id = this.NatGatewayId;
87-
}
88-
8978
if (this.ServiceEndpoint != null)
9079
{
9180
subnet.ServiceEndpoints = new List<PSServiceEndpoint>();
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)