Skip to content

Commit e6ced83

Browse files
authored
Merge pull request Azure#3256 from Nilambari/dev1
#27065982: ASM powershell for creating gateway connection should not have gatewayConnectionType parameter case sensitive.
2 parents 5209d24 + 637122f commit e6ced83

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/ServiceManagement/Common/Commands.ServiceManagement.Common/ServiceManagementTypes.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,33 @@ public static class GuestAgentType
129129
public const string HotfixGA = "HotfixGA";
130130
}
131131

132+
public static class VirtualNetworkGatewayConnectionType
133+
{
134+
public const string ExpressRoute = "ExpressRoute";
135+
public const string IPsec = "IPsec";
136+
public const string Vnet2Vnet = "Vnet2Vnet";
137+
public const string VPNClient = "VPNClient";
138+
}
139+
140+
/// <summary>
141+
/// Represents the type of a virtual network gateway connection.
142+
/// </summary>
143+
[DataContract(Namespace = Constants.ServiceManagementNS)]
144+
public enum GatewayConnectionType
145+
{
146+
[EnumMember]
147+
ExpressRoute = 0,
148+
149+
[EnumMember]
150+
IPsec = 1,
151+
152+
[EnumMember]
153+
Vnet2Vnet = 2,
154+
155+
[EnumMember]
156+
VPNClient = 3,
157+
}
158+
132159
#endregion
133160

134161
#region Mergable

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public class NewAzureVirtualNetworkGatewayConnectionCommand : NetworkCmdletBase
3232
[ValidateNotNullOrEmpty]
3333
public string GatewayConnectionName { get; set; }
3434

35-
[Parameter(Position = 2, Mandatory = true, HelpMessage = "Gateway connection type: Ipsec/Dedicated/VpnClient/Vnet2Vnet")]
35+
[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Gateway connection type.")]
3636
[ValidateNotNullOrEmpty]
37+
[ValidateSet(ServiceManagement.Model.VirtualNetworkGatewayConnectionType.ExpressRoute, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.IPsec, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.Vnet2Vnet, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.VPNClient, IgnoreCase = true)]
3738
public string GatewayConnectionType { get; set; }
3839

3940
[Parameter(Position = 3, Mandatory = false, HelpMessage = "The Routing Weight.")]
@@ -52,7 +53,8 @@ public class NewAzureVirtualNetworkGatewayConnectionCommand : NetworkCmdletBase
5253

5354
public override void ExecuteCmdlet()
5455
{
55-
WriteObject(Client.CreateVirtualNetworkGatewayConnection(ConnectedEntityId, GatewayConnectionName, GatewayConnectionType, RoutingWeight, SharedKey, Guid.Parse(VirtualNetworkGatewayId), string.IsNullOrEmpty(EnableBgp)?false:bool.Parse(EnableBgp)));
56+
var gatewayConnectionType = (ServiceManagement.Model.GatewayConnectionType)Enum.Parse(typeof(ServiceManagement.Model.GatewayConnectionType), this.GatewayConnectionType, true);
57+
WriteObject(Client.CreateVirtualNetworkGatewayConnection(ConnectedEntityId, GatewayConnectionName, gatewayConnectionType.ToString(), RoutingWeight, SharedKey, Guid.Parse(VirtualNetworkGatewayId), string.IsNullOrEmpty(EnableBgp)?false:bool.Parse(EnableBgp)));
5658
}
5759
}
5860
}

src/ServiceManagement/Services/Commands.Utilities/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
- ChefServiceInterval : Specifies the frequency (in minutes) at which the chef-service runs. If in case you don't want the chef-service to be installed on the Azure VM then set value as 0 in this field. e.g. -ChefServiceInterval 45
2525

26+
* Updated New-AzureVirtualNetworkGatewayConnection cmdlet to add validation on acceptable input parameter:GatewayConnectionType values sets and it can be case insensitive:
27+
- GatewayConnectionType : Added validation to accept only set of values:- 'ExpressRoute'/'IPsec'/'Vnet2Vnet'/'VPNClient' and acceptable set of values can be passed in any casing.
28+
2629
* Updating Managed Cache warning message which notifies customer about service deprecation on the following cmdlets :
2730
Get-AzureManagedCache
2831
Get-AzureManagedCacheAccessKey

0 commit comments

Comments
 (0)