Skip to content

Commit f6dc535

Browse files
committed
Add EnabledState to CustomRule
1 parent 3bbb1c7 commit f6dc535

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/FrontDoor/FrontDoor/Cmdlets/NewAzureRmFrontDoorWafCustomRuleObject.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public class NewAzureRmFrontDoorWafCustomRuleObject : AzureFrontDoorCmdletBase
5353
public PSMatchCondition[] MatchCondition { get; set; }
5454

5555
/// <summary>
56-
/// Type of Actions. Possible values include: 'Allow', 'Block', 'Log'
56+
/// Type of Actions. Possible values include: 'Allow', 'Block', 'Log', 'Redirect'
5757
/// </summary>
58-
[Parameter(Mandatory = true, HelpMessage = "Type of Actions. Possible values include: 'Allow', 'Block', 'Log'. ")]
58+
[Parameter(Mandatory = true, HelpMessage = "Type of Actions. Possible values include: 'Allow', 'Block', 'Log', 'Redirect'.")]
5959
[PSArgumentCompleter("Allow","Block","Log","Redirect")]
6060
public string Action { get; set; }
6161

@@ -77,6 +77,13 @@ public class NewAzureRmFrontDoorWafCustomRuleObject : AzureFrontDoorCmdletBase
7777
[Parameter(Mandatory = false, HelpMessage = "Rate limit threshold")]
7878
public int? RateLimitThreshold { get; set; }
7979

80+
/// <summary>
81+
/// Enabled State. Possible values include: 'Enabled', 'Disabled'
82+
/// </summary>
83+
[Parameter(Mandatory = false, HelpMessage = "Enabled State. Possible values include: 'Enabled', 'Disabled'.")]
84+
[PSArgumentCompleter("Enabled", "Disabled")]
85+
public string EnabledState { get; set; }
86+
8087
public override void ExecuteCmdlet()
8188
{
8289
var CustomRule = new PSCustomRule
@@ -87,7 +94,8 @@ public override void ExecuteCmdlet()
8794
RuleType = RuleType,
8895
RateLimitDurationInMinutes = !this.IsParameterBound(c => c.RateLimitDurationInMinutes)? 1 : RateLimitDurationInMinutes,
8996
RateLimitThreshold = RateLimitThreshold,
90-
Action = Action
97+
Action = Action,
98+
EnabledState = !this.IsParameterBound(c => c.EnabledState) ? "Enabled" : EnabledState
9199
};
92100
WriteObject(CustomRule);
93101
}

src/FrontDoor/FrontDoor/Helpers/ModelExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ public static PSCustomRule ToPSCustomRule(this SdkCustomRule sdkRule)
334334
Action = sdkRule.Action,
335335
RuleType = sdkRule.RuleType,
336336
Priority = sdkRule.Priority,
337-
MatchConditions = sdkRule.MatchConditions?.Select(x => x.ToPSMatchCondition()).ToList()
337+
MatchConditions = sdkRule.MatchConditions?.Select(x => x.ToPSMatchCondition()).ToList(),
338+
EnabledState = sdkRule.EnabledState
338339
};
339340
}
340341

@@ -448,7 +449,8 @@ public static SdkCustomRule ToSdkCustomRule(this PSCustomRule psRule)
448449
Action = psRule.Action,
449450
MatchConditions = psRule.MatchConditions?.Select(x => x.ToSdkMatchCondition()).ToList(),
450451
Priority = psRule.Priority,
451-
RuleType = psRule.RuleType
452+
RuleType = psRule.RuleType,
453+
EnabledState = psRule.EnabledState
452454
};
453455
}
454456

src/FrontDoor/FrontDoor/Models/PSCustomRule.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ public class PSCustomRule
3131
public int? RateLimitThreshold { get; set; }
3232

3333
public string Name { get; set; }
34+
35+
public string EnabledState { get; set; }
3436
}
3537
}

0 commit comments

Comments
 (0)