Skip to content

stop_execution

stop_execution(
    execution_arn: Arn,
    *,
    config_overrides: Optional[SFNClientConfig] = None,
    error: Optional[SensitiveError] = None,
    cause: Optional[SensitiveCause] = None,
) -> StopExecutionOutput

Stops an execution.

This API action is not supported by EXPRESS state machines.

For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role.

A caller can stop an execution without using any KMS permissions in the execution role if the caller provides a null value for both error and cause fields because no data needs to be encrypted.

Parameters:

  • execution_arn (Arn) –

    The Amazon Resource Name (ARN) of the execution to stop.

  • error (Optional[SensitiveError], default: None ) –

    The error code of the failure.

  • cause (Optional[SensitiveCause], default: None ) –

    A more detailed explanation of the cause of the failure.

Raises:

Source code in docs_src/capo_sfn/_services/sfn.py
def stop_execution(
    self,
    execution_arn: "capo_sfn.types.arn.Arn",
    *,
    config_overrides: Optional[SFNClientConfig] = None,
    error: Optional["capo_sfn.types.sensitive_error.SensitiveError"] = None,
    cause: Optional["capo_sfn.types.sensitive_cause.SensitiveCause"] = None,
) -> "capo_sfn.types.stop_execution_output.StopExecutionOutput":
    """<p>Stops an execution.</p> <p>This API action is not supported by <code>EXPRESS</code> state machines.</p> <p>For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role.</p> <p>A caller can stop an execution without using any KMS permissions in the execution role if the caller provides a null value for both <code>error</code> and <code>cause</code> fields because no data needs to be encrypted.</p>

    Args:
        execution_arn: <p>The Amazon Resource Name (ARN) of the execution to stop.</p>
        error: <p>The error code of the failure.</p>
        cause: <p>A more detailed explanation of the cause of the failure.</p>

    Raises:
        capo_sfn.errors.execution_does_not_exist.ExecutionDoesNotExist: <p>The specified execution does not exist.</p>
        capo_sfn.errors.invalid_arn.InvalidArn: <p>The provided Amazon Resource Name (ARN) is not valid.</p>
        capo_sfn.errors.kms_access_denied_exception.KmsAccessDeniedException: <p>Either your KMS key policy or API caller does not have the required permissions.</p>
        capo_sfn.errors.kms_invalid_state_exception.KmsInvalidStateException: <p>The KMS key is not in valid state, for example: Disabled or Deleted.</p>
        capo_sfn.errors.kms_throttling_exception.KmsThrottlingException: <p>Received when KMS returns <code>ThrottlingException</code> for a KMS call that Step Functions makes on behalf of the caller.</p>
        capo_sfn.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_sfn.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sfn.types.stop_execution_input.StopExecutionInput]",
    ) -> OperationResponse[
        "capo_sfn.types.stop_execution_output.StopExecutionOutput"
    ]:
        import capo_sfn._operations.aws_step_functions.stop_execution

        output, http_response = (
            capo_sfn._operations.aws_step_functions.stop_execution.stop_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sfn.types.stop_execution_input.StopExecutionInput",
    ) -> dict[str, Any]:
        import capo_sfn.types.stop_execution_input

        return capo_sfn.types.stop_execution_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StopExecution", redact_input=_redact_input),
    )
    input_: capo_sfn.types.stop_execution_input.StopExecutionInput = {
        "execution_arn": execution_arn
    }
    if error is not None:
        input_["error"] = error
    if cause is not None:
        input_["cause"] = cause

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output