Choice state adds branching logic to a state machine. The state holds a list of *rule* and *next_step* pairs. The interpreter attempts pattern-matches against the rules in list order and transitions to the state or chain specified in the *next_step* field on the first *rule* where there is an exact match between the input value and a member of the comparison-operator array. When used in a chain, the subsequent step becomes the default choice that executes if none of the specified rules match.

Super classes

stepfunctions::Block -> stepfunctions::State -> Choice

Methods

Public methods

Inherited methods

Method new()

Initialize Choice class

Usage

Choice$new(
  state_id,
  comment = NULL,
  input_path = NULL,
  output_path = NULL,
  ...
)

Arguments

state_id

(str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.

comment

(str, optional): Human-readable comment or description. (default: None)

input_path

(str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')

output_path

(str, optional): Path applied to the state’s output, producing the effective output which serves as the raw input for the next state. (default: '$')

...

: Extra field names to pass to Block class


Method allowed_fields()

allowed extra fields

Usage

Choice$allowed_fields()


Method add_choice()

Add a *rule*, *next_step* pair to the choice state.

Usage

Choice$add_choice(rule, next_step)

Arguments

rule

(:R:class:`stepfunctions.steps.choice_rule.BaseRule`): Rule to pattern match the input against.

next_step

(State or Chain): Next state or chain to transition to, if `rule` is matches with the input.


Method default_choice()

Add a default step to the choice state. The default step executes if none of the specified rules match.

Usage

Choice$default_choice(next_step)

Arguments

next_step

(State or Chain): Next state or chain to transition to, if none of the specified rules match.


Method to_list()

Convert class to list ready to be translated for Amazon States Language https://states-language.net/spec.html.

Usage

Choice$to_list()


Method accept()

placeholder

Usage

Choice$accept(visitor)

Arguments

visitor

placeholder


Method clone()

The objects of this class are cloneable with this method.

Usage

Choice$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.