Last active
November 23, 2020 18:52
-
-
Save chris/6684fbf90a3435ea9984d14f4a3b4b02 to your computer and use it in GitHub Desktop.
Just the VTL template portion of the API Gateway - DynamoDB proxy serverless config
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
RequestTemplates: | |
application/json: | | |
#set($inputRoot = $input.path('$')) | |
{ | |
"RequestItems": { | |
"${self:resources.Resources.EventsTable.Properties.TableName}": [ | |
#foreach($event in $inputRoot.event) | |
{ | |
"PutRequest": { | |
"Item": { | |
"UserID" : { "S": "$context.authorizer.claims.sub" }, | |
"TimeUTC" : { "S": "$event.time" }, | |
"Lat": { "N": "$event.lat" }, | |
"Lng": { "N": "$event.lng" }, | |
"UUID" : { "S": "$event.uuid"}, | |
"Sensor" : { "S": "$event.sensor_name" }, | |
"Reading" : { "N": "$event.reading_value" }, | |
"Active" : { "BOOL": "$event.is_active" }, | |
} | |
} | |
}#if($foreach.hasNext),#end | |
#end | |
] | |
}, | |
"ReturnConsumedCapacity": "NONE", | |
"ReturnItemCollectionMetrics": "NONE" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment