createFlow method

Future<CreateFlowResponse> createFlow({
  1. required List<DestinationFlowConfig> destinationFlowConfigList,
  2. required String flowName,
  3. required SourceFlowConfig sourceFlowConfig,
  4. required List<Task> tasks,
  5. required TriggerConfig triggerConfig,
  6. String? clientToken,
  7. String? description,
  8. String? kmsArn,
  9. MetadataCatalogConfig? metadataCatalogConfig,
  10. Map<String, String>? tags,
})

Enables your application to create a new flow using Amazon AppFlow. You must create a connector profile before calling this API. Please note that the Request Syntax below shows syntax for multiple destinations, however, you can only transfer data to one item in this list at a time. Amazon AppFlow does not currently support flows to multiple destinations at once.

May throw AccessDeniedException. May throw ConflictException. May throw ConnectorAuthenticationException. May throw ConnectorServerException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter destinationFlowConfigList : The configuration that controls how Amazon AppFlow places data in the destination connector.

Parameter flowName : The specified name of the flow. Spaces are not allowed. Use underscores (_) or hyphens (-) only.

Parameter sourceFlowConfig : The configuration that controls how Amazon AppFlow retrieves data from the source connector.

Parameter tasks : A list of tasks that Amazon AppFlow performs while transferring the data in the flow run.

Parameter triggerConfig : The trigger settings that determine how and when the flow runs.

Parameter clientToken : The clientToken parameter is an idempotency token. It ensures that your CreateFlow request completes only once. You choose the value to pass. For example, if you don't receive a response from your request, you can safely retry the request with the same clientToken parameter value.

If you omit a clientToken value, the Amazon Web Services SDK that you are using inserts a value for you. This way, the SDK can safely retry requests multiple times after a network error. You must provide your own value for other use cases.

If you specify input parameters that differ from your first request, an error occurs. If you use a different value for clientToken, Amazon AppFlow considers it a new call to CreateFlow. The token is active for 8 hours.

Parameter description : A description of the flow you want to create.

Parameter kmsArn : The ARN (Amazon Resource Name) of the Key Management Service (KMS) key you provide for encryption. This is required if you do not want to use the Amazon AppFlow-managed KMS key. If you don't provide anything here, Amazon AppFlow uses the Amazon AppFlow-managed KMS key.

Parameter metadataCatalogConfig : Specifies the configuration that Amazon AppFlow uses when it catalogs the data that's transferred by the associated flow. When Amazon AppFlow catalogs the data from a flow, it stores metadata in a data catalog.

Parameter tags : The tags used to organize, track, or control access for your flow.

Implementation

Future<CreateFlowResponse> createFlow({
  required List<DestinationFlowConfig> destinationFlowConfigList,
  required String flowName,
  required SourceFlowConfig sourceFlowConfig,
  required List<Task> tasks,
  required TriggerConfig triggerConfig,
  String? clientToken,
  String? description,
  String? kmsArn,
  MetadataCatalogConfig? metadataCatalogConfig,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'destinationFlowConfigList': destinationFlowConfigList,
    'flowName': flowName,
    'sourceFlowConfig': sourceFlowConfig,
    'tasks': tasks,
    'triggerConfig': triggerConfig,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (kmsArn != null) 'kmsArn': kmsArn,
    if (metadataCatalogConfig != null)
      'metadataCatalogConfig': metadataCatalogConfig,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/create-flow',
    exceptionFnMap: _exceptionFns,
  );
  return CreateFlowResponse.fromJson(response);
}