startSyncExecution method

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

Starts a Synchronous Express state machine execution.

May throw InvalidArn. May throw InvalidExecutionInput. May throw InvalidName. May throw StateMachineDoesNotExist. May throw StateMachineDeleting. May throw StateMachineTypeNotSupported.

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.

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

Implementation

Future<StartSyncExecutionOutput> startSyncExecution({
  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.StartSyncExecution'
  };
  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 StartSyncExecutionOutput.fromJson(jsonResponse.body);
}