Skip to content

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

@Nowax

Description

@Nowax

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions