-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-events-targets: API Gateway target should accept IRestApi and not RestApi #16423
aws-events-targets: API Gateway target should accept IRestApi and not RestApi #16423
Comments
I agree. Feel free to submit a PR with the change. |
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes: aws#16423 When creating an Event Bridge target for an API Gateway, the superinterface IRestApi should be consumed instead of the concrete class RestApi. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I'm also facing this issue, I can see there was a PR that was closed but I can't see why it was closed, does this need a new PR opened? |
Facing the issue as well, why was the PR closed? |
Same here |
Looking forward to the change. Planning to use it |
I'm facing the exact same issue |
#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*
|
The
ApiGateway
target in aws-events-targets requires aRestApi
from aws-apigateway as part of the constructor. This is actually too restrictive and, as far as I can tell, the implementation does not require that particular subclass. The inheritance hierarchy in aws-apigateway is as follows. The current requirements preclude using aSpecRestApi
as a target, without good reason.The implementation of
ApiGateway
makes use ofthis.restApi.arnForExecuteApi()
andthis.restApi.deploymentStage.stageName
, both of which are defined inIRestApi
.Reproduction Steps
What did you expect to happen?
The
ApiGateway
target from aws-events-targets should accept anIRestApi
so that a Rest API built from a swagger or OpenAPI definition can be used as a target for an Event Bridge Rule.What actually happened?
Only
RestApi
are accepted, so I'm precluded from using aSpecRestApi
, which is a sibling toRestApi
.Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: