Skip to content

Commit

Permalink
feat(events): add filter rules for prefixEqualsIgnoreCase, suffixEqua…
Browse files Browse the repository at this point in the history
…lsIgnoreCase, wildcard, and anythingBut* matches (#32063)

### Issue # (if applicable)

Closes #28462.

### Reason for this change

Add support for:
* Prefix matching while ignoring case
* Suffix matching while ignoring case
* Wildcard matching
* Anything-but matching on suffixes
* Anything-but matching using wildcards
* Anything-but matching while ignoring case

Extend anything-but matching on prefixes to support a list of prefix values.

### Description of changes

Added functions on `Match` class:
* `prefixEqualsIgnoreCase()`
* `suffixEqualsIgnoreCase()`
* `wildcard()`
* `anythingButSuffix()`
* `anythingButWildcard()`
* `anythingButEqualsIgnoreCase()`

Modified `anythingButPrefix()` to support rest parameters.

### Description of how you validated changes

Added unit and integration tests for new and changed functions.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
jaw111 authored Dec 5, 2024
1 parent 8189c82 commit 0ce71fc
Show file tree
Hide file tree
Showing 11 changed files with 624 additions and 36 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,112 @@
},
"State": "ENABLED"
}
},
"MyWildcardRule477FB0F9": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"wildcard": "account*"
}
]
},
"State": "ENABLED"
}
},
"MyAnythingButPrefixRule756FC7C6": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"anything-but": {
"prefix": "prefix-"
}
}
]
},
"State": "ENABLED"
}
},
"MyAnythingButSuffixRuleB1E496DF": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"anything-but": {
"suffix": "-suffix"
}
}
]
},
"State": "ENABLED"
}
},
"MyAnythingButWildcardRuleEED7F44B": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"anything-but": {
"wildcard": "account*"
}
}
]
},
"State": "ENABLED"
}
},
"MyAnythingButEqualsIgnoreCaseEBE7F91F": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"anything-but": {
"equals-ignore-case": [
"account1",
"account2"
]
}
}
]
},
"State": "ENABLED"
}
},
"MyPrefixEqualsIgnoreCaseC9726B40": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"prefix": {
"equals-ignore-case": "prefix-"
}
}
]
},
"State": "ENABLED"
}
},
"MySuffixEqualsIgnoreCaseBE2DDE03": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventPattern": {
"account": [
{
"suffix": {
"equals-ignore-case": "-suffix"
}
}
]
},
"State": "ENABLED"
}
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0ce71fc

Please sign in to comment.