-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add exclusions to WAF cmdlets #10507
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
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
39272e1
Upgrade SDK package to latest version
digavino ed54b0d
Fix test cases
digavino 11a0f3a
Adding exclusions to WAF cmdlets
digavino c020a2d
Update help files and readme
digavino 727c9ad
Update help index
digavino e6b46ff
Fix online version
digavino 7840421
Fix signature issues
digavino 537aa83
Rename parameter in help files
digavino c6f3c94
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
digavino 6877bfc
Add exclusion test cases
digavino ea53a89
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
digavino 6830886
Merge
digavino ccc8aa7
Revert change in FrontDoor tests
digavino 83176df
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
digavino bdedad3
Merge branch 'master' of https://github.com/Azure/azure-powershell in…
digavino 80b4b8e
Add SocketAddr
digavino b954569
Merge
digavino a27127d
CR comments
digavino e9943f1
Change changelog
digavino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
254 changes: 127 additions & 127 deletions
254
...oor.Test.ScenarioTests.ScenarioTest.WebApplicationFireWallPolicyTests/TestPolicyCrud.json
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 129 additions & 129 deletions
258
...cenarioTests.ScenarioTest.WebApplicationFireWallPolicyTests/TestPolicyCrudWithPiping.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/FrontDoor/FrontDoor/Cmdlets/NewAzureRmFrontDoorWafManagedRuleExclusionObject.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // Copyright Microsoft Corporation | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // ---------------------------------------------------------------------------------- | ||
|
|
||
| using System.Linq; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.FrontDoor.Common; | ||
| using Microsoft.Azure.Commands.FrontDoor.Models; | ||
| using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; | ||
|
|
||
| namespace Microsoft.Azure.Commands.FrontDoor.Cmdlets | ||
| { | ||
| /// <summary> | ||
| /// Defines the New-AzFrontDoorWafManagedRuleExclusionObject cmdlet. | ||
| /// </summary> | ||
| [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "FrontDoorWafManagedRuleExclusionObject"), OutputType(typeof(PSManagedRuleExclusion))] | ||
| public class NewAzureRmFrontDoorWafManagedRuleExclusionObject : AzureFrontDoorCmdletBase | ||
| { | ||
| /// <summary> | ||
| /// Exclusion match variable | ||
| /// </summary> | ||
| [Parameter(Mandatory = true, HelpMessage = "Match variable")] | ||
| [PSArgumentCompleter("RequestHeaderNames", "RequestCookieNames", "QueryStringArgNames", "RequestBodyPostArgNames")] | ||
| public string Variable { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Exclusion operator, performed on the selector | ||
| /// In the case of EqualsAny, the selector cannot be specified (it will exclude all match variables of the specified type) | ||
| /// </summary> | ||
| [Parameter(Mandatory = true, HelpMessage = "Operator")] | ||
| [PSArgumentCompleter("Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny")] | ||
| public string Operator { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Exclusion selector | ||
| /// </summary> | ||
| [Parameter(Mandatory = false, HelpMessage = "Selector")] | ||
| public string Selector { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| ValidateArguments(); | ||
|
|
||
| var rule = new PSManagedRuleExclusion | ||
| { | ||
| MatchVariable = Variable, | ||
| SelectorMatchOperator = Operator, | ||
| Selector = Selector | ||
| }; | ||
| WriteObject(rule); | ||
| } | ||
|
|
||
| private void ValidateArguments() | ||
| { | ||
| if (Operator == PSExclusionOperatorProperty.EqualsAny.ToString() && Selector != null) | ||
| { | ||
| // Selector is required if the operator is not "EqualsAny". | ||
| throw new PSArgumentException(nameof(Selector)); | ||
digavino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| if (Operator != PSExclusionOperatorProperty.EqualsAny.ToString() && string.IsNullOrEmpty(Selector)) | ||
| { | ||
| // Selector cannot be specified if the operator is "EqualsAny". | ||
| throw new PSArgumentNullException(nameof(Selector)); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.