StateMachine

The StateMachine class builds the ASL compliant JSON, by walking the branch of states linked to the specified starting state.

For more details on StateMachine, see the AWS documentation.

class awssl.StateMachine(Comment='', ASLVersion='1.0', StartState=None)

StateMachine will execute the main branch, starting from the state specified by StartState.

The ASL JSON can be returned by calling print.

Parameters:
  • Comment (str) – [Optiona] A comment describing the processing of the state machine
  • ASLVersion (str) – [Optional] The version of the ASL specification. Only 1.0 is currently supported
  • StartState (any start class derived from StateBase) – [Required] The starting state for the start machine. Must not be None
get_asl_version()

Returns the ASL version specification used for the state machine definition.

Returns:str – The version of ASL being used
get_comment()

Returns the comment describing the state machine.

Returns:str – The comment associated with the state machine
get_start_state()

Returns the object representing the starting state for the state machine.

Returns:StateBase – A state class derived from StateBase
set_asl_version(ASLVersion='1.0')

Sets the ASL version specification being used for the state machine definition.

Parameters:ASLVersion (str) – [[Optional]] The version of the ASL specification. Only 1.0 is currently supported
set_comment(Comment='')

Sets the comment describing the state machine.

Parameters:Comment (str) – [[Optional]] A description of the processing of the state machine
set_start_state(StartState=None)

Sets the starting state for the state machine.

Parameters:StartState (any start class derived from StateBase) – [[Required]] The starting state for the start machine. Must not be None
validate()

Validates the state machine is correctly specified, compared to the version of the ASL being used.

Raises Exception with details of the error, if the state machine is incorrectly defined.