Skip to content

start_sync_execution async

start_sync_execution(
    state_machine_arn: Arn,
    *,
    config_overrides: Optional[AsyncSFNClientConfig] = None,
    name: Optional[Name] = None,
    input: Optional[SensitiveData] = None,
    trace_header: Optional[TraceHeader] = None,
    included_data: Optional[IncludedData] = None,
) -> StartSyncExecutionOutput

Starts a Synchronous Express state machine execution. StartSyncExecution is not available for STANDARD workflows.

StartSyncExecution will return a 200 OK response, even if your execution fails, because the status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your execution from running, such as permissions errors, limit errors, or issues with your state machine code and configuration.

Parameters:

  • state_machine_arn (Arn) –

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

  • name (Optional[Name], default: None ) –

    The name of the execution.

  • input (Optional[SensitiveData], default: None ) –

    The string that contains the JSON input data for the execution, for example:

    "{\"first_name\" : \"Alejandro\"}"

    If you don't include any JSON input data, you still must include the two braces, for example: "{}"

    Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

  • trace_header (Optional[TraceHeader], default: None ) –

    Passes the X-Ray trace header. The trace header can also be passed in the request payload.

    For X-Ray traces, all Amazon Web Services services use the X-Amzn-Trace-Id header from the HTTP request. Using the header is the preferred mechanism to identify a trace. StartExecution and StartSyncExecution API operations can also use traceHeader from the body of the request payload. If both sources are provided, Step Functions will use the header value (preferred) over the value in the request body.

  • included_data (Optional[IncludedData], default: None ) –

    If your state machine definition is encrypted with a KMS key, callers must have kms:Decrypt permission to decrypt the definition. Alternatively, you can call the API with includedData = METADATA_ONLY to get a successful response without the encrypted definition.

Raises:

Source code in docs_src/capo_sfn/_services/async_sfn.py
async def start_sync_execution(
    self,
    state_machine_arn: "capo_sfn.types.arn.Arn",
    *,
    config_overrides: Optional[AsyncSFNClientConfig] = None,
    name: Optional["capo_sfn.types.name.Name"] = None,
    input: Optional["capo_sfn.types.sensitive_data.SensitiveData"] = None,
    trace_header: Optional["capo_sfn.types.trace_header.TraceHeader"] = None,
    included_data: Optional["capo_sfn.types.included_data.IncludedData"] = None,
) -> "capo_sfn.types.start_sync_execution_output.StartSyncExecutionOutput":
    r"""<p>Starts a Synchronous Express state machine execution. <code>StartSyncExecution</code> is not available for <code>STANDARD</code> workflows.</p> <note> <p> <code>StartSyncExecution</code> will return a <code>200 OK</code> response, even if your execution fails, because the status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your execution from running, such as permissions errors, limit errors, or issues with your state machine code and configuration. </p> </note>

    Args:
        state_machine_arn: <p>The Amazon Resource Name (ARN) of the state machine to execute.</p>
        name: <p>The name of the execution.</p>
        input: <p>The string that contains the JSON input data for the execution, for example:</p> <p> <code>"{\"first_name\" : \"Alejandro\"}"</code> </p> <note> <p>If you don't include any JSON input data, you still must include the two braces, for example: <code>"{}"</code> </p> </note> <p>Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.</p>
        trace_header: <p>Passes the X-Ray trace header. The trace header can also be passed in the request payload.</p> <note> <p> For X-Ray traces, all Amazon Web Services services use the <code>X-Amzn-Trace-Id</code> header from the HTTP request. Using the header is the preferred mechanism to identify a trace. <code>StartExecution</code> and <code>StartSyncExecution</code> API operations can also use <code>traceHeader</code> from the body of the request payload. If <b>both</b> sources are provided, Step Functions will use the <b>header value</b> (preferred) over the value in the request body. </p> </note>
        included_data: <p>If your state machine definition is encrypted with a KMS key, callers must have <code>kms:Decrypt</code> permission to decrypt the definition. Alternatively, you can call the API with <code>includedData = METADATA_ONLY</code> to get a successful response without the encrypted definition.</p>

    Raises:
        capo_sfn.errors.invalid_arn.InvalidArn: <p>The provided Amazon Resource Name (ARN) is not valid.</p>
        capo_sfn.errors.invalid_execution_input.InvalidExecutionInput: <p>The provided JSON input data is not valid.</p>
        capo_sfn.errors.invalid_name.InvalidName: <p>The provided name 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.state_machine_deleting.StateMachineDeleting: <p>The specified state machine is being deleted.</p>
        capo_sfn.errors.state_machine_does_not_exist.StateMachineDoesNotExist: <p>The specified state machine does not exist.</p>
        capo_sfn.errors.state_machine_type_not_supported.StateMachineTypeNotSupported: <p>State machine type is not supported.</p>
        capo_sfn.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sfn.types.start_sync_execution_input.StartSyncExecutionInput]",
    ) -> AsyncOperationResponse[
        "capo_sfn.types.start_sync_execution_output.StartSyncExecutionOutput"
    ]:
        import capo_sfn._operations.aws_step_functions.start_sync_execution

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

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

        return capo_sfn.types.start_sync_execution_input.redact_sensitive(input_)

    def _redact_output(
        output: "capo_sfn.types.start_sync_execution_output.StartSyncExecutionOutput",
    ) -> dict[str, Any]:
        import capo_sfn.types.start_sync_execution_output

        return capo_sfn.types.start_sync_execution_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "StartSyncExecution",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_sfn.types.start_sync_execution_input.StartSyncExecutionInput = {
        "state_machine_arn": state_machine_arn
    }
    if name is not None:
        input_["name"] = name
    if input is not None:
        input_["input"] = input
    if trace_header is not None:
        input_["trace_header"] = trace_header
    if included_data is not None:
        input_["included_data"] = included_data

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