Last active
November 6, 2023 14:48
-
-
Save lober-io/ff56257380b43421a279268104a8e163 to your computer and use it in GitHub Desktop.
Example mapping template to pass everything to a Lambda non-proxy integration like in a proxy integration to use it with Powertools for AWS Lambda.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($inputParams = $input.params()) | |
{ | |
"resource": "$context.resourcePath", | |
#set( $contextPath = $context.path ) | |
#set( $path = $contextPath.replace("{id}", "$input.params().path.get('id')") ) | |
"path": "$path", | |
"httpMethod":"$context.httpMethod", | |
"headers": { | |
#set($params = $inputParams.get("header")) | |
#foreach($paramName in $params.keySet()) | |
#if( "$params.get($paramName)" == "" ) #set($paramValue = "None") #{else} #set($paramValue = "$params.get($paramName)") #end | |
"$paramName" : "$util.escapeJavaScript($paramValue)" | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"multiValueHeaders": "None", | |
"queryStringParameters": { | |
#set($params = $inputParams.get("querystring")) | |
#foreach($paramName in $params.keySet()) | |
#if( "$params.get($paramName)" == "" ) #set($paramValue = "None") #{else} #set($paramValue = "$params.get($paramName)") #end | |
"$paramName" : "$util.escapeJavaScript($paramValue)" | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"multiValueQueryStringParameters":"None", | |
"pathParameters": { | |
#set($params = $inputParams.get("path")) | |
#foreach($paramName in $params.keySet()) | |
#if( "$params.get($paramName)" == "" ) #set($paramValue = "None") #{else} #set($paramValue = "$params.get($paramName)") #end | |
"$paramName" : "$util.escapeJavaScript($paramValue)" | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"stageVariables": { | |
#foreach($key in $stageVariables.keySet()) | |
"$key" : "$util.escapeJavaScript($stageVariables.get($key))" | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"requestContext":{ | |
"resourceId":"$context.resourceId", | |
"resourcePath":"$context.resourcePath", | |
"httpMethod":"$context.httpMethod", | |
"extendedRequestId":"$context.awsEndpointRequestId", | |
"requestTime":"$context.requestTime", | |
"path":"$context.path", | |
"accountId":"$context.identity.accountId", | |
"protocol":"$context.protocol", | |
"stage":"$context.stage", | |
"domainPrefix":"$context.domainPrefix", | |
"requestTimeEpoch":$context.requestTimeEpoch, | |
"requestId":"$context.requestId", | |
"identity": { | |
#set($params = $context.identity) | |
#foreach($paramName in $params.keySet()) | |
#if( "$params.get($paramName)" == "" ) #set($paramValue = "None") #{else} #set($paramValue = "$params.get($paramName)") #end | |
"$paramName" : "$paramValue"#if($foreach.hasNext),#end | |
#end | |
}, | |
"domainName":"$context.domainName", | |
"apiId":"$context.apiId" | |
}, | |
#if( "$input.json('$')" == "" ) #set($bodyValue = "None") #{else} #set($bodyValue = "$input.json('$')") #end | |
"body": $bodyValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment