createFlowDefinition method

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

Creates a flow definition.

May throw ResourceLimitExceeded. May throw ResourceInUse.

Parameter flowDefinitionName : The name of your flow definition.

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

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 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 HumanLoopConfig humanLoopConfig,
  required FlowDefinitionOutputConfig outputConfig,
  required String roleArn,
  HumanLoopActivationConfig? humanLoopActivationConfig,
  HumanLoopRequestSource? humanLoopRequestSource,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(flowDefinitionName, 'flowDefinitionName');
  _s.validateStringLength(
    'flowDefinitionName',
    flowDefinitionName,
    1,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(humanLoopConfig, 'humanLoopConfig');
  ArgumentError.checkNotNull(outputConfig, 'outputConfig');
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  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,
      'HumanLoopConfig': humanLoopConfig,
      'OutputConfig': outputConfig,
      'RoleArn': roleArn,
      if (humanLoopActivationConfig != null)
        'HumanLoopActivationConfig': humanLoopActivationConfig,
      if (humanLoopRequestSource != null)
        'HumanLoopRequestSource': humanLoopRequestSource,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateFlowDefinitionResponse.fromJson(jsonResponse.body);
}