本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 Amazon 州語言定義 Step Functions 工作流程
如需詳細資訊,請參閱 Amazon 狀態語言規格
若要使用 Amazon 州語言在 Step Functions 主控台
注意
如果您在 Step Functions 的控制台之外定義狀態機器,例如在您選擇的編輯器中,則必須使用擴展名為. asl.json 來保存狀態機定義。
示例 Amazon 國家語言規範
{
"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
}
}
}