createFlowDefinition method

Future<CreateFlowDefinitionResponse> createFlowDefinition({
  1. required String flowDefinitionName,
  2. required FlowDefinitionOutputConfig outputConfig,
  3. required String roleArn,
  4. HumanLoopActivationConfig? humanLoopActivationConfig,
  5. HumanLoopConfig? humanLoopConfig,
  6. HumanLoopRequestSource? humanLoopRequestSource,
  7. List<Tag>? tags,
})

Creates a flow definition.

May throw ResourceInUse. May throw ResourceLimitExceeded.

Parameter flowDefinitionName : The name of your flow definition.

Parameter outputConfig : An object containing information about where the human review results will be uploaded.

Parameter roleArn : The Amazon Resource Name (ARN) of the role needed to call other services on your behalf. For example, arn:aws:iam::1234567890:role/service-role/AmazonSageMaker-ExecutionRole-20180111T151298.

Parameter humanLoopActivationConfig : An object containing information about the events that trigger a human workflow.

Parameter humanLoopConfig : An object containing information about the tasks the human reviewers will perform.

Parameter humanLoopRequestSource : Container for configuring the source of human task requests. Use to specify if Amazon Rekognition or Amazon Textract is used as an integration source.

Parameter tags : An array of key-value pairs that contain metadata to help you categorize and organize a flow definition. Each tag consists of a key and a value, both of which you define.

Implementation

Future<CreateFlowDefinitionResponse> createFlowDefinition({
  required String flowDefinitionName,
  required FlowDefinitionOutputConfig outputConfig,
  required String roleArn,
  HumanLoopActivationConfig? humanLoopActivationConfig,
  HumanLoopConfig? humanLoopConfig,
  HumanLoopRequestSource? humanLoopRequestSource,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateFlowDefinition'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FlowDefinitionName': flowDefinitionName,
      'OutputConfig': outputConfig,
      'RoleArn': roleArn,
      if (humanLoopActivationConfig != null)
        'HumanLoopActivationConfig': humanLoopActivationConfig,
      if (humanLoopConfig != null) 'HumanLoopConfig': humanLoopConfig,
      if (humanLoopRequestSource != null)
        'HumanLoopRequestSource': humanLoopRequestSource,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateFlowDefinitionResponse.fromJson(jsonResponse.body);
}