Skip to content

Commit 0ce71fc

Browse files
authored
feat(events): add filter rules for prefixEqualsIgnoreCase, suffixEqualsIgnoreCase, 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*
1 parent 8189c82 commit 0ce71fc

File tree

11 files changed

+624
-36
lines changed

11 files changed

+624
-36
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.assets.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.template.json

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,112 @@
148148
},
149149
"State": "ENABLED"
150150
}
151+
},
152+
"MyWildcardRule477FB0F9": {
153+
"Type": "AWS::Events::Rule",
154+
"Properties": {
155+
"EventPattern": {
156+
"account": [
157+
{
158+
"wildcard": "account*"
159+
}
160+
]
161+
},
162+
"State": "ENABLED"
163+
}
164+
},
165+
"MyAnythingButPrefixRule756FC7C6": {
166+
"Type": "AWS::Events::Rule",
167+
"Properties": {
168+
"EventPattern": {
169+
"account": [
170+
{
171+
"anything-but": {
172+
"prefix": "prefix-"
173+
}
174+
}
175+
]
176+
},
177+
"State": "ENABLED"
178+
}
179+
},
180+
"MyAnythingButSuffixRuleB1E496DF": {
181+
"Type": "AWS::Events::Rule",
182+
"Properties": {
183+
"EventPattern": {
184+
"account": [
185+
{
186+
"anything-but": {
187+
"suffix": "-suffix"
188+
}
189+
}
190+
]
191+
},
192+
"State": "ENABLED"
193+
}
194+
},
195+
"MyAnythingButWildcardRuleEED7F44B": {
196+
"Type": "AWS::Events::Rule",
197+
"Properties": {
198+
"EventPattern": {
199+
"account": [
200+
{
201+
"anything-but": {
202+
"wildcard": "account*"
203+
}
204+
}
205+
]
206+
},
207+
"State": "ENABLED"
208+
}
209+
},
210+
"MyAnythingButEqualsIgnoreCaseEBE7F91F": {
211+
"Type": "AWS::Events::Rule",
212+
"Properties": {
213+
"EventPattern": {
214+
"account": [
215+
{
216+
"anything-but": {
217+
"equals-ignore-case": [
218+
"account1",
219+
"account2"
220+
]
221+
}
222+
}
223+
]
224+
},
225+
"State": "ENABLED"
226+
}
227+
},
228+
"MyPrefixEqualsIgnoreCaseC9726B40": {
229+
"Type": "AWS::Events::Rule",
230+
"Properties": {
231+
"EventPattern": {
232+
"account": [
233+
{
234+
"prefix": {
235+
"equals-ignore-case": "prefix-"
236+
}
237+
}
238+
]
239+
},
240+
"State": "ENABLED"
241+
}
242+
},
243+
"MySuffixEqualsIgnoreCaseBE2DDE03": {
244+
"Type": "AWS::Events::Rule",
245+
"Properties": {
246+
"EventPattern": {
247+
"account": [
248+
{
249+
"suffix": {
250+
"equals-ignore-case": "-suffix"
251+
}
252+
}
253+
]
254+
},
255+
"State": "ENABLED"
256+
}
151257
}
152258
},
153259
"Parameters": {

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/cdk.out

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/manifest.json

Lines changed: 48 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)