Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 25, 2025

Objects that conform to the L2 EventPattern interface are now interpreted correctly by the L1 CfnRule class:

// L1
interface CfnRuleProps {
  readonly eventPattern: any;            // <-- not typed
}

// L2
interface RuleProps {
  readonly eventPattern: EventPattern;   // <-- typed
}

At the L1, there is "raw data"; the L2 translates the fields of the EventPattern type to the correct fields of "raw data".

In practice, the only difference is that one of the raw data fields is called detail-type, which in the L2 type is called detailType. All other fields are the same.

We add the ability to render specific fields of specific L1s differently if we so choose: the renderer for CfnRule now has gotten the ability to specifically recognize detailType and translate it to detail-type.

This now makes both classes take the same inputs, reducing a common cause of user confusion and mistakes.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

It is now possible to use the L2 `EventPattern` interface to synthesize
events that will work with the L1 `CfnRule` class:

```ts
// L1
interface CfnRuleProps {
  readonly eventPattern: any;            // <-- not typed
}

// L2
interface RuleProps {
  readonly eventPattern: EventPattern;   // <-- typed
}
```

At the L1, there is "raw data"; the L2 translates the fields of
the `EventPattern` type to the correct fields of "raw data".

In practice, the only difference is that one of the raw data
fields is called `detail-type`, which in the L2 type is called
`detailType`. All other fields are the same.

We add the ability to render specific fields of specific L1s
differently if we so choose: the renderer for `CfnRule` now
has gotten the ability to specifically recognize `detailType`
and translate it to `detail-type`.

This now makes both classes take the same inputs.
@rix0rrr rix0rrr requested a review from a team as a code owner November 25, 2025 13:11
@github-actions github-actions bot added the p2 label Nov 25, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 25, 2025 13:11
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 25, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@mrgrain mrgrain changed the title feat: L2 EventPattern can be used for CfnRule feat(events): L2 EventPattern can be used for CfnRule Nov 25, 2025
@mrgrain mrgrain changed the title feat(events): L2 EventPattern can be used for CfnRule feat(events): the L2 EventPattern interfaces can be used with CfnRule Nov 25, 2025
@rix0rrr rix0rrr added pr-linter/exempt-readme The PR linter will not require README changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Nov 25, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 25, 2025 13:58

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

Merge Queue Status Beta

✅ The pull request has been merged

This pull request spent 1 hour 43 minutes in the queue, including 30 minutes 10 seconds waiting for CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Nov 25, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit efc135e into main Nov 25, 2025
16 of 17 checks passed
@mergify mergify bot deleted the huijbers/l1-l2-events branch November 25, 2025 16:06
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants