我正在研究 aws 服务上的 api 网关,该网关对 dynamodb 执行 BatchWriteItem 操作。但我知道一个 BatchWrite 操作最多有 25 个放置项限制。我是 vtl 的新手,我不确定如何处理超过 25 个放置项的请求。我写下了我当前的身体模板。
任何提示或帮助将不胜感激。谢谢。
身体映射模板:
#set($inputRoot = $input.path('$'))
{
"RequestItems": {
"SensorDataTest": [
#foreach($elem in $inputRoot.sensorMessages)
{
"PutRequest":
{
"Item":
{
"GatewayID":
{
"N": "$inputRoot.gatewayMessage.gatewayID"
},
"SensorID": {
"N": "$elem.sensorID"
},
"SensorName": {
"S": "$elem.sensorName"
},
"ApplicationID": {
"N":"$elem.applicationID"
},
"NetworkID": {
"S":"$elem.networkID"
},
"DataMessageGUID": {
"S":"$elem.dataMessageGUID"
},
"MessageDate": {
"S":"$elem.messageDate"
},
"State": {
"N":"$elem.state"
},
"RawData": {
"S": "$elem.rawData"
},
"DataType": {
"S": "$elem.dataType"
},
"DataValue": {
"S": "$elem.dataValue"
},
"PlotValues": {
"S": "$elem.plotValues"
},
"PlotLabels": {
"S": "$elem.plotLabels"
},
"SignalStrength": {
"N":"$elem.signalStrength"
},
"BatteryLevel": {
"N": "$elem.batteryLevel"
},
"PendingChange": {
"S": "$elem.pendingChange"
}
}
}
}#if($foreach.hasNext),#end
#end
]
},
"ReturnConsumedCapacity": "TOTAL"
}