java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.events.Match
All Implemented Interfaces:
IResolvable, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:15.625Z") @Stability(Stable) public class Match extends software.amazon.jsii.JsiiObject implements IResolvable
An event pattern matcher.

Example:

 Rule rule = Rule.Builder.create(this, "rule")
         .eventPattern(EventPattern.builder()
                 .detail(Map.of(
                         "object", Map.of(
                                 // 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(List.of("aws.s3"))
                 .region(Match.anythingButPrefix("us-gov"))
                 .build())
         .build();
 
  • Constructor Details

    • Match

      protected Match(software.amazon.jsii.JsiiObjectRef objRef)
    • Match

      protected Match(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • allOf

      @Stability(Stable) @NotNull public static List<String> allOf(@NotNull @NotNull Object... matchers)
      Matches an event if any of the provided matchers do.

      Only numeric matchers are accepted.

      Parameters:
      matchers - This parameter is required.
    • anyOf

      @Stability(Stable) @NotNull public static List<String> anyOf(@NotNull @NotNull Object... matchers)
      Matches an event if any of the provided matchers does.

      Parameters:
      matchers - This parameter is required.
    • anythingBut

      @Stability(Stable) @NotNull public static List<String> anythingBut(@NotNull @NotNull Object... values)
      Matches anything except what's provided in the rule.

      The list of provided values must contain only strings or only numbers.

      Parameters:
      values - This parameter is required.
    • anythingButPrefix

      @Stability(Stable) @NotNull public static List<String> anythingButPrefix(@NotNull String prefix)
      Matches any string that doesn't start with the given prefix.

      Parameters:
      prefix - This parameter is required.
    • cidr

      @Stability(Stable) @NotNull public static List<String> cidr(@NotNull String range)
      Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.

      Parameters:
      range - This parameter is required.
    • doesNotExist

      @Stability(Stable) @NotNull public static List<String> doesNotExist()
      Matches when the field is absent from the JSON of the event.
    • equal

      @Stability(Stable) @NotNull public static List<String> equal(@NotNull Number value)
      Matches numbers equal to the provided value.

      Parameters:
      value - This parameter is required.
    • equalsIgnoreCase

      @Stability(Stable) @NotNull public static List<String> equalsIgnoreCase(@NotNull String value)
      Matches a string, regardless of case, in the JSON of the event.

      Parameters:
      value - This parameter is required.
    • exactString

      @Stability(Stable) @NotNull public static List<String> exactString(@NotNull String value)
      Matches a string, exactly, in the JSON of the event.

      Parameters:
      value - This parameter is required.
    • exists

      @Stability(Stable) @NotNull public static List<String> exists()
      Matches when the field is present in the JSON of the event.
    • greaterThan

      @Stability(Stable) @NotNull public static List<String> greaterThan(@NotNull Number value)
      Matches numbers greater than the provided value.

      Parameters:
      value - This parameter is required.
    • greaterThanOrEqual

      @Stability(Stable) @NotNull public static List<String> greaterThanOrEqual(@NotNull Number value)
      Matches numbers greater than, or equal to, the provided value.

      Parameters:
      value - This parameter is required.
    • interval

      @Stability(Stable) @NotNull public static List<String> interval(@NotNull Number lower, @NotNull Number upper)
      Matches numbers inside a closed numeric interval. Equivalent to:.

      Match.allOf(Match.greaterThanOrEqual(lower), Match.lessThanOrEqual(upper))

      Parameters:
      lower - Lower bound (inclusive). This parameter is required.
      upper - Upper bound (inclusive). This parameter is required.
    • ipAddressRange

      @Stability(Stable) @NotNull public static List<String> ipAddressRange(@NotNull String range)
      Matches IPv4 and IPv6 network addresses using the Classless Inter-Domain Routing (CIDR) format.

      Alias of cidr().

      Parameters:
      range - This parameter is required.
    • lessThan

      @Stability(Stable) @NotNull public static List<String> lessThan(@NotNull Number value)
      Matches numbers less than the provided value.

      Parameters:
      value - This parameter is required.
    • lessThanOrEqual

      @Stability(Stable) @NotNull public static List<String> lessThanOrEqual(@NotNull Number value)
      Matches numbers less than, or equal to, the provided value.

      Parameters:
      value - This parameter is required.
    • nullValue

      @Stability(Stable) @NotNull public static List<String> nullValue()
      Matches a null value in the JSON of the event.
    • prefix

      @Stability(Stable) @NotNull public static List<String> prefix(@NotNull String value)
      Matches strings with the given prefix in the JSON of the event.

      Parameters:
      value - This parameter is required.
    • suffix

      @Stability(Stable) @NotNull public static List<String> suffix(@NotNull String value)
      Matches strings with the given suffix in the JSON of the event.

      Parameters:
      value - This parameter is required.
    • asList

      @Stability(Stable) @NotNull public List<String> asList()
      A representation of this matcher as a list of strings.
    • resolve

      @Stability(Stable) @NotNull public Object resolve(@NotNull IResolveContext context)
      Produce the Token's value at resolution time.

      Specified by:
      resolve in interface IResolvable
      Parameters:
      context - This parameter is required.
    • toString

      @Stability(Stable) @NotNull public String toString()
      Return a string representation of this resolvable object.

      Returns a reversible string representation.

      Specified by:
      toString in interface IResolvable
      Overrides:
      toString in class Object
    • getCreationStack

      @Stability(Stable) @NotNull public List<String> getCreationStack()
      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.

      Specified by:
      getCreationStack in interface IResolvable