本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Amazon States 语言定义 Step Functions 工作流程
有关更多信息,请参阅 Amazon States Language 规范
要使用 Amazon States Language 在 Step Functions 控制台
注意
如果您在 Step Functions 控制台之外定义状态机,例如在自己选择的编辑器中,则必须以 .asl.json 扩展名保存状态机定义。
Amazon States Language 规范示例
{
"Comment": "An example of the Amazon States Language using a choice state.",
"StartAt": "FirstState",
"States": {
"FirstState": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:FUNCTION_NAME
",
"Next": "ChoiceState"
},
"ChoiceState": {
"Type" : "Choice",
"Choices": [
{
"Variable": "$.foo",
"NumericEquals": 1,
"Next": "FirstMatchState"
},
{
"Variable": "$.foo",
"NumericEquals": 2,
"Next": "SecondMatchState"
}
],
"Default": "DefaultState"
},
"FirstMatchState": {
"Type" : "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:OnFirstMatch
",
"Next": "NextState"
},
"SecondMatchState": {
"Type" : "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:OnSecondMatch
",
"Next": "NextState"
},
"DefaultState": {
"Type": "Fail",
"Error": "DefaultStateError",
"Cause": "No Matches!"
},
"NextState": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:FUNCTION_NAME
",
"End": true
}
}
}