startSyncExecution method

Future<StartSyncExecutionOutput> startSyncExecution({
  1. required String stateMachineArn,
  2. IncludedData? includedData,
  3. String? input,
  4. String? name,
  5. String? traceHeader,
})

Starts a Synchronous Express state machine execution. StartSyncExecution is not available for STANDARD workflows.

May throw InvalidArn. May throw InvalidExecutionInput. May throw InvalidName. May throw KmsAccessDeniedException. May throw KmsInvalidStateException. May throw KmsThrottlingException. May throw StateMachineDeleting. May throw StateMachineDoesNotExist. May throw StateMachineTypeNotSupported.

Parameter stateMachineArn : The Amazon Resource Name (ARN) of the state machine to execute.

Parameter includedData : If your state machine definition is encrypted with a KMS key, callers must have kms:Decrypt permission to decrypt the definition. Alternatively, you can call the API with includedData = METADATA_ONLY to get a successful response without the encrypted definition.

Parameter input : The string that contains the JSON input data for the execution, for example:

"{"first_name" : "Alejandro"}" Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

Parameter name : The name of the execution.

Parameter traceHeader : Passes the X-Ray trace header. The trace header can also be passed in the request payload.

Implementation

Future<StartSyncExecutionOutput> startSyncExecution({
  required String stateMachineArn,
  IncludedData? includedData,
  String? input,
  String? name,
  String? traceHeader,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSStepFunctions.StartSyncExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'stateMachineArn': stateMachineArn,
      if (includedData != null) 'includedData': includedData.value,
      if (input != null) 'input': input,
      if (name != null) 'name': name,
      if (traceHeader != null) 'traceHeader': traceHeader,
    },
  );

  return StartSyncExecutionOutput.fromJson(jsonResponse.body);
}