Class: AWSCDK::StepFunctions::StateGraph

Inherits:
Jsii::Object
  • Object
show all
Defined in:
step_functions/state_graph.rb

Overview

A collection of connected states.

A StateGraph is used to keep track of all states that are connected (have transitions between them). It does not include the substatemachines in a Parallel's branches: those are their own StateGraphs, but the graphs themselves have a hierarchical relationship as well.

By assigning states to a definitive StateGraph, we verify that no state machines are constructed. In particular:

  • Every state object can only ever be in 1 StateGraph, and not inadvertently be used in two graphs.
  • Every stateId must be unique across all states in the entire state machine.

All policy statements in all states in all substatemachines are bubbled so that the top-level StateMachine instantiation can read them all and add them to the IAM Role.

You do not need to instantiate this class; it is used internally.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_state, graph_description) ⇒ StateGraph

Returns a new instance of StateGraph.

Parameters:

  • start_state (AWSCDK::StepFunctions::State)

    state that gets executed when the state machine is launched.

  • graph_description (String)

    description of the state machine.



29
30
31
32
33
# File 'step_functions/state_graph.rb', line 29

def initialize(start_state, graph_description)
  Jsii::Type.check_type(start_state, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5TdGF0ZSJ9")), "startState")
  Jsii::Type.check_type(graph_description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "graphDescription")
  Jsii::Object.instance_method(:initialize).bind(self).call(start_state, graph_description)
end

Class Method Details

.jsii_overridable_methodsObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'step_functions/state_graph.rb', line 35

def self.jsii_overridable_methods
  {
    :policy_statements => { kind: :property, name: "policyStatements", is_optional: false },
    :start_state => { kind: :property, name: "startState", is_optional: false },
    :timeout => { kind: :property, name: "timeout", is_optional: true },
    :bind => { kind: :method, name: "bind", is_optional: false },
    :register_policy_statement => { kind: :method, name: "registerPolicyStatement", is_optional: false },
    :register_state => { kind: :method, name: "registerState", is_optional: false },
    :register_super_graph => { kind: :method, name: "registerSuperGraph", is_optional: false },
    :to_graph_json => { kind: :method, name: "toGraphJson", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
  }
end

Instance Method Details

#bind(state_machine) ⇒ void

This method returns an undefined value.

Binds this StateGraph to the StateMachine it defines and updates state machine permissions if there are DistributedMap states.

Parameters:



83
84
85
86
# File 'step_functions/state_graph.rb', line 83

def bind(state_machine)
  Jsii::Type.check_type(state_machine, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5TdGF0ZU1hY2hpbmUifQ==")), "stateMachine")
  jsii_call_method("bind", [state_machine])
end

#policy_statementsArray<AWSCDK::IAM::PolicyStatement>

The accumulated policy statements.

Returns:



52
53
54
# File 'step_functions/state_graph.rb', line 52

def policy_statements()
  jsii_get_property("policyStatements")
end

#register_policy_statement(statement) ⇒ void

This method returns an undefined value.

Register a Policy Statement used by states in this graph.

Parameters:



92
93
94
95
# File 'step_functions/state_graph.rb', line 92

def register_policy_statement(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("registerPolicyStatement", [statement])
end

#register_state(state) ⇒ void

This method returns an undefined value.

Register a state as part of this graph.

Called by State.bindToGraph().

Parameters:



103
104
105
106
# File 'step_functions/state_graph.rb', line 103

def register_state(state)
  Jsii::Type.check_type(state, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5TdGF0ZSJ9")), "state")
  jsii_call_method("registerState", [state])
end

#register_super_graph(graph) ⇒ void

This method returns an undefined value.

Register this graph as a child of the given graph.

Resource changes will be bubbled up to the given graph.

Parameters:

  • graph (AWSCDK::StepFunctions::StateGraph)


114
115
116
117
# File 'step_functions/state_graph.rb', line 114

def register_super_graph(graph)
  Jsii::Type.check_type(graph, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5TdGF0ZUdyYXBoIn0=")), "graph")
  jsii_call_method("registerSuperGraph", [graph])
end

#start_stateAWSCDK::StepFunctions::State

state that gets executed when the state machine is launched.



59
60
61
# File 'step_functions/state_graph.rb', line 59

def start_state()
  jsii_get_property("startState")
end

#timeoutAWSCDK::Duration?

Note:

Default: No timeout

Set a timeout to render into the graph JSON.

Read/write. Only makes sense on the top-level graph, subgraphs do not support this feature.

Returns:



70
71
72
# File 'step_functions/state_graph.rb', line 70

def timeout()
  jsii_get_property("timeout")
end

#timeout=(value) ⇒ Object



74
75
76
77
# File 'step_functions/state_graph.rb', line 74

def timeout=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless value.nil?
  jsii_set_property("timeout", value)
end

#to_graph_json(query_language = nil) ⇒ Hash

Return the Amazon States Language JSON for this graph.

Parameters:

Returns:

  • (Hash)


123
124
125
126
# File 'step_functions/state_graph.rb', line 123

def to_graph_json(query_language = nil)
  Jsii::Type.check_type(query_language, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5RdWVyeUxhbmd1YWdlIn0=")), "queryLanguage") unless query_language.nil?
  jsii_call_method("toGraphJson", [query_language])
end

#to_stringString

Return a string description of this graph.

Returns:

  • (String)


131
132
133
# File 'step_functions/state_graph.rb', line 131

def to_string()
  jsii_call_method("toString", [])
end