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(By |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Choice(Deputy |
Used by jsii to construct an instance of this class from DeputyProps |
Choice(Construct, String, IChoice |
Properties
End |
Continuable states of this Chainable. |
Methods
Afterwards(IAfterwards |
Return a Chain that contains all reachable end states from this Choice. |
Jsonata(Construct, String, IChoice |
Define a Choice using JSONata in the state machine. |
Json |
Define a Choice using JSONPath in the state machine. |
Otherwise(IChainable) | If none of the given conditions match, continue execution with the given state. |
ToStateJson(Nullable<QueryLanguage>) | Return the Amazon States Language object for this state. |
When(Condition, IChainable, IChoice |
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. By Ref Value 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. Deputy Base. Deputy Props 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 IChoice
Props
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 IAfterwards
Options
Returns
Remarks
Use this to combine all possible choice paths back.
Jsonata(Construct, String, IChoiceJsonataProps)
Define a Choice using JSONata in the state machine.
public static Choice Jsonata(Construct scope, string id, IChoiceJsonataProps props = null)
Parameters
- scope Constructs.
Construct - id System.
String - props IChoice
Jsonata Props
Returns
Remarks
A choice state can be used to make decisions based on the execution state.
JsonPath(Construct, String, IChoiceJsonPathProps)
Define a Choice using JSONPath in the state machine.
public static Choice JsonPath(Construct scope, string id, IChoiceJsonPathProps props = null)
Parameters
- scope Constructs.
Construct - id System.
String - props IChoice
Json Path Props
Returns
Remarks
A choice state can be used to make decisions based on the execution state.
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(Nullable<QueryLanguage>)
Return the Amazon States Language object for this state.
public override JObject ToStateJson(Nullable<QueryLanguage> topLevelQueryLanguage = null)
Parameters
- topLevelQueryLanguage System.
Nullable <QueryLanguage >
Returns
Newtonsoft.
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 IChoice
Transition Options
Returns