Skip to content

Instantly share code, notes, and snippets.

@misterussell
Last active June 5, 2018 18:23
Show Gist options
  • Save misterussell/0fc00a26c69f3b7a4c3fb0e5d8d3361c to your computer and use it in GitHub Desktop.
Save misterussell/0fc00a26c69f3b7a4c3fb0e5d8d3361c to your computer and use it in GitHub Desktop.
resolver request mapping template for 6 5 18 post
#set($recipedata = [])
#foreach($recipe in ${ctx.args.recipes})
$util.qr($recipe.put("author", $ctx.identity.username ))
$util.qr($recipedata.add($util.dynamodb.toMapValues($recipe)))
#end
#set($elementsdata = [])
#foreach($element in ${ctx.args.elements})
$util.qr($elementsdata.add($util.dynamodb.toMapValues($element)))
#end
#set($ingredientsdata = [])
#foreach($ingredient in ${ctx.args.ingredients})
$util.qr($ingredientsdata.add($util.dynamodb.toMapValues($ingredient)))
#end
{
"version" : "2018-05-29",
"operation" : "BatchPutItem",
"tables" : {
"RecipeTable": $utils.toJson($recipedata),
"ElementTable": $utils.toJson($elementsdata),
"IngredientTable": $utils.toJson($ingredientsdata)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment