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

[@aws-cdk/aws-apigatewayv2-integrations] support parameter mapping in Http Integrations #15293

Closed
2 tasks
Nowax opened this issue Jun 24, 2021 · 9 comments · Fixed by #15630
Closed
2 tasks
Labels
@aws-cdk/aws-apigatewayv2-integrations Related to AWS APIGatewayv2 Integrations effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@Nowax
Copy link

Nowax commented Jun 24, 2021

I would like to have a possibility to configure parameter mapping to e.g. append or remove specific parameter in forwarded request.

Use Case

Currently there is no possibility to configure it, specifically in context of HttpAlbIntegration. These are only possible props:

 const integration = new HttpAlbIntegration({
            listener: httpApiListener,
            vpcLink: httpVpcLink,
            method: HttpMethod.ANY
        })

This functionality is available in AWS console and it's missing in aws cdk. It can be very helpful to e.g. pass some authorizer context parameters down to the backend.

Proposed Solution

It would be nice to have some additional field where proper mapping can be configured e.g.:

        const integration = new HttpAlbIntegration({
            listener: httpApiListener,
            vpcLink: httpVpcLink,
            method: HttpMethod.ANY,
            mapping: {
                request: {
                    {
                        parameter: "header.requestHeaderAppend",
                        modification: APPEND,
                        value: "$context.authorizer.PrincipalId"
                    },
                                        {
                        parameter: "header.requestHeaderRemove",
                        modification: REMOVE,
                    }
                    },
                                        {
                        parameter: "header.requestHeaderOverwrite",
                        modification: OVERWRITE,
                        value: "request overwrite value"
                    }
                }
                response: {
                    {
                        parameter: "header.responseTest",
                        modification: APPEND,
                        value: "custom response value"
                    }
                }
            }
        })

Same interface can be applied to rest of Integration classes.

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@Nowax Nowax added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 24, 2021
@github-actions github-actions bot added the @aws-cdk/aws-apigatewayv2-integrations Related to AWS APIGatewayv2 Integrations label Jun 24, 2021
@dan-lind
Copy link
Contributor

@nija-at I might be able to implement this. Wanted to know if someone would be available to discuss design before I get started?

@nija-at
Copy link
Contributor

nija-at commented Jul 15, 2021

@Nowax, @dan-lind - could you provide links to the documentation for this feature and how it can be set up via CloudFormation?

@nija-at nija-at added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 15, 2021
@dan-lind
Copy link
Contributor

@nija-at
Copy link
Contributor

nija-at commented Jul 15, 2021

Thanks @dan-lind.

Sounds good. I would suggest that you start by opening a PR containing just the changes to the README of the aws-apigatewayv2-integrations module to describe what the user experience looks like.

Once we're happy there, you could then move to implementation.

To keep the changes manageable, I recommend focusing on the experience of HTTP APIs without an integration subtype.

@nija-at nija-at added effort/medium Medium work item – several days of effort p2 and removed needs-triage This issue or PR still needs to be triaged. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Jul 15, 2021
@nija-at nija-at removed their assignment Jul 15, 2021
@dan-lind
Copy link
Contributor

@nija-at Was wondering if README changes shouldn't be in @aws-cdk/aws-apigatewayv2 rather than aws-apigatewayv2-integrations? Looks like all lower level stuff like this is kept in that main module.

@nija-at
Copy link
Contributor

nija-at commented Jul 16, 2021

Perhaps. Where it goes would depend on your design.

@Nowax
Copy link
Author

Nowax commented Oct 13, 2021

@dan-lind any idea when the Pull Request could be merged? It seems like the work is done here and only thing is missing is the merge itself.

@dan-lind
Copy link
Contributor

Don't know, it's waiting for a review from someone on the CDK team

@mergify mergify bot closed this as completed in #15630 Oct 13, 2021
mergify bot pushed a commit that referenced this issue Oct 13, 2021
…eter mapping (#15630)

----
This is an initial PR as discussed with @nija-at in an attempt to describe the user experience for supporting parameter mapping.
This PR will only support parameter mappings for HTTP APIs _without_ an integration subtypes, but it will provide interfaces that can (and probably should) be reused when adding support for integration subtypes as well. Since it also provides the possibility to provide custom key/value pairs for maximum flexibility, it can support and integration subtype although it requires a bit more work on the user side.

closes #15293 

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
…eter mapping (aws#15630)

----
This is an initial PR as discussed with @nija-at in an attempt to describe the user experience for supporting parameter mapping.
This PR will only support parameter mappings for HTTP APIs _without_ an integration subtypes, but it will provide interfaces that can (and probably should) be reused when adding support for integration subtypes as well. Since it also provides the possibility to provide custom key/value pairs for maximum flexibility, it can support and integration subtype although it requires a bit more work on the user side.

closes aws#15293 

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigatewayv2-integrations Related to AWS APIGatewayv2 Integrations effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants