Class Choice
Define a Choice in the state machine.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Choice : State, IChainable
Syntax (vb)
Public Class Choice
Inherits State
Implements IChainable
Remarks
A choice state can be used to make decisions based on the execution state.
ExampleMetadata: infused
Examples
var map = new Map(this, "Map State", new MapProps {
MaxConcurrency = 1,
ItemsPath = JsonPath.StringAt("$.inputForMap"),
ItemSelector = new Dictionary<string, object> {
{ "item", JsonPath.StringAt("$.Map.Item.Value") }
},
ResultPath = "$.mapOutput"
});
// The Map iterator can contain a IChainable, which can be an individual or multiple steps chained together.
// Below example is with a Choice and Pass step
var choice = new Choice(this, "Choice");
var condition1 = Condition.StringEquals("$.item.status", "SUCCESS");
var step1 = new Pass(this, "Step1");
var step2 = new Pass(this, "Step2");
var finish = new Pass(this, "Finish");
var definition = choice.When(condition1, step1).Otherwise(step2).Afterwards().Next(finish);
map.ItemProcessor(definition);
Synopsis
Constructors
Choice(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Choice(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Choice(Construct, String, IChoiceProps) |
Properties
EndStates | Continuable states of this Chainable. |
Methods
Afterwards(IAfterwardsOptions) | Return a Chain that contains all reachable end states from this Choice. |
Otherwise(IChainable) | If none of the given conditions match, continue execution with the given state. |
ToStateJson() | Return the Amazon States Language object for this state. |
When(Condition, IChainable, IChoiceTransitionOptions) | If the given condition matches, continue execution with the given state. |
Constructors
Choice(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Choice(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Choice(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Choice(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Choice(Construct, String, IChoiceProps)
public Choice(Construct scope, string id, IChoiceProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
Descriptive identifier for this chainable.
- props IChoiceProps
Properties
EndStates
Continuable states of this Chainable.
public override INextable[] EndStates { get; }
Property Value
Overrides
Methods
Afterwards(IAfterwardsOptions)
Return a Chain that contains all reachable end states from this Choice.
public virtual Chain Afterwards(IAfterwardsOptions options = null)
Parameters
- options IAfterwardsOptions
Returns
Remarks
Use this to combine all possible choice paths back.
Otherwise(IChainable)
If none of the given conditions match, continue execution with the given state.
public virtual Choice Otherwise(IChainable def)
Parameters
- def IChainable
Returns
Remarks
If no conditions match and no otherwise() has been given, an execution error will be raised.
ToStateJson()
Return the Amazon States Language object for this state.
public override JObject ToStateJson()
Returns
Newtonsoft.Json.Linq.JObject
Overrides
When(Condition, IChainable, IChoiceTransitionOptions)
If the given condition matches, continue execution with the given state.
public virtual Choice When(Condition condition, IChainable next, IChoiceTransitionOptions options = null)
Parameters
- condition Condition
- next IChainable
- options IChoiceTransitionOptions
Returns