繁体   English   中英

如何参考 AWS step function 并行任务输出?

[英]How reference AWS step function parallel task output?

我在包含两个分支的 step 函数中有一个并行任务。 输入是:

{
  "database": "test",
  "userName": "tester",
  "userID": "test123",
  "adGroup": "testADGroup",
  "dbGroup": "ReadGroup"
}

每个分支都返回一个 json 结果,如下所示

分支 1(我使用了“OutputPath”:“$”):

{
  "requestType": "GrantAccess",
  "DBUser": "exists",
  "ADUser": "exists"
}

分支 2(我使用了“ResultPath”:“$.approvalStatus”):

{
      "database": "test",
      "userName": "tester",
      "userID": "test123",
      "adGroup": "testADGroup",
      "dbGroup": "ReadGroup"
      "approvalStatus": "Approved"
}

当两个分支都完成时,并行任务的输出返回:

[
  {
      "requestType": "GrantAccess",
      "DBUser": "exists",
      "ADUser": "exists"
  },
  {
      "database": "test",
      "userName": "tester",
      "userID": "test123",
      "adGroup": "testADGroup",
      "dbGroup": "ReadGroup"
      "approvalStatus": "Approved"
  }
]

下一个任务是一个选择,

"Choices": [
    {
      "Variable": "$.input[1].approvalStatus",
      "StringEquals": "Approved",
      "Next": "ProcessRequest"
    },
    {
      "Variable": "$.input[1].approvalStatus",
      "StringEquals": "Declined",
      "Next": "SendDeclineNotification"
    }
  ]

它不断给我以下错误:

"cause": "An error occurred while executing the state 'CheckApprovalStatus' (entered at the event id #16). Invalid path '$.input[1].approvalStatus': The choice state's condition path references an invalid value."

所以这里是我的问题,

1)我应该如何在选择任务中引用它来获得approvalStatus值?

2)无论如何我可以让并行任务以json格式而不是数组返回?

提前致谢

如果您不想更改 ResultPath,我认为您应该使用"$[1].approvalStatus"之类的东西。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM