createWorkflowRun method

Future<CreateWorkflowRunResponse> createWorkflowRun({
  1. required ClientInfo clientInfo,
  2. required String modelId,
  3. required String workflowDefinitionName,
  4. String? clientToken,
  5. String? logGroupName,
})

Creates a new execution instance of a workflow definition with specified parameters.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter clientInfo : Information about the client making the request, including compatibility version and SDK version.

Parameter modelId : The ID of the AI model to use for workflow execution.

Parameter workflowDefinitionName : The name of the workflow definition to execute.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter logGroupName : The CloudWatch log group name for storing workflow execution logs.

Implementation

Future<CreateWorkflowRunResponse> createWorkflowRun({
  required ClientInfo clientInfo,
  required String modelId,
  required String workflowDefinitionName,
  String? clientToken,
  String? logGroupName,
}) async {
  final $payload = <String, dynamic>{
    'clientInfo': clientInfo,
    'modelId': modelId,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (logGroupName != null) 'logGroupName': logGroupName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/workflow-definitions/${Uri.encodeComponent(workflowDefinitionName)}/workflow-runs',
    exceptionFnMap: _exceptionFns,
  );
  return CreateWorkflowRunResponse.fromJson(response);
}