传递输入到AWS Step Functions中的输出 [英] Passthrough input to output in AWS Step Functions
问题描述
如何在AWS Step Functions中将输入传递到Task
状态到输出?
How can I passthrough the input to a Task
state in an AWS Step Functions to the output?
在阅读InputPath,ResultPath
和OutputPath
的各种组合.
After reading the Input and Output Processing page in the AWS docs, I have played with various combinations of InputPath
, ResultPath
and OutputPath
.
状态定义:
"First State": {
"Type": "Task",
"Resource": "[My Lambda ARN]",
"Next": "Second State",
"InputPath": "$.someKey",
"OutputPath": "$"
}
输入:
{
"someKey": "someValue"
}
预期结果
我希望First State
的输出(以及Second State
的输入)是
I would like the output of the First State
(and thus the input of Second State
) to be
{
"someKey": "someValue"
}
实际结果
[empty]
如果输入更为复杂,例如
What if the input is more complicated, e.g.
{
"firstKey": "firstValue",
"secondKey": "secondValue"
}
我想转发所有内容而不必担心(子)路径.
I would like to forward all of it without worrying about (sub) paths.
推荐答案
如果ResultPath的值为null,则意味着该州自己的原始输出将被丢弃,其原始输入将成为其结果.
If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.
因此,我将状态定义更新为
Consequently, I updated my state definition to
"First State": {
"Type": "Task",
"Resource": "[My Lambda ARN]",
"Next": "Second State",
"ResultPath": null
}
结果,当传递输入示例Task
时,输入有效负载也将被复制到输出中,即使对于像这样的丰富对象也是如此:
As a result, when passing the input example Task
input payload will be copied to the output, even for rich objects like:
{
"firstKey": "firstValue",
"secondKey": "secondValue"
}
这篇关于传递输入到AWS Step Functions中的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!