class StateGraph
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.StepFunctions.StateGraph |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#StateGraph |
![]() | software.amazon.awscdk.services.stepfunctions.StateGraph |
![]() | aws_cdk.aws_stepfunctions.StateGraph |
![]() | aws-cdk-lib » aws_stepfunctions » StateGraph |
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.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
declare const state: stepfunctions.State;
const stateGraph = new stepfunctions.StateGraph(state, 'graphDescription');
Initializer
new StateGraph(startState: State, graphDescription: string)
Parameters
- startState
State
— state that gets executed when the state machine is launched. - graphDescription
string
— description of the state machine.
Properties
Name | Type | Description |
---|---|---|
policy | Policy [] | The accumulated policy statements. |
start | State | state that gets executed when the state machine is launched. |
timeout? | Duration | Set a timeout to render into the graph JSON. |
policyStatements
Type:
Policy
[]
The accumulated policy statements.
startState
Type:
State
state that gets executed when the state machine is launched.
timeout?
Type:
Duration
(optional, 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.
Methods
Name | Description |
---|---|
bind(stateMachine) | Binds this StateGraph to the StateMachine it defines and updates state machine permissions. |
register | Register a Policy Statement used by states in this graph. |
register | Register a state as part of this graph. |
register | Register this graph as a child of the given graph. |
to | Return the Amazon States Language JSON for this graph. |
to | Return a string description of this graph. |
bind(stateMachine)
public bind(stateMachine: StateMachine): void
Parameters
- stateMachine
State
Machine
Binds this StateGraph to the StateMachine it defines and updates state machine permissions.
registerPolicyStatement(statement)
public registerPolicyStatement(statement: PolicyStatement): void
Parameters
- statement
Policy
Statement
Register a Policy Statement used by states in this graph.
registerState(state)
public registerState(state: State): void
Parameters
- state
State
Register a state as part of this graph.
Called by State.bindToGraph().
registerSuperGraph(graph)
public registerSuperGraph(graph: StateGraph): void
Parameters
- graph
State
Graph
Register this graph as a child of the given graph.
Resource changes will be bubbled up to the given graph.
toGraphJson(queryLanguage?)
public toGraphJson(queryLanguage?: QueryLanguage): json
Parameters
- queryLanguage
Query
Language
Returns
json
Return the Amazon States Language JSON for this graph.
toString()
public toString(): string
Returns
string
Return a string description of this graph.