[英]AWS CDK how to embed custom java script in request template of gateway lambda Integration
From the AWS console we can set java script in integration request template mapping.在 AWS 控制台中,我们可以在集成请求模板映射中设置 java 脚本。 the same can not be set through AWS CDK.同样不能通过 AWS CDK 设置。
Template mapping from api gateway integration request allows to set application/json, with which we can also embed java script code as shown below, Similar way how to achieve in CDK来自api网关集成请求的模板映射允许设置application/json,我们也可以使用它嵌入java脚本代码如下图,类似的方法如何在CDK中实现
{"action": "hello",
#set($inputRoot = $input.path('$'))
"endPoints": [
#foreach($elem in $inputRoot.endPoints)
{
#set($headers = $elem.headers)
#if($headers != "")
"headers": "$elem.headers",
#end
"uri": "$elem.uri",
"info": "$elem.info"
}
#if($foreach.hasNext),#end
#end
]}
This can be handled through programming i am withdrawing this issue.这可以通过编程来处理,我正在撤回这个问题。 we can pass it as string like我们可以将它作为字符串传递
"""
{"action": "hello",
#set($inputRoot = $input.path('$'))
"endPoints": [
#foreach($elem in $inputRoot.endPoints)
{
#set($headers = $elem.headers)
#if($headers != "")
"headers": "$elem.headers",
#end
"uri": "$elem.uri",
"info": "$elem.info"
}
#if($foreach.hasNext),#end
#end
]}
"""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.