class Match
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.Match |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#Match |
![]() | software.amazon.awscdk.services.events.Match |
![]() | aws_cdk.aws_events.Match |
![]() | aws-cdk-lib » aws_events » Match |
Implements
IResolvable
An event pattern matcher.
Example
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
Name | Type | Description |
---|---|---|
creation | string[] | The creation stack of this resolvable which will be appended to errors thrown during resolution. |
creationStack
Type:
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
Name | Description |
---|---|
as | A representation of this matcher as a list of strings. |
resolve(context) | Produce the Token's value at resolution time. |
to | Return a string representation of this resolvable object. |
static all | Matches an event if any of the provided matchers do. |
static any | Matches an event if any of the provided matchers does. |
static anything | Matches anything except what's provided in the rule. |
static anything | Matches any string that doesn't match with the given value regardless of character casing. |
static anything | Matches any string that doesn't start with the given prefix. |
static anything | Matches any string that doesn't end with the given suffix. |
static anything | Matches any string that doesn't match with the given wildcard pattern. |
static cidr(range) | Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format. |
static does | Matches when the field is absent from the JSON of the event. |
static equal(value) | Matches numbers equal to the provided value. |
static equals | Matches a string, regardless of case, in the JSON of the event. |
static exact | Matches a string, exactly, in the JSON of the event. |
static exists() | Matches when the field is present in the JSON of the event. |
static greater | Matches numbers greater than the provided value. |
static greater | Matches numbers greater than, or equal to, the provided value. |
static interval(lower, upper) | Matches numbers inside a closed numeric interval. Equivalent to:. |
static ip | Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format. |
static less | Matches numbers less than the provided value. |
static less | Matches numbers less than, or equal to, the provided value. |
static null | Matches a null value in the JSON of the event. |
static prefix(value) | Matches strings with the given prefix in the JSON of the event. |
static prefix | Matches strings with the given prefix in the JSON of the event regardless of the casing. |
static suffix(value) | Matches strings with the given suffix in the JSON of the event. |
static suffix | Matches strings with the given suffix in the JSON of the event regardless of the casing. |
static wildcard(value) | Matches strings with the given wildcard pattern in the JSON of the event. |
asList()
public asList(): string[]
Returns
string[]
A representation of this matcher as a list of strings.
resolve(context)
public resolve(context: IResolveContext): any
Parameters
- context
IResolve
Context
Returns
any
Produce the Token's value at resolution time.
toString()
public toString(): string
Returns
string
Return a string representation of this resolvable object.
Returns a reversible string representation.
static allOf(...matchers)
public static allOf(...matchers: any[]): string[]
Parameters
- matchers
any
Returns
string[]
Matches an event if any of the provided matchers do.
Only numeric matchers are accepted.
static anyOf(...matchers)
public static anyOf(...matchers: any[]): string[]
Parameters
- matchers
any
Returns
string[]
Matches an event if any of the provided matchers does.
static anythingBut(...values)
public static anythingBut(...values: any[]): string[]
Parameters
- values
any
Returns
string[]
Matches anything except what's provided in the rule.
The list of provided values must contain only strings or only numbers.
static anythingButEqualsIgnoreCase(...values)
public static anythingButEqualsIgnoreCase(...values: string[]): string[]
Parameters
- values
string
Returns
string[]
Matches any string that doesn't match with the given value regardless of character casing.
static anythingButPrefix(...values)
public static anythingButPrefix(...values: string[]): string[]
Parameters
- values
string
Returns
string[]
Matches any string that doesn't start with the given prefix.
static anythingButSuffix(...values)
public static anythingButSuffix(...values: string[]): string[]
Parameters
- values
string
Returns
string[]
Matches any string that doesn't end with the given suffix.
static anythingButWildcard(...values)
public static anythingButWildcard(...values: string[]): string[]
Parameters
- values
string
Returns
string[]
Matches any string that doesn't match with the given wildcard pattern.
static cidr(range)
public static cidr(range: string): string[]
Parameters
- range
string
Returns
string[]
Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
static doesNotExist()
public static doesNotExist(): string[]
Returns
string[]
Matches when the field is absent from the JSON of the event.
static equal(value)
public static equal(value: number): string[]
Parameters
- value
number
Returns
string[]
Matches numbers equal to the provided value.
static equalsIgnoreCase(value)
public static equalsIgnoreCase(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches a string, regardless of case, in the JSON of the event.
static exactString(value)
public static exactString(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches a string, exactly, in the JSON of the event.
static exists()
public static exists(): string[]
Returns
string[]
Matches when the field is present in the JSON of the event.
static greaterThan(value)
public static greaterThan(value: number): string[]
Parameters
- value
number
Returns
string[]
Matches numbers greater than the provided value.
static greaterThanOrEqual(value)
public static greaterThanOrEqual(value: number): string[]
Parameters
- value
number
Returns
string[]
Matches numbers greater than, or equal to, the provided value.
static interval(lower, upper)
public static interval(lower: number, upper: number): string[]
Parameters
- lower
number
— Lower bound (inclusive). - upper
number
— Upper bound (inclusive).
Returns
string[]
Matches numbers inside a closed numeric interval. Equivalent to:.
Match.allOf(Match.greaterThanOrEqual(lower), Match.lessThanOrEqual(upper))
static ipAddressRange(range)
public static ipAddressRange(range: string): string[]
Parameters
- range
string
Returns
string[]
Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
Alias of cidr()
.
static lessThan(value)
public static lessThan(value: number): string[]
Parameters
- value
number
Returns
string[]
Matches numbers less than the provided value.
static lessThanOrEqual(value)
public static lessThanOrEqual(value: number): string[]
Parameters
- value
number
Returns
string[]
Matches numbers less than, or equal to, the provided value.
static nullValue()
public static nullValue(): string[]
Returns
string[]
Matches a null value in the JSON of the event.
static prefix(value)
public static prefix(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches strings with the given prefix in the JSON of the event.
static prefixEqualsIgnoreCase(value)
public static prefixEqualsIgnoreCase(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches strings with the given prefix in the JSON of the event regardless of the casing.
static suffix(value)
public static suffix(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches strings with the given suffix in the JSON of the event.
static suffixEqualsIgnoreCase(value)
public static suffixEqualsIgnoreCase(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches strings with the given suffix in the JSON of the event regardless of the casing.
static wildcard(value)
public static wildcard(value: string): string[]
Parameters
- value
string
Returns
string[]
Matches strings with the given wildcard pattern in the JSON of the event.