Skip to content

Commit 8e1fefd

Browse files
authored
fix(events-targets): ApiGateway events target should accept IRestApi (#29397)
### Issue Closes [#16423](#16423). ### Reason for this change The CDK construct to set an APIGatway as the target for an EventBridge rule only accepted RestApi. It should instead accept the interface IRestApi. ### Description of changes This change was attempted once earlier, but [the PR](#16542) was closed. Changed the `ApiGateway` target's constructor's first argument from `api.RestApi` to `api.IRestApi`. To fix compatibility failures caused by the previous `restApi` being a public member of the class, I've followed the approach suggested [here](#16542 (comment)). Some other alternatives are suggested [here](#16542 (comment)). ### Description of how you validated changes Added a unit test that creates a dummy `SpecRestApi`. Also added an integ test that creates a `SpecRestApi` from a dummy OpenAPI spec and creates a rule on the default event bus with the APIGateway as target. Nothing is executed in the integ test. The assertion only checks if the target is created using the `ListTargetsByRule` API. ### 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 f00f918 commit 8e1fefd

File tree

14 files changed

+34180
-5
lines changed

14 files changed

+34180
-5
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/api-gateway/integ.api-gateway.js.snapshot/ApiGatewayTargetDefaultTestDeployAssert33F7AF34.assets.json

+32
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/api-gateway/integ.api-gateway.js.snapshot/ApiGatewayTargetDefaultTestDeployAssert33F7AF34.template.json

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

0 commit comments

Comments
 (0)