Match Class
An event pattern matcher.
Example
ts
const rule = new events.Rule(this, 'rule', {
eventPattern: {
detail: {
object: {
// Matchers may appear at any level
size: events.Match.greaterThan(1024),
},
// 'OR' condition
'source-storage-class': events.Match.anyOf(
events.Match.prefix('GLACIER'),
events.Match.exactString('DEEP_ARCHIVE'),
),
},
// If you prefer, you can use a low level array of strings, as directly consumed by EventBridge
source: ['aws.s3'],
region: events.Match.anythingButPrefix('us-gov'),
},
});
Properties
creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*string#The creation stack of this resolvable which will be appended to errors thrown during resolution.
This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.
Methods
allOf(...matchers: any[]): string[]@staticmethod def all_of(matchers: Any) -> typing.List[str]public static List<String> allOf(Object matchers)public static string[] AllOf(object matchers)func AllOf(Matchers interface{}) *[]*stringstatic#Matches an event if any of the provided matchers do.
Only numeric matchers are accepted.
anyOf(...matchers: any[]): string[]@staticmethod def any_of(matchers: Any) -> typing.List[str]public static List<String> anyOf(Object matchers)public static string[] AnyOf(object matchers)func AnyOf(Matchers interface{}) *[]*stringstatic#Matches an event if any of the provided matchers does.
anythingBut(...values: any[]): string[]@staticmethod def anything_but(values: Any) -> typing.List[str]public static List<String> anythingBut(Object values)public static string[] AnythingBut(object values)func AnythingBut(Values interface{}) *[]*stringstatic#Matches anything except what's provided in the rule.
The list of provided values must contain only strings or only numbers.
anythingButEqualsIgnoreCase(...values: string[]): string[]@staticmethod def anything_but_equals_ignore_case(values: str) -> typing.List[str]public static List<String> anythingButEqualsIgnoreCase(String values)public static string[] AnythingButEqualsIgnoreCase(string values)func AnythingButEqualsIgnoreCase(Values *string) *[]*stringstatic#Matches any string that doesn't match with the given value regardless of character casing.
anythingButPrefix(...values: string[]): string[]@staticmethod def anything_but_prefix(values: str) -> typing.List[str]public static List<String> anythingButPrefix(String values)public static string[] AnythingButPrefix(string values)func AnythingButPrefix(Values *string) *[]*stringstatic#Matches any string that doesn't start with the given prefix.
anythingButSuffix(...values: string[]): string[]@staticmethod def anything_but_suffix(values: str) -> typing.List[str]public static List<String> anythingButSuffix(String values)public static string[] AnythingButSuffix(string values)func AnythingButSuffix(Values *string) *[]*stringstatic#Matches any string that doesn't end with the given suffix.
anythingButWildcard(...values: string[]): string[]@staticmethod def anything_but_wildcard(values: str) -> typing.List[str]public static List<String> anythingButWildcard(String values)public static string[] AnythingButWildcard(string values)func AnythingButWildcard(Values *string) *[]*stringstatic#Matches any string that doesn't match with the given wildcard pattern.
asList(): string[]def as_list(self, ) -> typing.List[str]public List<String> asList()public string[] AsList()func AsList() *[]*string#A representation of this matcher as a list of strings.
cidr(range: string): string[]@staticmethod def cidr(range: str) -> typing.List[str]public static List<String> cidr(String range)public static string[] Cidr(string range)func Cidr(Range *string) *[]*stringstatic#Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
doesNotExist(): string[]@staticmethod def does_not_exist() -> typing.List[str]public static List<String> doesNotExist()public static string[] DoesNotExist()func DoesNotExist() *[]*stringstatic#Matches when the field is absent from the JSON of the event.
equal(value: number): string[]@staticmethod def equal(value: int | float) -> typing.List[str]public static List<String> equal(Number value)public static string[] Equal(double value)func Equal(Value *float64) *[]*stringstatic#Matches numbers equal to the provided value.
equalsIgnoreCase(value: string): string[]@staticmethod def equals_ignore_case(value: str) -> typing.List[str]public static List<String> equalsIgnoreCase(String value)public static string[] EqualsIgnoreCase(string value)func EqualsIgnoreCase(Value *string) *[]*stringstatic#Matches a string, regardless of case, in the JSON of the event.
exactString(value: string): string[]@staticmethod def exact_string(value: str) -> typing.List[str]public static List<String> exactString(String value)public static string[] ExactString(string value)func ExactString(Value *string) *[]*stringstatic#Matches a string, exactly, in the JSON of the event.
exists(): string[]@staticmethod def exists() -> typing.List[str]public static List<String> exists()public static string[] Exists()func Exists() *[]*stringstatic#Matches when the field is present in the JSON of the event.
greaterThan(value: number): string[]@staticmethod def greater_than(value: int | float) -> typing.List[str]public static List<String> greaterThan(Number value)public static string[] GreaterThan(double value)func GreaterThan(Value *float64) *[]*stringstatic#Matches numbers greater than the provided value.
greaterThanOrEqual(value: number): string[]@staticmethod def greater_than_or_equal(value: int | float) -> typing.List[str]public static List<String> greaterThanOrEqual(Number value)public static string[] GreaterThanOrEqual(double value)func GreaterThanOrEqual(Value *float64) *[]*stringstatic#Matches numbers greater than, or equal to, the provided value.
interval(lower: number, upper: number): string[]@staticmethod def interval(lower: int | float, upper: int | float) -> typing.List[str]public static List<String> interval(Number lower, Number upper)public static string[] Interval(double lower, double upper)func Interval(Lower *float64, Upper *float64) *[]*stringstatic#Matches numbers inside a closed numeric interval. Equivalent to:.
Match.allOf(Match.greaterThanOrEqual(lower), Match.lessThanOrEqual(upper))
2 parameters
Parameters
lowerlowerlowerlowerLower— Lower bound (inclusive).upperupperupperupperUpper— Upper bound (inclusive).
ipAddressRange(range: string): string[]@staticmethod def ip_address_range(range: str) -> typing.List[str]public static List<String> ipAddressRange(String range)public static string[] IpAddressRange(string range)func IpAddressRange(Range *string) *[]*stringstatic#Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
Alias of cidr().
lessThan(value: number): string[]@staticmethod def less_than(value: int | float) -> typing.List[str]public static List<String> lessThan(Number value)public static string[] LessThan(double value)func LessThan(Value *float64) *[]*stringstatic#Matches numbers less than the provided value.
lessThanOrEqual(value: number): string[]@staticmethod def less_than_or_equal(value: int | float) -> typing.List[str]public static List<String> lessThanOrEqual(Number value)public static string[] LessThanOrEqual(double value)func LessThanOrEqual(Value *float64) *[]*stringstatic#Matches numbers less than, or equal to, the provided value.
nullValue(): string[]@staticmethod def null_value() -> typing.List[str]public static List<String> nullValue()public static string[] NullValue()func NullValue() *[]*stringstatic#Matches a null value in the JSON of the event.
prefix(value: string): string[]@staticmethod def prefix(value: str) -> typing.List[str]public static List<String> prefix(String value)public static string[] Prefix(string value)func Prefix(Value *string) *[]*stringstatic#Matches strings with the given prefix in the JSON of the event.
prefixEqualsIgnoreCase(value: string): string[]@staticmethod def prefix_equals_ignore_case(value: str) -> typing.List[str]public static List<String> prefixEqualsIgnoreCase(String value)public static string[] PrefixEqualsIgnoreCase(string value)func PrefixEqualsIgnoreCase(Value *string) *[]*stringstatic#Matches strings with the given prefix in the JSON of the event regardless of the casing.
resolve(context: IResolveContext): anydef resolve(self, context: IResolveContext) -> Anypublic Object resolve(IResolveContext context)public object Resolve(IResolveContext context)func Resolve(Context IResolveContext) interface{}#Produce the Token's value at resolution time.
suffix(value: string): string[]@staticmethod def suffix(value: str) -> typing.List[str]public static List<String> suffix(String value)public static string[] Suffix(string value)func Suffix(Value *string) *[]*stringstatic#Matches strings with the given suffix in the JSON of the event.
suffixEqualsIgnoreCase(value: string): string[]@staticmethod def suffix_equals_ignore_case(value: str) -> typing.List[str]public static List<String> suffixEqualsIgnoreCase(String value)public static string[] SuffixEqualsIgnoreCase(string value)func SuffixEqualsIgnoreCase(Value *string) *[]*stringstatic#Matches strings with the given suffix in the JSON of the event regardless of the casing.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#Return a string representation of this resolvable object.
Returns a reversible string representation.
wildcard(value: string): string[]@staticmethod def wildcard(value: str) -> typing.List[str]public static List<String> wildcard(String value)public static string[] Wildcard(string value)func Wildcard(Value *string) *[]*stringstatic#Matches strings with the given wildcard pattern in the JSON of the event.