startExecution method
Starts a state machine execution.
May throw ExecutionLimitExceeded. May throw ExecutionAlreadyExists. May throw InvalidArn. May throw InvalidExecutionInput. May throw InvalidName. May throw StateMachineDoesNotExist. May throw StateMachineDeleting.
Parameter stateMachineArn
:
The Amazon Resource Name (ARN) of the state machine to execute.
Parameter input
:
The string that contains the JSON input data for the execution, for
example:
"input": "{"first_name" : "test"}"
Length constraints apply to the payload size, and are expressed as bytes
in UTF-8 encoding.
Parameter name
:
The name of the execution. This name must be unique for your AWS account,
region, and state machine for 90 days. For more information, see
Limits Related to State Machine Executions in the AWS Step
Functions Developer Guide.
A name must not contain:
- white space
-
brackets
< > { } [ ]
-
wildcard characters
? *
-
special characters
" # % \ ^ | ~ ` $ & , ; : /
-
control characters (
U+0000-001F
,U+007F-009F
)
Parameter traceHeader
:
Passes the AWS X-Ray trace header. The trace header can also be passed in
the request payload.
Implementation
Future<StartExecutionOutput> startExecution({
required String stateMachineArn,
String? input,
String? name,
String? traceHeader,
}) async {
ArgumentError.checkNotNull(stateMachineArn, 'stateMachineArn');
_s.validateStringLength(
'stateMachineArn',
stateMachineArn,
1,
256,
isRequired: true,
);
_s.validateStringLength(
'input',
input,
0,
262144,
);
_s.validateStringLength(
'name',
name,
1,
80,
);
_s.validateStringLength(
'traceHeader',
traceHeader,
0,
256,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AWSStepFunctions.StartExecution'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'stateMachineArn': stateMachineArn,
if (input != null) 'input': input,
if (name != null) 'name': name,
if (traceHeader != null) 'traceHeader': traceHeader,
},
);
return StartExecutionOutput.fromJson(jsonResponse.body);
}