Skip to content

Commit 4a88f7a

Browse files
authored
Update README.md
1 parent ebc9b02 commit 4a88f7a

File tree

1 file changed

+159
-2
lines changed

1 file changed

+159
-2
lines changed

README.md

Lines changed: 159 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ functions:
2727
handler: handler.hello
2828
2929
stepFunctions:
30-
stateMachine:
30+
stateMachines:
3131
hellostepfunc:
3232
Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
3333
StartAt: HelloWorld
@@ -95,7 +95,7 @@ functions:
9595
handler: handler.hello
9696
9797
stepFunctions:
98-
stateMachine:
98+
stateMachines:
9999
yourWateMachine:
100100
Comment: "An example of the Amazon States Language using wait states"
101101
StartAt: FirstState
@@ -125,3 +125,160 @@ stepFunctions:
125125
Resource: hellofunc
126126
End: true
127127
```
128+
### Retry Failture
129+
130+
```yml
131+
functions:
132+
hellofunc:
133+
handler: handler.hello
134+
135+
stepFunctions:
136+
stateMachines:
137+
yourRetryMachine:
138+
Comment: "A Retry example of the Amazon States Language using an AWS Lambda Function"
139+
StartAt: HelloWorld
140+
States:
141+
HelloWorld:
142+
Type: Task
143+
Resource: hellofunc
144+
Retry:
145+
- ErrorEquals:
146+
- HandledError
147+
IntervalSeconds: 1
148+
MaxAttempts: 2
149+
BackoffRate: 2
150+
- ErrorEquals:
151+
- States.TaskFailed
152+
IntervalSeconds: 30
153+
MaxAttempts: 2
154+
BackoffRate: 2
155+
- ErrorEquals:
156+
- States.ALL
157+
IntervalSeconds: 5
158+
MaxAttempts: 5
159+
BackoffRate: 2
160+
End: true
161+
```
162+
163+
### Parallel
164+
165+
```yml
166+
stepFunctions:
167+
stateMachines:
168+
yourParallelMachine:
169+
Comment: "An example of the Amazon States Language using a parallel state to execute two branches at the same time."
170+
StartAt: Parallel
171+
States:
172+
Parallel:
173+
Type: Parallel
174+
Next: Final State
175+
Branches:
176+
- StartAt: Wait 20s
177+
States:
178+
Wait 20s:
179+
Type: Wait
180+
Seconds: 20
181+
End: true
182+
- StartAt: Pass
183+
States:
184+
Pass:
185+
Type: Pass
186+
Next: Wait 10s
187+
Wait 10s:
188+
Type: Wait
189+
Seconds: 10
190+
End: true
191+
Final State:
192+
Type: Pass
193+
End: true
194+
195+
```
196+
197+
### Catch Failture
198+
199+
```yml
200+
functions:
201+
hellofunc:
202+
handler: handler.hello
203+
stepFunctions:
204+
stateMachines:
205+
yourCatchMachine:
206+
Comment: "A Catch example of the Amazon States Language using an AWS Lambda Function"
207+
StartAt: HelloWorld
208+
States:
209+
HelloWorld:
210+
Type: Task
211+
Resource: hellofunc
212+
Catch:
213+
- ErrorEquals:
214+
- HandledError
215+
Next: CustomErrorFallback
216+
- ErrorEquals:
217+
- States.TaskFailed
218+
Next: ReservedTypeFallback
219+
- ErrorEquals:
220+
- States.ALL
221+
Next: CatchAllFallback
222+
End: true
223+
CustomErrorFallback:
224+
Type: Pass
225+
Result: "This is a fallback from a custom lambda function exception"
226+
End: true
227+
ReservedTypeFallback:
228+
Type: Pass
229+
Result: "This is a fallback from a reserved error code"
230+
End: true
231+
CatchAllFallback:
232+
Type: Pass
233+
Result: "This is a fallback from a reserved error code"
234+
End: true
235+
236+
```
237+
238+
### Choice
239+
240+
```yml
241+
functions:
242+
hellofunc1:
243+
handler: handler.hello1
244+
hellofunc2:
245+
handler: handler.hello2
246+
hellofunc3:
247+
handler: handler.hello3
248+
hellofunc4:
249+
handler: handler.hello4
250+
stepFunctions:
251+
stateMachines:
252+
yourChoiceMachine:
253+
Comment: "An example of the Amazon States Language using a choice state."
254+
StartAt: FirstState
255+
States:
256+
FirstState:
257+
Type: Task
258+
Resource: hellofunc1
259+
Next: ChoiceState
260+
ChoiceState:
261+
Type: Choice
262+
Choices:
263+
- Variable: "$.foo"
264+
NumericEquals: 1
265+
Next: FirstMatchState
266+
- Variable: "$.foo"
267+
NumericEquals: 2
268+
Next: SecondMatchState
269+
Default: DefaultState
270+
FirstMatchState:
271+
Type: Task
272+
Resource: hellofunc2
273+
Next: NextState
274+
SecondMatchState:
275+
Type: Task
276+
Resource: hellofunc3
277+
Next: NextState
278+
DefaultState:
279+
Type: Fail
280+
Cause: "No Matches!"
281+
NextState:
282+
Type: Task
283+
Resource: hellofunc4
284+
End: true

0 commit comments

Comments
 (0)