Class Match
An event pattern matcher.
Inheritance
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")) }
},
DetailType = Match.EqualsIgnoreCase("object created"),
// 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
Constructors
Match(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Match(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
CreationStack | The creation stack of this resolvable which will be appended to errors thrown during resolution. |
Methods
AllOf(Object[]) | Matches an event if any of the provided matchers do. |
AnyOf(Object[]) | Matches an event if any of the provided matchers does. |
AnythingBut(Object[]) | Matches anything except what's provided in the rule. |
AnythingButPrefix(String) | Matches any string that doesn't start with the given prefix. |
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. |
Resolve(IResolveContext) | Produce the Token's value at resolution time. |
Suffix(String) | Matches strings with the given suffix in the JSON of the event. |
ToString() | Return a string representation of this resolvable object. |
Constructors
Match(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Match(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Match(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Match(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
CreationStack
The creation stack of this resolvable which will be appended to errors thrown during resolution.
public virtual string[] CreationStack { get; }
Property Value
System.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(Object[])
Matches an event if any of the provided matchers do.
public static string[] AllOf(params object[] matchers)
Parameters
- matchers System.Object[]
Returns
System.String[]
Remarks
Only numeric matchers are accepted.
AnyOf(Object[])
Matches an event if any of the provided matchers does.
public static string[] AnyOf(params object[] matchers)
Parameters
- matchers System.Object[]
Returns
System.String[]
AnythingBut(Object[])
Matches anything except what's provided in the rule.
public static string[] AnythingBut(params object[] values)
Parameters
- values System.Object[]
Returns
System.String[]
Remarks
The list of provided values must contain only strings or only numbers.
AnythingButPrefix(String)
Matches any string that doesn't start with the given prefix.
public static string[] AnythingButPrefix(string prefix)
Parameters
- prefix System.String
Returns
System.String[]
AsList()
A representation of this matcher as a list of strings.
public virtual string[] AsList()
Returns
System.String[]
Cidr(String)
Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.
public static string[] Cidr(string range)
Parameters
- range System.String
Returns
System.String[]
DoesNotExist()
Matches when the field is absent from the JSON of the event.
public static string[] DoesNotExist()
Returns
System.String[]
Equal(Double)
Matches numbers equal to the provided value.
public static string[] Equal(double value)
Parameters
- value System.Double
Returns
System.String[]
EqualsIgnoreCase(String)
Matches a string, regardless of case, in the JSON of the event.
public static string[] EqualsIgnoreCase(string value)
Parameters
- value System.String
Returns
System.String[]
ExactString(String)
Matches a string, exactly, in the JSON of the event.
public static string[] ExactString(string value)
Parameters
- value System.String
Returns
System.String[]
Exists()
Matches when the field is present in the JSON of the event.
public static string[] Exists()
Returns
System.String[]
GreaterThan(Double)
Matches numbers greater than the provided value.
public static string[] GreaterThan(double value)
Parameters
- value System.Double
Returns
System.String[]
GreaterThanOrEqual(Double)
Matches numbers greater than, or equal to, the provided value.
public static string[] GreaterThanOrEqual(double value)
Parameters
- value System.Double
Returns
System.String[]
Interval(Double, Double)
Matches numbers inside a closed numeric interval. Equivalent to:.
public static string[] Interval(double lower, double upper)
Parameters
- lower System.Double
Lower bound (inclusive).
- upper System.Double
Upper bound (inclusive).
Returns
System.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 System.String
Returns
System.String[]
Remarks
Alias of cidr()
.
LessThan(Double)
Matches numbers less than the provided value.
public static string[] LessThan(double value)
Parameters
- value System.Double
Returns
System.String[]
LessThanOrEqual(Double)
Matches numbers less than, or equal to, the provided value.
public static string[] LessThanOrEqual(double value)
Parameters
- value System.Double
Returns
System.String[]
NullValue()
Matches a null value in the JSON of the event.
public static string[] NullValue()
Returns
System.String[]
Prefix(String)
Matches strings with the given prefix in the JSON of the event.
public static string[] Prefix(string value)
Parameters
- value System.String
Returns
System.String[]
Resolve(IResolveContext)
Produce the Token's value at resolution time.
public virtual object Resolve(IResolveContext context)
Parameters
- context IResolveContext
Returns
System.Object
Suffix(String)
Matches strings with the given suffix in the JSON of the event.
public static string[] Suffix(string value)
Parameters
- value System.String
Returns
System.String[]
ToString()
Return a string representation of this resolvable object.
public override string ToString()
Returns
System.String
Remarks
Returns a reversible string representation.