respondDecisionTaskCompleted method

Future<void> respondDecisionTaskCompleted({
  1. required String taskToken,
  2. List<Decision>? decisions,
  3. String? executionContext,
})

Used by deciders to tell the service that the DecisionTask identified by the taskToken has successfully completed. The decisions argument specifies the list of decisions made while processing the task.

A DecisionTaskCompleted event is added to the workflow history. The executionContext specified is attached to the event in the workflow execution history.

Access Control

If an IAM policy grants permission to use RespondDecisionTaskCompleted, it can express permissions for the list of decisions in the decisions parameter. Each of the decisions has one or more parameters, much like a regular API call. To allow for policies to be as readable as possible, you can express permissions on decisions as if they were actual API calls, including applying conditions to some parameters. For more information, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.

May throw UnknownResourceFault. May throw OperationNotPermittedFault.

Parameter taskToken : The taskToken from the DecisionTask.

Parameter decisions : The list of decisions (possibly empty) made by the decider while processing this decision task. See the docs for the Decision structure for details.

Parameter executionContext : User defined context to add to workflow execution.

Implementation

Future<void> respondDecisionTaskCompleted({
  required String taskToken,
  List<Decision>? decisions,
  String? executionContext,
}) async {
  ArgumentError.checkNotNull(taskToken, 'taskToken');
  _s.validateStringLength(
    'taskToken',
    taskToken,
    1,
    1024,
    isRequired: true,
  );
  _s.validateStringLength(
    'executionContext',
    executionContext,
    0,
    32768,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'SimpleWorkflowService.RespondDecisionTaskCompleted'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'taskToken': taskToken,
      if (decisions != null) 'decisions': decisions,
      if (executionContext != null) 'executionContext': executionContext,
    },
  );
}