Pass State¶
The Pass
class acts as a pass through state, allowing new data to be added, or the input to be filtered.
For more details on Pass
, see the AWS documentation.
-
class
awssl.
Pass
(Name='', Comment='', InputPath='$', OutputPath='$', EndState=False, NextState=None, ResultPath='$', ResultAsJSON=None)¶ Models the Pass state, which can transfer input to output, or can inject specific values via set_result().
Either:
EndState
isTrue
andNextState
must beNone
EndState
isFalse
andNextState
must be a valid instance of a class derived fromStateBase
.
Values can be returned by
Pass
by specifying a JSON result forResultAsJSON
such as:{ "output": "This is a value" }
and then using
OutputPath
to filter, by specifing “$.output”.Parameters: - Name (str) – [Required] The name of the state within the branch of the state machine
- Comment (str) – [Optional] A comment describing the intent of this pass state
- InputPath (str) – [Optional] Filter on the Input information to be passed to the Pass state. Default is “$”, signifying that all the Input information will be provided
- OutputPath (str) – [Optional] Filter on the Output information to be returned from the Pass state. Default is “$”, signifying that all the result information will be provided
- EndState (bool) – [Optional] Flag indicating if this state terminates a branch of the state machine. Defaults to
False
. - NextState (instance of class derived from
StateBase
) – [Optional] Next state to be invoked within this branch. Must not beNone
unlessEndState
isTrue
. - ResultPath (dict) – [Optional] JSONPath indicating where results should be added to the Input. Defaults to “$”, indicating results replace the Input entirely.
- ResultAsJSON – [Optional] Data to be returned by this state, in JSON format.
-
clone
(NameFormatString='{}')¶ Returns a clone of this instance, with the clone named per the NameFormatString, to avoid state name clashes.
If this instance is not an end state, then the next state will also be cloned, to establish a complete clone of the branch form this instance onwards.
Parameters: NameFormatString (str) – [Required] The naming template to be applied to generate the name of the new instance. Returns: Pass
– A new instance of this instance and any other instances in its branch.
-
get_result
()¶ Returns the JSON result of this instance.
Returns: dict – The JSON representation
-
set_result
(ResultAsJSON={})¶ Sets the result to be returned by this instance of
Pass
.Parameters: ResultAsJSON – [Optional] Data to be returned by this state, in JSON format.
-
to_json
()¶ Returns the JSON representation of this instance.
Returns: dict – The JSON representation
-
validate
()¶ Validates this instance is correctly specified.
Raises
Exception
with details of the error, if the state machine is incorrectly defined.