是否可以在 aws step 函数中创建一个循环并遍历 json 输入数组?
我有一个函数generateEmails
可以创建包含n
多个对象的数组:
{
"emails": [
{
"to": [
"willow1@aaa.co.uk"
]
},
{
"to": [
"willow2@aaa.co.uk"
]
}, {
"to": [
"willow3@aaa.co.uk"
]
}
]
}
现在我想为sendEmail
emails 数组中的每个对象调用 next 函数,如下所示:
{
"email": {
"to": [
"willow@aaa.co.uk"
]
}
}
步进功能代码:
{
"Comment": "A state machine that prepares and sends confirmation email ",
"StartAt": "generateEmails",
"States": {
"generateEmails": {
"Type": "Task",
"Resource": "arn:aws:lambda::prepare-confirmation-email",
"Next": "sendEmail"
},
"sendEmail": {
"Type": "Task",
"Resource": "arn:aws:lambda::function:template-service",
"End" : true
}
}
}
这有可能实现吗?
谢谢!