deleteWorkflow method

Future<DeleteWorkflowResponse> deleteWorkflow({
  1. required String workflowArn,
  2. String? workflowVersion,
})

Deletes a workflow and all its versions. This operation permanently removes the workflow and cannot be undone. Amazon Managed Workflows for Apache Airflow Serverless ensures that all associated resources are properly cleaned up, including stopping any running executions, removing scheduled triggers, and cleaning up execution history. The deletion process respects the multi-tenant isolation boundaries and ensures that no residual data or configurations remain that could affect other customers or workflows.

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

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

Parameter workflowVersion : Optional. The specific version of the workflow to delete. If not specified, all versions of the workflow are deleted.

Implementation

Future<DeleteWorkflowResponse> deleteWorkflow({
  required String workflowArn,
  String? workflowVersion,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonMWAAServerless.DeleteWorkflow'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'WorkflowArn': workflowArn,
      if (workflowVersion != null) 'WorkflowVersion': workflowVersion,
    },
  );

  return DeleteWorkflowResponse.fromJson(jsonResponse.body);
}