updateStateMachine method

Future<UpdateStateMachineOutput> updateStateMachine({
  1. required String stateMachineArn,
  2. String? definition,
  3. LoggingConfiguration? loggingConfiguration,
  4. String? roleArn,
  5. TracingConfiguration? tracingConfiguration,
})

Updates an existing state machine by modifying its definition, roleArn, or loggingConfiguration. Running executions will continue to use the previous definition and roleArn. You must include at least one of definition or roleArn or you will receive a MissingRequiredParameter error.

May throw InvalidArn. May throw InvalidDefinition. May throw InvalidLoggingConfiguration. May throw InvalidTracingConfiguration. May throw MissingRequiredParameter. May throw StateMachineDeleting. May throw StateMachineDoesNotExist.

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

Parameter definition : The Amazon States Language definition of the state machine. See Amazon States Language.

Parameter loggingConfiguration : The LoggingConfiguration data type is used to set CloudWatch Logs options.

Parameter roleArn : The Amazon Resource Name (ARN) of the IAM role of the state machine.

Parameter tracingConfiguration : Selects whether AWS X-Ray tracing is enabled.

Implementation

Future<UpdateStateMachineOutput> updateStateMachine({
  required String stateMachineArn,
  String? definition,
  LoggingConfiguration? loggingConfiguration,
  String? roleArn,
  TracingConfiguration? tracingConfiguration,
}) async {
  ArgumentError.checkNotNull(stateMachineArn, 'stateMachineArn');
  _s.validateStringLength(
    'stateMachineArn',
    stateMachineArn,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'definition',
    definition,
    1,
    1048576,
  );
  _s.validateStringLength(
    'roleArn',
    roleArn,
    1,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSStepFunctions.UpdateStateMachine'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'stateMachineArn': stateMachineArn,
      if (definition != null) 'definition': definition,
      if (loggingConfiguration != null)
        'loggingConfiguration': loggingConfiguration,
      if (roleArn != null) 'roleArn': roleArn,
      if (tracingConfiguration != null)
        'tracingConfiguration': tracingConfiguration,
    },
  );

  return UpdateStateMachineOutput.fromJson(jsonResponse.body);
}