Skip to content

Commit 584a58c

Browse files
authored
fix(events-targets): add LogGroupTargetInput.fromObjectV2() method (#33720)
### Reason for this change The `LogGroupTargetInput.fromObject()` function returns a `RuleTargetInput` instead of a `LogGroupTargetInput`. It can therefore not be passed into the following field: ```ts export interface LogGroupProps extends TargetBaseProps { // ... readonly logEvent?: LogGroupTargetInput; } ``` Because the types don't match. This is a bug that hasn't shown up in TypeScript before because according to TypeScript's *structural typing* rules, the types `RuleTargetInput` and `LogGroupTargetInput` are compatible, but according to Java's *nominal typing* rules they are not. ### Description of changes Deprecated `LogGroupTargetInput.fromObject()` and created `LogGroupTargetInput.fromObjectV2()` which returns the correct type of `LogGroupTargetInput`. ### Description of how you validated changes integ test ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 3de0818 commit 584a58c

File tree

14 files changed

+1510
-5
lines changed

14 files changed

+1510
-5
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group-from-object-v2.js.snapshot/CloudWatchEventBridgeLogsTestDefaultTestDeployAssertC7AA0EE9.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group-from-object-v2.js.snapshot/CloudWatchEventBridgeLogsTestDefaultTestDeployAssertC7AA0EE9.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group-from-object-v2.js.snapshot/asset.cde607091ceabfbfb56e643cd4a5647680cfaf19c63f4d59b3f4880df4a71c8d/index.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group-from-object-v2.js.snapshot/aws-cdk-cloudwatch-eventbridge-logs.assets.json

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)