Skip to content

#27065982: ASM powershell for creating gateway connection should not have gatewayConnectionType parameter case sensitive. #3256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,33 @@ public static class GuestAgentType
public const string HotfixGA = "HotfixGA";
}

public static class VirtualNetworkGatewayConnectionType
{
public const string ExpressRoute = "ExpressRoute";
public const string IPsec = "IPsec";
public const string Vnet2Vnet = "Vnet2Vnet";
public const string VPNClient = "VPNClient";
}

/// <summary>
/// Represents the type of a virtual network gateway connection.
/// </summary>
[DataContract(Namespace = Constants.ServiceManagementNS)]
public enum GatewayConnectionType
{
[EnumMember]
ExpressRoute = 0,

[EnumMember]
IPsec = 1,

[EnumMember]
Vnet2Vnet = 2,

[EnumMember]
VPNClient = 3,
}

#endregion

#region Mergable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public class NewAzureVirtualNetworkGatewayConnectionCommand : NetworkCmdletBase
[ValidateNotNullOrEmpty]
public string GatewayConnectionName { get; set; }

[Parameter(Position = 2, Mandatory = true, HelpMessage = "Gateway connection type: Ipsec/Dedicated/VpnClient/Vnet2Vnet")]
[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Gateway connection type.")]
[ValidateNotNullOrEmpty]
[ValidateSet(ServiceManagement.Model.VirtualNetworkGatewayConnectionType.ExpressRoute, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.IPsec, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.Vnet2Vnet, ServiceManagement.Model.VirtualNetworkGatewayConnectionType.VPNClient, IgnoreCase = true)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nilambari this is a breaking change; existing scripts that use this parameter with any value that's not in the ValidateSet will no longer work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commandlet would have never worked with any values other than the listed ones in validateset. It used to fail from server side and show general error message as :- "The specified request content was not valid and could not be deserialized" which adds more confusion to customers. So, I don't think this is any breaking change, it will help customers to understand error sooner and in better way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nilambari thanks for the clarification

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. :)

public string GatewayConnectionType { get; set; }

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

public override void ExecuteCmdlet()
{
WriteObject(Client.CreateVirtualNetworkGatewayConnection(ConnectedEntityId, GatewayConnectionName, GatewayConnectionType, RoutingWeight, SharedKey, Guid.Parse(VirtualNetworkGatewayId), string.IsNullOrEmpty(EnableBgp)?false:bool.Parse(EnableBgp)));
var gatewayConnectionType = (ServiceManagement.Model.GatewayConnectionType)Enum.Parse(typeof(ServiceManagement.Model.GatewayConnectionType), this.GatewayConnectionType, true);
WriteObject(Client.CreateVirtualNetworkGatewayConnection(ConnectedEntityId, GatewayConnectionName, gatewayConnectionType.ToString(), RoutingWeight, SharedKey, Guid.Parse(VirtualNetworkGatewayId), string.IsNullOrEmpty(EnableBgp)?false:bool.Parse(EnableBgp)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

- 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

* Updated New-AzureVirtualNetworkGatewayConnection cmdlet to add validation on acceptable input parameter:GatewayConnectionType values sets and it can be case insensitive:
- GatewayConnectionType : Added validation to accept only set of values:- 'ExpressRoute'/'IPsec'/'Vnet2Vnet'/'VPNClient' and acceptable set of values can be passed in any casing.

* Updating Managed Cache warning message which notifies customer about service deprecation on the following cmdlets :
Get-AzureManagedCache
Get-AzureManagedCacheAccessKey
Expand Down