Created
February 7, 2018 17:04
-
-
Save OniOni/1b14cc6c5b5dce6e22a6d8aab10c8066 to your computer and use it in GitHub Desktop.
application/x-www-form-urlencoded / chalice mapping template
This file contains 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($allParams = $input.params()) | |
{ | |
"body-json" : "", | |
"base64-body": "$util.base64Encode($input.body)", | |
"params" : { | |
#foreach($type in $allParams.keySet()) | |
#set($params = $allParams.get($type)) | |
"$type" : { | |
#foreach($paramName in $params.keySet()) | |
"$paramName" : "$util.escapeJavaScript($params.get($paramName))" | |
#if($foreach.hasNext),#end | |
#end | |
} | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"stage-variables" : { | |
#foreach($key in $stageVariables.keySet()) | |
"$key" : "$util.escapeJavaScript($stageVariables.get($key))" | |
#if($foreach.hasNext),#end | |
#end | |
}, | |
"context" : { | |
"account-id" : "$context.identity.accountId", | |
"api-id" : "$context.apiId", | |
"api-key" : "$context.identity.apiKey", | |
"authorizer-principal-id" : "$context.authorizer.principalId", | |
"caller" : "$context.identity.caller", | |
"cognito-authentication-provider" : "$context.identity.cognitoAuthenticationProvider", | |
"cognito-authentication-type" : "$context.identity.cognitoAuthenticationType", | |
"cognito-identity-id" : "$context.identity.cognitoIdentityId", | |
"cognito-identity-pool-id" : "$context.identity.cognitoIdentityPoolId", | |
"http-method" : "$context.httpMethod", | |
"stage" : "$context.stage", | |
"source-ip" : "$context.identity.sourceIp", | |
"user" : "$context.identity.user", | |
"user-agent" : "$context.identity.userAgent", | |
"user-arn" : "$context.identity.userArn", | |
"request-id" : "$context.requestId", | |
"resource-id" : "$context.resourceId", | |
"resource-path" : "$context.resourcePath" | |
}, | |
"claims": { | |
#foreach($key in $context.authorizer.claims.keySet()) | |
"$key": "$util.escapeJavaScript($context.authorizer.claims.get($key))" | |
#if($foreach.hasNext),#end | |
#end | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment