Skip to content
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

fix(events-targets): ApiGateway events target should accept IRestApi #29397

Merged
merged 2 commits into from Apr 24, 2024

Conversation

n-k1
Copy link
Contributor

@n-k1 n-k1 commented Mar 7, 2024

Issue

Closes #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 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. Some other alternatives are suggested here.

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


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

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Mar 7, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team March 7, 2024 07:43
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.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@n-k1 n-k1 changed the title fix(aws-events-targets): ApiGateway events target should accept IRestApi fix(events-targets): ApiGateway events target should accept IRestApi Mar 7, 2024
@n-k1 n-k1 changed the title fix(events-targets): ApiGateway events target should accept IRestApi fix(events-targets): ApiGateway events target should accept IRestApi Mar 7, 2024
@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch from 0cef0c6 to f8f83f4 Compare March 7, 2024 09:10
@n-k1 n-k1 marked this pull request as draft March 7, 2024 09:48
@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch from f8f83f4 to 1d21c33 Compare March 8, 2024 06:21
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 8, 2024 06:23

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

@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch from 1d21c33 to e34274f Compare March 8, 2024 06:27
@n-k1 n-k1 marked this pull request as ready for review March 8, 2024 07:15
@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch from e34274f to 7afac66 Compare March 18, 2024 16:01
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 18, 2024
@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch 3 times, most recently from 0194e06 to c17243a Compare March 22, 2024 04:54
Copy link
Contributor

@msambol msambol left a comment

Choose a reason for hiding this comment

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

This LGTM. Moving to maintainer review. I'd like @rix0rrr to review this since he had feedback on the previous PR.

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Mar 22, 2024
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Apr 16, 2024
@n-k1 n-k1 force-pushed the fix-event-targets-apigateway-interface branch 2 times, most recently from 5981dde to 4b1544d Compare April 23, 2024 11:52
@mergify mergify bot dismissed gracelu0’s stale review April 23, 2024 11:52

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Apr 23, 2024
@n-k1 n-k1 requested a review from gracelu0 April 23, 2024 12:59
Copy link
Contributor

@gracelu0 gracelu0 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

Copy link
Contributor

mergify bot commented Apr 23, 2024

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).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Apr 23, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6abd285
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 8e1fefd into aws:main Apr 24, 2024
12 checks passed
Copy link
Contributor

mergify bot commented Apr 24, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-events-targets beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-events-targets: API Gateway target should accept IRestApi and not RestApi
4 participants