createWorkflow method

Future<CreateWorkflowResponse> createWorkflow({
  1. required String name,
  2. Map<String, String>? defaultRunProperties,
  3. String? description,
  4. int? maxConcurrentRuns,
  5. Map<String, String>? tags,
})

Creates a new workflow.

May throw AlreadyExistsException. May throw InvalidInputException. May throw InternalServiceException. May throw OperationTimeoutException. May throw ResourceNumberLimitExceededException. May throw ConcurrentModificationException.

Parameter name : The name to be assigned to the workflow. It should be unique within your account.

Parameter defaultRunProperties : A collection of properties to be used as part of each execution of the workflow.

Parameter description : A description of the workflow.

Parameter maxConcurrentRuns : You can use this parameter to prevent unwanted multiple updates to data, to control costs, or in some cases, to prevent exceeding the maximum number of concurrent runs of any of the component jobs. If you leave this parameter blank, there is no limit to the number of concurrent workflow runs.

Parameter tags : The tags to be used with this workflow.

Implementation

Future<CreateWorkflowResponse> createWorkflow({
  required String name,
  Map<String, String>? defaultRunProperties,
  String? description,
  int? maxConcurrentRuns,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.CreateWorkflow'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (defaultRunProperties != null)
        'DefaultRunProperties': defaultRunProperties,
      if (description != null) 'Description': description,
      if (maxConcurrentRuns != null) 'MaxConcurrentRuns': maxConcurrentRuns,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateWorkflowResponse.fromJson(jsonResponse.body);
}