Class Match
An event pattern matcher.
Implements
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Match : DeputyBase, IResolvable
Syntax (vb)
Public Class Match Inherits DeputyBase Implements IResolvable
Remarks
ExampleMetadata: infused
Examples
var rule = new Rule(this, "rule", new RuleProps {
EventPattern = new EventPattern {
Detail = new Dictionary<string, object> {
{ "object", new Dictionary<string, string[]> {
// Matchers may appear at any level
{ "size", Match.GreaterThan(1024) }
} },
// 'OR' condition
{ "source-storage-class", Match.AnyOf(Match.Prefix("GLACIER"), Match.ExactString("DEEP_ARCHIVE")) }
},
// If you prefer, you can use a low level array of strings, as directly consumed by EventBridge
Source = new [] { "aws.s3" },
Region = Match.AnythingButPrefix("us-gov")
}
});
Synopsis
Properties
| CreationStack | The creation stack of this resolvable which will be appended to errors thrown during resolution. |
Methods
| AllOf(params object[]) | Matches an event if any of the provided matchers do. |
| AnyOf(params object[]) | Matches an event if any of the provided matchers does. |
| AnythingBut(params object[]) | Matches anything except what's provided in the rule. |
| AnythingButEqualsIgnoreCase(params string[]) | Matches any string that doesn't match with the given value regardless of character casing. |
| AnythingButPrefix(params string[]) | Matches any string that doesn't start with the given prefix. |
| AnythingButSuffix(params string[]) | Matches any string that doesn't end with the given suffix. |
| AnythingButWildcard(params string[]) | Matches any string that doesn't match with the given wildcard pattern. |
| AsList() | A representation of this matcher as a list of strings. |
| Cidr(string) | Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format. |
| DoesNotExist() | Matches when the field is absent from the JSON of the event. |
| Equal(double) | Matches numbers equal to the provided value. |
| EqualsIgnoreCase(string) | Matches a string, regardless of case, in the JSON of the event. |
| ExactString(string) | Matches a string, exactly, in the JSON of the event. |
| Exists() | Matches when the field is present in the JSON of the event. |
| GreaterThan(double) | Matches numbers greater than the provided value. |
| GreaterThanOrEqual(double) | Matches numbers greater than, or equal to, the provided value. |
| Interval(double, double) | Matches numbers inside a closed numeric interval. Equivalent to:. |
| IpAddressRange(string) | Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format. |
| LessThan(double) | Matches numbers less than the provided value. |
| LessThanOrEqual(double) | Matches numbers less than, or equal to, the provided value. |
| NullValue() | Matches a null value in the JSON of the event. |
| Prefix(string) | Matches strings with the given prefix in the JSON of the event. |
| PrefixEqualsIgnoreCase(string) | Matches strings with the given prefix in the JSON of the event regardless of the casing. |
| Resolve(IResolveContext) | Produce the Token's value at resolution time. |
| Suffix(string) | Matches strings with the given suffix in the JSON of the event. |
| SuffixEqualsIgnoreCase(string) | Matches strings with the given suffix in the JSON of the event regardless of the casing. |
| ToString() | Return a string representation of this resolvable object. |
| Wildcard(string) | Matches strings with the given wildcard pattern in the JSON of the event. |
Properties
CreationStack
The creation stack of this resolvable which will be appended to errors thrown during resolution.
public virtual string[] CreationStack { get; }
Property Value
string[]
Remarks
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(params object[])
Matches an event if any of the provided matchers do.
public static string[] AllOf(params object[] matchers)
Parameters
- matchers object[]
Returns
string[]
Remarks
Only numeric matchers are accepted.
AnyOf(params object[])
Matches an event if any of the provided matchers does.
public static string[] AnyOf(params object[] matchers)
Parameters
- matchers object[]
Returns
string[]
Remarks
ExampleMetadata: infused
AnythingBut(params object[])
Matches anything except what's provided in the rule.
public static string[] AnythingBut(params object[] values)
Parameters
- values object[]
Returns
string[]
Remarks
The list of provided values must contain only strings or only numbers.
AnythingButEqualsIgnoreCase(params string[])
Matches any string that doesn't match with the given value regardless of character casing.
public static string[] AnythingButEqualsIgnoreCase(params string[] values)
Parameters
- values string[]
Returns
string[]
Remarks
ExampleMetadata: infused
AnythingButPrefix(params string[])
Matches any string that doesn't start with the given prefix.
public static string[] AnythingButPrefix(params string[] values)
Parameters
- values string[]
Returns
string[]
Remarks
ExampleMetadata: infused
AnythingButSuffix(params string[])
Matches any string that doesn't end with the given suffix.
public static string[] AnythingButSuffix(params string[] values)
Parameters
- values string[]
Returns
string[]
Remarks
ExampleMetadata: infused
AnythingButWildcard(params string[])
Matches any string that doesn't match with the given wildcard pattern.
public static string[] AnythingButWildcard(params string[] values)
Parameters
- values string[]
Returns
string[]
Remarks
ExampleMetadata: infused
AsList()
A representation of this matcher as a list of strings.
public virtual string[] AsList()
Returns
string[]
Remarks
ExampleMetadata: infused
Cidr(string)
Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
public static string[] Cidr(string range)
Parameters
- range string
Returns
string[]
Remarks
ExampleMetadata: infused
DoesNotExist()
Matches when the field is absent from the JSON of the event.
public static string[] DoesNotExist()
Returns
string[]
Remarks
ExampleMetadata: infused
Equal(double)
Matches numbers equal to the provided value.
public static string[] Equal(double value)
Parameters
- value double
Returns
string[]
Remarks
ExampleMetadata: infused
EqualsIgnoreCase(string)
Matches a string, regardless of case, in the JSON of the event.
public static string[] EqualsIgnoreCase(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
ExactString(string)
Matches a string, exactly, in the JSON of the event.
public static string[] ExactString(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
Exists()
Matches when the field is present in the JSON of the event.
public static string[] Exists()
Returns
string[]
Remarks
ExampleMetadata: infused
GreaterThan(double)
Matches numbers greater than the provided value.
public static string[] GreaterThan(double value)
Parameters
- value double
Returns
string[]
Remarks
ExampleMetadata: infused
GreaterThanOrEqual(double)
Matches numbers greater than, or equal to, the provided value.
public static string[] GreaterThanOrEqual(double value)
Parameters
- value double
Returns
string[]
Remarks
ExampleMetadata: infused
Interval(double, double)
Matches numbers inside a closed numeric interval. Equivalent to:.
public static string[] Interval(double lower, double upper)
Parameters
Returns
string[]
Remarks
Match.allOf(Match.greaterThanOrEqual(lower), Match.lessThanOrEqual(upper))
IpAddressRange(string)
Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
public static string[] IpAddressRange(string range)
Parameters
- range string
Returns
string[]
Remarks
Alias of cidr().
LessThan(double)
Matches numbers less than the provided value.
public static string[] LessThan(double value)
Parameters
- value double
Returns
string[]
Remarks
ExampleMetadata: infused
LessThanOrEqual(double)
Matches numbers less than, or equal to, the provided value.
public static string[] LessThanOrEqual(double value)
Parameters
- value double
Returns
string[]
Remarks
ExampleMetadata: infused
NullValue()
Matches a null value in the JSON of the event.
public static string[] NullValue()
Returns
string[]
Remarks
ExampleMetadata: infused
Prefix(string)
Matches strings with the given prefix in the JSON of the event.
public static string[] Prefix(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
PrefixEqualsIgnoreCase(string)
Matches strings with the given prefix in the JSON of the event regardless of the casing.
public static string[] PrefixEqualsIgnoreCase(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
Resolve(IResolveContext)
Produce the Token's value at resolution time.
public virtual object Resolve(IResolveContext context)
Parameters
- context IResolveContext
Returns
Remarks
ExampleMetadata: infused
Suffix(string)
Matches strings with the given suffix in the JSON of the event.
public static string[] Suffix(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
SuffixEqualsIgnoreCase(string)
Matches strings with the given suffix in the JSON of the event regardless of the casing.
public static string[] SuffixEqualsIgnoreCase(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused
ToString()
Return a string representation of this resolvable object.
public override string ToString()
Returns
Remarks
Returns a reversible string representation.
Wildcard(string)
Matches strings with the given wildcard pattern in the JSON of the event.
public static string[] Wildcard(string value)
Parameters
- value string
Returns
string[]
Remarks
ExampleMetadata: infused