Skip to content
v2.278.0

DefinitionBody Class ​

Example ​

ts
const jsonata = sfn.Pass.jsonata(this, 'JSONata');
const jsonPath = sfn.Pass.jsonPath(this, 'JSONPath');
const definition = jsonata.next(jsonPath);

new sfn.StateMachine(this, 'MixedStateMachine', {
  // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
new sfn.StateMachine(this, 'JSONataOnlyStateMachine', {
  queryLanguage: sfn.QueryLanguage.JSONATA,
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});
python
jsonata = sfn.Pass.jsonata(self, "JSONata")
json_path = sfn.Pass.json_path(self, "JSONPath")
definition = jsonata.next(json_path)

sfn.StateMachine(self, "MixedStateMachine",
    # queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
    definition_body=sfn.DefinitionBody.from_chainable(definition)
)

# This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
sfn.StateMachine(self, "JSONataOnlyStateMachine",
    query_language=sfn.QueryLanguage.JSONATA,
    definition_body=sfn.DefinitionBody.from_chainable(definition)
)
java
Pass jsonata = Pass.jsonata(this, "JSONata");
Pass jsonPath = Pass.jsonPath(this, "JSONPath");
Chain definition = jsonata.next(jsonPath);

StateMachine.Builder.create(this, "MixedStateMachine")
        // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
        .definitionBody(DefinitionBody.fromChainable(definition))
        .build();

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
StateMachine.Builder.create(this, "JSONataOnlyStateMachine")
        .queryLanguage(QueryLanguage.JSONATA)
        .definitionBody(DefinitionBody.fromChainable(definition))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var jsonata = Pass.Jsonata(this, "JSONata");
var jsonPath = Pass.JsonPath(this, "JSONPath");
var definition = jsonata.Next(jsonPath);

new StateMachine(this, "MixedStateMachine", new StateMachineProps {
    // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
    DefinitionBody = DefinitionBody.FromChainable(definition)
});

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
new StateMachine(this, "JSONataOnlyStateMachine", new StateMachineProps {
    QueryLanguage = QueryLanguage.JSONATA,
    DefinitionBody = DefinitionBody.FromChainable(definition)
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
jsonata := sfn.Pass_Jsonata(this, jsii.String("JSONata"))
jsonPath := sfn.Pass_JsonPath(this, jsii.String("JSONPath"))
definition := jsonata.Next(jsonPath)

sfn.NewStateMachine(this, jsii.String("MixedStateMachine"), &StateMachineProps{
	// queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
	DefinitionBody: sfn.DefinitionBody_FromChainable(definition),
})

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
sfn.NewStateMachine(this, jsii.String("JSONataOnlyStateMachine"), &StateMachineProps{
	QueryLanguage: sfn.QueryLanguage_JSONATA,
	DefinitionBody: sfn.DefinitionBody_*FromChainable(definition),
})

Initializer ​

ts
new DefinitionBody()
python
DefinitionBody()
java
new DefinitionBody()
csharp
new DefinitionBody()
go
NewDefinitionBody()

Methods ​

bind(scope: Construct, sfnPrincipal: IPrincipal, sfnProps: StateMachineProps, graph?: StateGraph): DefinitionConfigdef bind(self, scope: Construct, sfn_principal: IPrincipal, sfn_props: StateMachineProps, graph: typing.Optional[StateGraph] = None) -> DefinitionConfigpublic DefinitionConfig bind(Construct scope, IPrincipal sfnPrincipal, StateMachineProps sfnProps, StateGraph graph)public DefinitionConfig Bind(Construct scope, IPrincipal sfnPrincipal, StateMachineProps sfnProps, StateGraph? graph = null)func Bind(Scope Construct, SfnPrincipal IPrincipal, SfnProps StateMachineProps, Graph StateGraph) DefinitionConfig #
fromChainable(chainable: IChainable): DefinitionBody // chainable@staticmethod def from_chainable(chainable: IChainable) -> DefinitionBodypublic static DefinitionBody fromChainable(IChainable chainable)public static DefinitionBody FromChainable(IChainable chainable)func FromChainable(Chainable IChainable) DefinitionBody static #
fromFile(path: string, options?: AssetOptions): DefinitionBody // chainable@staticmethod def from_file(path: str, options: typing.Optional[AssetOptions] = None) -> DefinitionBodypublic static DefinitionBody fromFile(String path, AssetOptions options)public static DefinitionBody FromFile(string path, AssetOptions? options = null)func FromFile(Path *string, Options AssetOptions) DefinitionBody static #
fromString(definition: string): DefinitionBody // chainable@staticmethod def from_string(definition: str) -> DefinitionBodypublic static DefinitionBody fromString(String definition)public static DefinitionBody FromString(string definition)func FromString(Definition *string) DefinitionBody static #