Skip to content

Commit cc6bf29

Browse files
unknownunknown
authored andcommitted
Network PS commandlets fixes:- Get-AzureVNetGatewayIPsecParameters & Set-AzureVirtualNetworkGatewayConnection
1 parent dbd70e5 commit cc6bf29

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/ResourceManager/Network/Commands.Network/Models/PSVirtualNetworkGatewayConnection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ public class PSVirtualNetworkGatewayConnection : PSTopLevelResource
3535
[JsonIgnore]
3636
public string VirtualNetworkGateway1Text
3737
{
38-
get { return JsonConvert.SerializeObject(VirtualNetworkGateway1, Formatting.Indented); }
38+
get { return JsonConvert.SerializeObject(VirtualNetworkGateway1.Id, Formatting.Indented); }
3939
}
4040

4141
[JsonIgnore]
4242
public string VirtualNetworkGateway2Text
4343
{
44-
get { return JsonConvert.SerializeObject(VirtualNetworkGateway2, Formatting.Indented); }
44+
get { return JsonConvert.SerializeObject(VirtualNetworkGateway2.Id, Formatting.Indented); }
4545
}
4646

4747
[JsonIgnore]
4848
public string LocalNetworkGateway2Text
4949
{
50-
get { return JsonConvert.SerializeObject(LocalNetworkGateway2, Formatting.Indented); }
50+
get { return JsonConvert.SerializeObject(LocalNetworkGateway2.Id, Formatting.Indented); }
5151
}
5252
}
5353
}

src/ResourceManager/Network/Commands.Network/VirtualNetworkGatewayConnection/UpdateAzureVirtualNetworkGatewayConnectionCommand.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public class SetAzureVirtualNetworkGatewayConnectionCommand : VirtualNetworkGate
3333
HelpMessage = "The VirtualNetworkGatewayConnection")]
3434
public PSVirtualNetworkGatewayConnection VirtualNetworkGatewayConnection { get; set; }
3535

36+
[Parameter(
37+
Mandatory = true,
38+
ValueFromPipeline = true,
39+
HelpMessage = "The location")]
40+
public string Location { get; set; }
41+
3642
[Parameter(
3743
Mandatory = false,
3844
HelpMessage = "Do not ask for confirmation if you want to overrite a resource")]
@@ -47,6 +53,20 @@ public override void ExecuteCmdlet()
4753
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
4854
}
4955

56+
this.VirtualNetworkGatewayConnection.Location = Location;
57+
if (this.VirtualNetworkGatewayConnection.VirtualNetworkGateway1 != null)
58+
{
59+
this.VirtualNetworkGatewayConnection.VirtualNetworkGateway1.Location = Location;
60+
}
61+
if (this.VirtualNetworkGatewayConnection.VirtualNetworkGateway2 != null)
62+
{
63+
this.VirtualNetworkGatewayConnection.VirtualNetworkGateway2.Location = Location;
64+
}
65+
if (this.VirtualNetworkGatewayConnection.LocalNetworkGateway2 != null)
66+
{
67+
this.VirtualNetworkGatewayConnection.LocalNetworkGateway2.Location = Location;
68+
}
69+
5070
// Map to the sdk object
5171
var vnetGatewayConnectionModel = Mapper.Map<MNM.VirtualNetworkGatewayConnection>(this.VirtualNetworkGatewayConnection);
5272
vnetGatewayConnectionModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayConnectionType;

src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVNetGatewayIPsecParameters.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway
2222
public class GetAzureVNetGatewayIPsecParameters : NetworkCmdletBase
2323
{
2424
[Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network name.")]
25-
[ValidateGuid]
2625
[ValidateNotNullOrEmpty]
2726
public string VNetName
2827
{
2928
get; set;
3029
}
3130

3231
[Parameter(Position = 1, Mandatory = true, HelpMessage = "The local network site name.")]
33-
[ValidateGuid]
3432
[ValidateNotNullOrEmpty]
3533
public string LocalNetworkSiteName
3634
{

0 commit comments

Comments
 (0)