updateWorkflow method

Future<UpdateWorkflowResponse> updateWorkflow({
  1. required DefinitionS3Location definitionS3Location,
  2. required String roleArn,
  3. required String workflowArn,
  4. String? description,
  5. int? engineVersion,
  6. LoggingConfiguration? loggingConfiguration,
  7. NetworkConfiguration? networkConfiguration,
  8. String? triggerMode,
})

Updates an existing workflow with new configuration settings. This operation allows you to modify the workflow definition, role, and other settings. When you update a workflow, Amazon Managed Workflows for Apache Airflow Serverless automatically creates a new version with the updated configuration and disables scheduling on all previous versions to ensure only one version is actively scheduled at a time. The update operation maintains workflow history while providing a clean transition to the new configuration.

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

Parameter definitionS3Location : The Amazon S3 location where the updated workflow definition file is stored.

Parameter roleArn : The Amazon Resource Name (ARN) of the IAM role that Amazon Managed Workflows for Apache Airflow Serverless assumes when it executes the updated workflow.

Parameter workflowArn : The Amazon Resource Name (ARN) of the workflow you want to update.

Parameter description : An updated description for the workflow.

Parameter engineVersion : The version of the Amazon Managed Workflows for Apache Airflow Serverless engine that you want to use for the updated workflow.

Parameter loggingConfiguration : Updated logging configuration for the workflow.

Parameter networkConfiguration : Updated network configuration for the workflow execution environment.

Parameter triggerMode : The trigger mode for the workflow execution.

Implementation

Future<UpdateWorkflowResponse> updateWorkflow({
  required DefinitionS3Location definitionS3Location,
  required String roleArn,
  required String workflowArn,
  String? description,
  int? engineVersion,
  LoggingConfiguration? loggingConfiguration,
  NetworkConfiguration? networkConfiguration,
  String? triggerMode,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonMWAAServerless.UpdateWorkflow'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DefinitionS3Location': definitionS3Location,
      'RoleArn': roleArn,
      'WorkflowArn': workflowArn,
      if (description != null) 'Description': description,
      if (engineVersion != null) 'EngineVersion': engineVersion,
      if (loggingConfiguration != null)
        'LoggingConfiguration': loggingConfiguration,
      if (networkConfiguration != null)
        'NetworkConfiguration': networkConfiguration,
      if (triggerMode != null) 'TriggerMode': triggerMode,
    },
  );

  return UpdateWorkflowResponse.fromJson(jsonResponse.body);
}