Skip to content

delete_state_machine async

delete_state_machine(
    state_machine_arn: Arn, *, config_overrides: Optional[AsyncSFNClientConfig] = None
) -> DeleteStateMachineOutput

Deletes a state machine. This is an asynchronous operation. It sets the state machine's status to DELETING and begins the deletion process. A state machine is deleted only when all its executions are completed. On the next state transition, the state machine's executions are terminated.

A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN.

The following are some examples of qualified and unqualified state machine ARNs:

  • The following qualified state machine ARN refers to a Distributed Map state with a label mapStateLabel in a state machine named myStateMachine.

    arn:partition:states:region:account-id:stateMachine:myStateMachine/mapStateLabel

    If you provide a qualified state machine ARN that refers to a Distributed Map state, the request fails with ValidationException.

  • The following unqualified state machine ARN refers to a state machine named myStateMachine.

    arn:partition:states:region:account-id:stateMachine:myStateMachine

This API action also deletes all versions and aliases associated with a state machine.

For EXPRESS state machines, the deletion happens eventually (usually in less than a minute). Running executions may emit logs after DeleteStateMachine API is called.

Parameters:

  • state_machine_arn (Arn) –

    The Amazon Resource Name (ARN) of the state machine to delete.

Raises:

  • InvalidArn –

    The provided Amazon Resource Name (ARN) is not valid.

  • ValidationException –

    The input does not satisfy the constraints specified by an Amazon Web Services service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sfn/_services/async_sfn.py
async def delete_state_machine(
    self,
    state_machine_arn: "capo_sfn.types.arn.Arn",
    *,
    config_overrides: Optional[AsyncSFNClientConfig] = None,
) -> "capo_sfn.types.delete_state_machine_output.DeleteStateMachineOutput":
    """<p>Deletes a state machine. This is an asynchronous operation. It sets the state machine's status to <code>DELETING</code> and begins the deletion process. A state machine is deleted only when all its executions are completed. On the next state transition, the state machine's executions are terminated.</p> <p>A qualified state machine ARN can either refer to a <i>Distributed Map state</i> defined within a state machine, a version ARN, or an alias ARN.</p> <p>The following are some examples of qualified and unqualified state machine ARNs:</p> <ul> <li> <p>The following qualified state machine ARN refers to a <i>Distributed Map state</i> with a label <code>mapStateLabel</code> in a state machine named <code>myStateMachine</code>.</p> <p> <code>arn:partition:states:region:account-id:stateMachine:myStateMachine/mapStateLabel</code> </p> <note> <p>If you provide a qualified state machine ARN that refers to a <i>Distributed Map state</i>, the request fails with <code>ValidationException</code>.</p> </note> </li> <li> <p>The following unqualified state machine ARN refers to a state machine named <code>myStateMachine</code>.</p> <p> <code>arn:partition:states:region:account-id:stateMachine:myStateMachine</code> </p> </li> </ul> <p>This API action also deletes all <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-version.html">versions</a> and <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-alias.html">aliases</a> associated with a state machine.</p> <note> <p>For <code>EXPRESS</code> state machines, the deletion happens eventually (usually in less than a minute). Running executions may emit logs after <code>DeleteStateMachine</code> API is called.</p> </note>

    Args:
        state_machine_arn: <p>The Amazon Resource Name (ARN) of the state machine to delete.</p>

    Raises:
        capo_sfn.errors.invalid_arn.InvalidArn: <p>The provided Amazon Resource Name (ARN) is not valid.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sfn.types.delete_state_machine_input.DeleteStateMachineInput]",
    ) -> AsyncOperationResponse[
        "capo_sfn.types.delete_state_machine_output.DeleteStateMachineOutput"
    ]:
        import capo_sfn._operations.aws_step_functions.delete_state_machine

        (
            output,
            http_response,
        ) = await capo_sfn._operations.aws_step_functions.delete_state_machine.async_delete_state_machine(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteStateMachine")
    )
    input_: capo_sfn.types.delete_state_machine_input.DeleteStateMachineInput = {
        "state_machine_arn": state_machine_arn
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output