首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >AWS步骤功能-字段参数在选择状态下不受支持?

AWS步骤功能-字段参数在选择状态下不受支持?
EN

Stack Overflow用户
提问于 2021-07-08 01:17:21
回答 1查看 71关注 0票数 0

我正在尝试创建一个AWS Step函数,但它在一个并行分支中显示了一条错误消息Field Parameters is not supported,处于选择状态。我使用了以下代码:

代码语言:javascript
运行
复制
{
"Comment": "A Parallel Step Function",
"StartAt": "ParentStep",
"States":
{
  "ParentStep":
  {
    "Comment": "Parallel test execution to check the Input Flow",
    "Type": "Parallel",
    "End": true,
    "Branches":
    [
        {
            "Comment": "Parallel Execution 1",
            "StartAt": "branch1",
            "States":
            {
                "branch1":
                {
                    "Comment": "branch1 started",
                    "Parameters":
                    {
                        "testvalue1.$": "$.value1"
                    },
                    "Type": "Choice",
                    "Choices":
                    [
                        {
                            "Variable": "$.testvalue1",
                            "NumericEquals": 1,
                            "Next": "subbranch1"
                        },
                        {
                            "Not":
                            {
                                "Variable": "$.testvalue1",
                                "NumericEquals": 1
                            },
                            "Next": "subbranch2"
                        }
                    ],
                    "Default": "subbranch2"
                },
                "subbranch1":
                {
                    "Comment": "sub-branch 1",
                    "Type": "Pass",
                    "End": true
                },
                "subbranch2":
                {
                    "Comment": "Ending branch 1",
                    "Type": "Pass",
                    "End": true
                }
            }
        },
        {
            "Comment": "Parallel Execution 2",
            "StartAt": "branch2",
            "States":
            {
                "branch2":
                {
                    "Comment": "starting branch 2",
                    "Parameters":
                    {
                        "testvalue2.$": "$.value2"
                    },
                    "Type": "Choice",
                    "Choices":
                    [
                        {
                            "Variable": "$.testvalue2",
                            "NumericEquals": 2,
                            "Next": "subbranch3"
                        },
                        {
                            "Not":
                            {
                                "Variable": "$.testvalue2",
                                "NumericEquals": 2
                            },
                            "Next": "subbranch4"
                        }
                    ],
                    "Default": "subbranch4"
                },
                "subbranch3":
                {
                    "Comment": "sub-branch 3",
                    "Type": "Pass",
                    "End": true
                },
                "subbranch4":
                {
                    "Comment": "Ending Parallel Execution 2",
                    "Type": "Pass",
                    "End": true
                }
            }
        }
    ]
}}}

但是,如果我用Task状态替换Choice状态,同样的代码也可以工作。Choice状态下是否不支持字段Parameters?我浏览了AWS Step function文档,但看不到任何有关这方面的信息。谁能解释一下这件事?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2021-07-08 13:51:25

不支持处于Choice状态的Parameters。根据this,您只能使用ChoicesDefault。此外,您还可以检查documentation支持哪些字段。顺便说一下,您可以通过以下解决方案来完成您的任务。

代码语言:javascript
运行
复制
{
  "Comment": "A Parallel Step Function",
  "StartAt": "ParentStep",
  "States": {
    "ParentStep": {
      "Comment": "Parallel test execution to check the Input Flow",
      "Type": "Parallel",
      "End": true,
      "Branches": [
        {
          "Comment": "Parallel Execution 1",
          "StartAt": "branch1",
          "States": {
            "branch1": {
              "Comment": "branch1 started",
              "Type": "Choice",
              "Choices": [
                {
                  "Variable": "$.testvalue1",
                  "NumericEquals": 1,
                  "Next": "subbranch1"
                },
                {
                  "Not": {
                    "Variable": "$.testvalue1",
                    "NumericEquals": 1
                  },
                  "Next": "subbranch2"
                }
              ],
              "Default": "subbranch2"
            },
            "subbranch1": {
              "Comment": "sub-branch 1",
              "Type": "Pass",
              "Parameters": {
                "testvalue1.$": "$.value1"
              },
              "End": true
            },
            "subbranch2": {
              "Comment": "Ending branch 1",
              "Type": "Pass",
              "Parameters": {
                "testvalue1.$": "$.value1"
              },
              "End": true
            }
          }
        },
        {
          "Comment": "Parallel Execution 2",
          "StartAt": "branch2",
          "States": {
            "branch2": {
              "Comment": "starting branch 2",
              "Type": "Choice",
              "Choices": [
                {
                  "Variable": "$.testvalue2",
                  "NumericEquals": 2,
                  "Next": "subbranch3"
                },
                {
                  "Not": {
                    "Variable": "$.testvalue2",
                    "NumericEquals": 2
                  },
                  "Next": "subbranch4"
                }
              ],
              "Default": "subbranch4"
            },
            "subbranch3": {
              "Comment": "sub-branch 3",
              "Type": "Pass",
              "Parameters": {
                "testvalue2.$": "$.value2"
              },
              "End": true
            },
            "subbranch4": {
              "Comment": "Ending Parallel Execution 2",
              "Type": "Pass",
              "Parameters": {
                "testvalue2.$": "$.value2"
              },
              "End": true
            }
          }
        }
      ]
    }
  }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68290471

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档