AWS Step Functions - Invalid JSON Path

0

I am getting the following error when attempting to use the following JSON Path in my ResultsSelector $.Clusters[:].ClusterIdentifier.

Enter image description here

What is curious to me is that in the Step Function Data Flow simulator, the results work as expected when testing the path selection, so I am at a loss as to how to proceed.

In the end, I want to use Describe Clusters to get the data on what is running and inspect the created array to determine if my cluster of interest is running.

已提問 1 年前檢視次數 331 次
1 個回答
0
已接受的答案

Hi,

AWS Step Functions uses Amazon States Language to describe state machines declaratively, and the "@", ",", ":", and "?" operators are not supported, since all reference Paths MUST be unambiguous references to a single value, array, or object (subtree).

Thus, the wildcard symbol could be employed to select all elements of an object or array.

Step Function definition

{
  "Comment": "A description of my state machine",
  "StartAt": "Pass",
  "States": {
    "Pass": {
      "Type": "Pass",
      "End": true,
      "Parameters": {
        "clusterids.$": "$.Clusters[*].ClusterIdentifier"
      }
    }
  }
}

Input

{
  "Clusters": [
    {
      "ClusterIdentifier": 1
    },
    {
      "ClusterIdentifier": 2
    }
  ]
}

Output

{
  "clusterids": [
    1,
    2
  ]
}

I hope this helps you.

profile picture
專家
已回答 1 年前
profile picture
專家
已審閱 1 年前
  • Ahh, I even scanned the spec and totally didn't pick up on that, especially since data were returned in the data flow simulator. Regardless, thank you for the note!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南