API 网关 GET 方法请求 URL 使用 AWS CDK 查询字符串参数

API Gateway GET Method Request URL Query String Parameters using AWS CDK

我正在使用 CDK 配置 API 网关,我正在努力处理 GET 方法请求中的 URL 查询字符串参数。我可以找到集成请求的示例,但找不到方法请求的示例。

这些是我使用控制台定义的 URL 查询字符串参数,我的问题是如何使用 CDK 在 TypeScript 中复制它?

我查看了 CDK 文档,希望找到实现。我原以为它可能在 MethodOptions interface 以下,但对我的情况没有任何用处。

以下代码可以完成这项工作。它是 Method construct.

的一部分
 options: {
      requestParameters: {
     'method.request.querystring.profile': true,
     'method.request.querystring.username': true,
     'method.request.querystring.password': true,
     'method.request.querystring.language': true,
     'method.request.querystring.options': false
      }
}