Skip to content

Commit 76c8995

Browse files
tguxiaVeryEarly
andauthored
Add features to Network (Azure#19696)
* draft pr * second commit * added mappings * minor fixes * change psextendedloc * add extendedlocation in ps1xml * changelog * Update ChangeLog.md * regenerate help docs * regenerate help doc * new help doc manual Co-authored-by: Yabo Hu <[email protected]>
1 parent 74cb235 commit 76c8995

File tree

7 files changed

+88
-5
lines changed

7 files changed

+88
-5
lines changed

src/Network/Network/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
--->
2020

2121
## Upcoming Release
22+
* Added possible value `LocalGateway` for parameter `GatewayType`
23+
- `New-AzVirtualNetworkGateway`
24+
* Exposed `ExtendedLocation` and `VNetExtendedLocationResourceId` for `VirtualNetworkGateway`
25+
- `Get-AzVirtualNetworkGateway`
2226
* Added new cmdlet to get firewall learned ip prefixes
2327
* `Get-AzFirewallLearnedIpPrefix`
2428
* Fixed a bug that does not update firewall policy application, network and nat rules' descriptions even though description is provided via description parameter

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ private static void Initialize()
931931
cfg.CreateMap<CNM.PSVpnClientConnectionHealthDetail, MNM.VpnClientConnectionHealthDetail>();
932932
cfg.CreateMap<CNM.PSIpConfigurationBgpPeeringAddress, MNM.IPConfigurationBgpPeeringAddress>();
933933
cfg.CreateMap<CNM.PSVirtualNetworkGatewayNatRule, MNM.VirtualNetworkGatewayNatRule>();
934+
cfg.CreateMap<CNM.PSExtendedLocation, MNM.ExtendedLocation>();
934935
cfg.CreateMap<CNM.PSVirtualNetworkGatewayPolicyGroup, MNM.VirtualNetworkGatewayPolicyGroup>();
935936
cfg.CreateMap<CNM.PSVirtualNetworkGatewayPolicyGroupMember, MNM.VirtualNetworkGatewayPolicyGroupMember>();
936937
cfg.CreateMap<CNM.PSClientConnectionConfiguration, MNM.VngClientConnectionConfiguration>();
@@ -957,6 +958,7 @@ private static void Initialize()
957958
cfg.CreateMap<MNM.VpnClientConnectionHealthDetail, CNM.PSVpnClientConnectionHealthDetail>();
958959
cfg.CreateMap<MNM.IPConfigurationBgpPeeringAddress, CNM.PSIpConfigurationBgpPeeringAddress>();
959960
cfg.CreateMap<MNM.VirtualNetworkGatewayNatRule, CNM.PSVirtualNetworkGatewayNatRule>();
961+
cfg.CreateMap<MNM.ExtendedLocation, CNM.PSExtendedLocation>();
960962
cfg.CreateMap<MNM.VirtualNetworkGatewayPolicyGroup, CNM.PSVirtualNetworkGatewayPolicyGroup>();
961963
cfg.CreateMap<MNM.VirtualNetworkGatewayPolicyGroupMember, CNM.PSVirtualNetworkGatewayPolicyGroupMember>();
962964
cfg.CreateMap<MNM.VngClientConnectionConfiguration, CNM.PSClientConnectionConfiguration>();

src/Network/Network/Models/PSExtendedLocation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
namespace Microsoft.Azure.Commands.Network.Models
1717
{
1818
using Microsoft.Azure.Management.Network.Models;
19+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
1920

20-
public class PSExtendedLocation
21+
public class PSExtendedLocation : PSChildResource
2122
{
2223
public PSExtendedLocation()
2324
{ }
@@ -30,8 +31,7 @@ public PSExtendedLocation(string EdgeZone)
3031
this.Type = extendedLocation.Type;
3132
}
3233

33-
public string Name { get; set; }
34-
34+
[Ps1Xml(Label = "Type", Target = ViewControl.Table)]
3535
public string Type { get; set; }
3636
}
3737
}

src/Network/Network/Models/PSVirtualNetworkGateway.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.Network.Models
1717
using Newtonsoft.Json;
1818
using System.Collections.Generic;
1919
using WindowsAzure.Commands.Common.Attributes;
20+
using Microsoft.Azure.Management.Network.Models;
2021

2122
public class PSVirtualNetworkGateway : PSTopLevelResource
2223
{
@@ -57,6 +58,12 @@ public class PSVirtualNetworkGateway : PSTopLevelResource
5758

5859
public string VpnGatewayGeneration { get; set; }
5960

61+
[Ps1Xml(Target = ViewControl.Table)]
62+
public PSExtendedLocation ExtendedLocation { get; set; }
63+
64+
[Ps1Xml(Target = ViewControl.Table)]
65+
public string VNetExtendedLocationResourceId { get; set; }
66+
6067
public List<PSVirtualNetworkGatewayNatRule> NatRules { get; set; }
6168

6269
[Ps1Xml(Target = ViewControl.Table)]
@@ -68,6 +75,18 @@ public string IpConfigurationsText
6875
get { return JsonConvert.SerializeObject(IpConfigurations, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
6976
}
7077

78+
[JsonIgnore]
79+
public string ExtendedLocationText
80+
{
81+
get { return JsonConvert.SerializeObject(ExtendedLocation, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
82+
}
83+
84+
[JsonIgnore]
85+
public string VNetExtendedLocationResourceIdText
86+
{
87+
get { return JsonConvert.SerializeObject(VNetExtendedLocationResourceId, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
88+
}
89+
7190
[JsonIgnore]
7291
public string GatewayDefaultSiteText
7392
{

src/Network/Network/Network.format.ps1xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,10 @@
980980
<Label>NatRules</Label>
981981
<PropertyName>NatRulesText</PropertyName>
982982
</ListItem>
983+
<ListItem>
984+
<Label>ExtendedLocation</Label>
985+
<PropertyName>ExtendedLocationText</PropertyName>
986+
</ListItem>
983987
<ListItem>
984988
<Label>EnableBgpRouteTranslationForNat</Label>
985989
<PropertyName>EnableBgpRouteTranslationForNat</PropertyName>

src/Network/Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,30 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
6969
[Parameter(
7070
Mandatory = false,
7171
ValueFromPipelineByPropertyName = true,
72-
HelpMessage = "The type of this virtual network gateway: Vpn, ExoressRoute")]
72+
HelpMessage = "The type of this virtual network gateway: Vpn, ExoressRoute, LocalGateway")]
7373
[ValidateSet(
7474
MNM.VirtualNetworkGatewayType.Vpn,
7575
MNM.VirtualNetworkGatewayType.ExpressRoute,
76+
MNM.VirtualNetworkGatewayType.LocalGateway,
7677
IgnoreCase = true)]
7778
public string GatewayType { get; set; }
7879

80+
[Parameter(
81+
Mandatory = false,
82+
ValueFromPipelineByPropertyName = true,
83+
HelpMessage = "The extended location of this virtual network gateway")]
84+
[ValidateSet(
85+
"MicrosoftRRDCLab3",
86+
IgnoreCase = true)]
87+
public string ExtendedLocation { get; set; }
88+
89+
[Parameter(
90+
Mandatory = false,
91+
ValueFromPipelineByPropertyName = true,
92+
HelpMessage = "VNetExtendedLocationResourceId for Virtual network gateway.")]
93+
[ValidateNotNullOrEmpty]
94+
public string VNetExtendedLocationResourceId { get; set; }
95+
7996
[Parameter(
8097
Mandatory = false,
8198
ValueFromPipelineByPropertyName = true,
@@ -376,6 +393,11 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
376393

377394
}
378395
vnetGateway.GatewayType = this.GatewayType;
396+
if(vnetGateway.GatewayType == "LocalGateway")
397+
{
398+
vnetGateway.ExtendedLocation = new PSExtendedLocation(this.ExtendedLocation);
399+
vnetGateway.VNetExtendedLocationResourceId = this.VNetExtendedLocationResourceId;
400+
}
379401
vnetGateway.VpnType = this.VpnType;
380402
vnetGateway.EnableBgp = this.EnableBgp;
381403
vnetGateway.DisableIPsecProtection = this.DisableIPsecProtection;

src/Network/Network/help/New-AzVirtualNetworkGateway.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Creates a Virtual Network Gateway
1616
```
1717
New-AzVirtualNetworkGateway -Name <String> -ResourceGroupName <String> -Location <String>
1818
[-IpConfigurations <PSVirtualNetworkGatewayIpConfiguration[]>] [-GatewayType <String>] [-VpnType <String>]
19+
[-ExtendedLocation <String>] [-VNetExtendedLocationResourceId <String>] [-VpnType <String>]
1920
[-EnableBgp <Boolean>] [-DisableIPsecProtection <Boolean>] [-EnableActiveActiveFeature]
2021
[-EnablePrivateIpAddress] [-GatewaySku <String>] [-GatewayDefaultSite <PSLocalNetworkGateway>]
2122
[-VpnClientAddressPool <String[]>] [-VpnClientProtocol <String[]>] [-VpnAuthenticationType <String[]>]
@@ -380,6 +381,22 @@ Accept pipeline input: False
380381
Accept wildcard characters: False
381382
```
382383
384+
### -ExtendedLocation
385+
The extended location of this virtual network gateway
386+
387+
```yaml
388+
Type: System.String
389+
Parameter Sets: (All)
390+
Aliases:
391+
Accepted values: MicrosoftRRDCLab3
392+
393+
Required: False
394+
Position: Named
395+
Default value: None
396+
Accept pipeline input: True (ByPropertyName)
397+
Accept wildcard characters: False
398+
```
399+
383400
### -Force
384401
Do not ask for confirmation if you want to overwrite a resource
385402
@@ -433,7 +450,7 @@ The type of this virtual network gateway: Vpn, ExpressRoute
433450
Type: System.String
434451
Parameter Sets: (All)
435452
Aliases:
436-
Accepted values: Vpn, ExpressRoute
453+
Accepted values: Vpn, ExpressRoute, LocalGateway
437454

438455
Required: False
439456
Position: Named
@@ -622,6 +639,21 @@ Accept pipeline input: True (ByPropertyName)
622639
Accept wildcard characters: False
623640
```
624641
642+
### -VNetExtendedLocationResourceId
643+
VNetExtendedLocationResourceId for Virtual network gateway.
644+
645+
```yaml
646+
Type: System.String
647+
Parameter Sets: (All)
648+
Aliases:
649+
650+
Required: False
651+
Position: Named
652+
Default value: None
653+
Accept pipeline input: True (ByPropertyName)
654+
Accept wildcard characters: False
655+
```
656+
625657
### -VpnAuthenticationType
626658
The list of P2S VPN client authentication types.
627659

0 commit comments

Comments
 (0)