feat(pipes-targets): add API destination#30756
Conversation
nmussy
left a comment
There was a problem hiding this comment.
Mostly integ coverage, LGTM overall
packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.api-destination.ts
Outdated
Show resolved
Hide resolved
| }); | ||
|
|
||
| const connection = new cdk.aws_events.Connection(stack, 'MyConnection', { | ||
| authorization: cdk.aws_events.Authorization.apiKey('x-api-key', secret.secretValue), |
There was a problem hiding this comment.
I'm also curious to see what happens when you also set the same header in ApiDestination.headerParameters. It's either ignored or overrides the authorization, but I think we should probably warn the user either way
There was a problem hiding this comment.
See comment below with screenshot.
ec3dd80 to
6f969cc
Compare
|
@nmussy Here's the result from the Lambda logs. The
|
packages/@aws-cdk/aws-pipes-targets-alpha/lib/api-destination.ts
Outdated
Show resolved
Hide resolved
| * The headers to send as part of the request invoking the EventBridge API destination. | ||
| * | ||
| * The headers are merged with the headers from the API destination. | ||
| * If there are conflicts, the headers from the API destination take precedence. |
There was a problem hiding this comment.
@nmussy I added this note about precedence. From the logs we can see that x-api-key is abc123, not apiKeyFromHeaderParams.
There was a problem hiding this comment.
I'm not sure whether this is enough to indicate to users which value will take precedence. Is there somewhere we can print a warning when there are two identical headers provided, which explicitly lets the user know that the value is being set twice, and which of those values it's using?
There was a problem hiding this comment.
@redwheeler3 jfyi. I think it's worth mentioning in Docs and/or Console about precedence regarding conflicting headers.
Leo10Gama
left a comment
There was a problem hiding this comment.
Thanks for your contribution, and sorry for the delay! Overall seems good to me, just a few things to note before moving forward with these changes.
| * The headers to send as part of the request invoking the EventBridge API destination. | ||
| * | ||
| * The headers are merged with the headers from the API destination. | ||
| * If there are conflicts, the headers from the API destination take precedence. |
There was a problem hiding this comment.
I'm not sure whether this is enough to indicate to users which value will take precedence. Is there somewhere we can print a warning when there are two identical headers provided, which explicitly lets the user know that the value is being set twice, and which of those values it's using?
I'm not quite sure how to do this. There could be any number of custom headers, no? |
I believe that's the case, yeah. I was thinking some check like iterating through the header keys to see which overlap, like turning them into a set and taking the intersection type of operation. Then if we know the |
e7ace5e to
214765b
Compare
Pull request has been modified.
I'd prefer to do this in a follow-up PR. What do you think? I think the logic could get messy/complicated. I think the documentation note is sufficient for now. |
I do think we should include these changes in this PR, unless there are any other extra changes you wanted to add that might make the logic more confusing to follow. But ideally, including them in this PR means the logic is bundled together from the get-go. |
Leo10Gama
left a comment
There was a problem hiding this comment.
Thanks for the changes! Aside from my comment above regarding including the warning, just one more minor nit in the README.
I'm a little confused on what this would look like. An |
214765b to
43588e0
Compare
Pull request has been modified.
If I'm understanding the code correctly, the area of conflict is between |
I think I would need to change to Excuse my naïveté. Good with that? |
43588e0 to
66133ad
Compare
|
@moelasmar updated with your feedback—thanks! |
Leo10Gama
left a comment
There was a problem hiding this comment.
Seems all good to me, thanks for the quick responses on feedback! Just adding in one quick typehint that I missed before, and will wait to make sure the tests pass.
packages/@aws-cdk/aws-pipes-targets-alpha/lib/api-destination.ts
Outdated
Show resolved
Hide resolved
|
@mergify update |
✅ Branch has been successfully updated |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
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). |
|
Comments on closed issues and PRs are hard for our team to see. |

Add EventBridge API destination as a Pipes target.
CloudFormation groups EventBridge API destination with API Gateway REST API
as PipeTargetHttpParameters, but I think separating them here similar to aws-event-targets
makes more sense, as API Gateway requires
stage,path, andmethod(see here).