stopPipelineExecution method

Future<StopPipelineExecutionOutput> stopPipelineExecution({
  1. required String pipelineExecutionId,
  2. required String pipelineName,
  3. bool? abandon,
  4. String? reason,
})

Stops the specified pipeline execution. You choose to either stop the pipeline execution by completing in-progress actions without starting subsequent actions, or by abandoning in-progress actions. While completing or abandoning in-progress actions, the pipeline execution is in a Stopping state. After all in-progress actions are completed or abandoned, the pipeline execution is in a Stopped state.

May throw ValidationException. May throw ConflictException. May throw PipelineNotFoundException. May throw PipelineExecutionNotStoppableException. May throw DuplicatedStopRequestException.

Parameter pipelineExecutionId : The ID of the pipeline execution to be stopped in the current stage. Use the GetPipelineState action to retrieve the current pipelineExecutionId.

Parameter pipelineName : The name of the pipeline to stop.

Parameter abandon : Use this option to stop the pipeline execution by abandoning, rather than finishing, in-progress actions.

Parameter reason : Use this option to enter comments, such as the reason the pipeline was stopped.

Implementation

Future<StopPipelineExecutionOutput> stopPipelineExecution({
  required String pipelineExecutionId,
  required String pipelineName,
  bool? abandon,
  String? reason,
}) async {
  ArgumentError.checkNotNull(pipelineExecutionId, 'pipelineExecutionId');
  ArgumentError.checkNotNull(pipelineName, 'pipelineName');
  _s.validateStringLength(
    'pipelineName',
    pipelineName,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'reason',
    reason,
    0,
    200,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodePipeline_20150709.StopPipelineExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'pipelineExecutionId': pipelineExecutionId,
      'pipelineName': pipelineName,
      if (abandon != null) 'abandon': abandon,
      if (reason != null) 'reason': reason,
    },
  );

  return StopPipelineExecutionOutput.fromJson(jsonResponse.body);
}