简体   繁体   中英

How reference AWS step function parallel task output?

I have a parallel task in the step function that contains two branches. The input was:

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

Each branch return a json result like the following

Branch 1 (I used "OutputPath": "$"):

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

Branch 2 (I used "ResultPath": "$.approvalStatus"):

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

When both the branches complete, the output of the parallel task return:

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

The next task is a choices,

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

and it is keep giving me the following error:

"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."

So here are my questions,

1) How should I reference it in the choice task to get the approvalStatus value?

2) Is there are anyway I can make the parallel task return in json format instead of an array?

Thanks in advance

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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