Skip to content

Commit 1216e38

Browse files
committed
[AppGW] Adding ConfirmAction in RemoveAzureApplicationGatewaySslPolicyCommand
1 parent df9cd9b commit 1216e38

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/ResourceManager/Network/Commands.Network/ApplicationGateway/SslPolicy/RemoveAzureApplicationGatewaySslPolicyCommand.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using Microsoft.Azure.Commands.Network.Models;
16-
using System.Linq;
1717
using System.Management.Automation;
1818

1919
namespace Microsoft.Azure.Commands.Network
@@ -33,6 +33,21 @@ public class RemoveAzureApplicationGatewaySslPolicyCommand : NetworkBaseCmdlet
3333
public SwitchParameter Force { get; set; }
3434

3535
public override void ExecuteCmdlet()
36+
{
37+
if (ApplicationGateway.SslPolicy == null)
38+
{
39+
throw new ArgumentException("Gateway doesn't have SSL policy.");
40+
}
41+
42+
ConfirmAction(
43+
Force.IsPresent,
44+
"Are you sure you want to remove SSL policy",
45+
"Removing SSL Policy..",
46+
ApplicationGateway.SslPolicy.ToString(),
47+
() => RemoveSslPolicy());
48+
}
49+
50+
private void RemoveSslPolicy()
3651
{
3752
base.ExecuteCmdlet();
3853
this.ApplicationGateway.SslPolicy = null;

0 commit comments

Comments
 (0)