cancelPipelineExecution method

Future<CancelPipelineExecutionResponse> cancelPipelineExecution({
  1. required String pipelineExecutionId,
  2. required String pipelineName,
  3. required String workspaceName,
  4. String? reason,
})

Cancels a pipeline execution in the specified workspace. If the execution is not in a terminal state (such as NOT_STARTED or RUNNING), it transitions to CANCELLING and asynchronously to CANCELLED. This operation is idempotent: calling it on an execution that is already CANCELLING or CANCELLED returns success with the current state. Calling it on a terminal execution (SUCCEEDED or FAILED) returns a conflict error. You can optionally provide a reason; it is returned in the stateDetails field when you describe the execution.

May throw AccessDeniedException. May throw ConflictingOperationException. May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter pipelineExecutionId : The unique identifier of the pipeline execution.

Parameter pipelineName : The name of the pipeline.

Parameter workspaceName : The name of the workspace.

Parameter reason : A message describing why the pipeline execution is being cancelled.

Implementation

Future<CancelPipelineExecutionResponse> cancelPipelineExecution({
  required String pipelineExecutionId,
  required String pipelineName,
  required String workspaceName,
  String? reason,
}) async {
  final $payload = <String, dynamic>{
    if (reason != null) 'reason': reason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceName)}/pipelines/${Uri.encodeComponent(pipelineName)}/executions/${Uri.encodeComponent(pipelineExecutionId)}/cancel',
    hostPrefix: 'data.',
    exceptionFnMap: _exceptionFns,
  );
  return CancelPipelineExecutionResponse.fromJson(response);
}