AWS Step Functions

2024/11/22 - AWS Step Functions - 4 updated api methods

Changes  Add support for variables and JSONata in TestState, GetExecutionHistory, DescribeStateMachine, and DescribeStateMachineForExecution

DescribeStateMachine (updated) Link ¶
Changes (response)
{'variableReferences': {'string': ['string']}}

Provides information about a state machine's definition, its IAM role Amazon Resource Name (ARN), and configuration.

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

  • The following qualified state machine ARN refers to an alias named PROD. arn:<partition>:states:<region>:<account-id>:stateMachine:<myStateMachine:PROD>

  • The following unqualified state machine ARN refers to a state machine named myStateMachine. arn:<partition>:states:<region>:<account-id>:stateMachine:<myStateMachine>

This API action returns the details for a state machine version if the stateMachineArn you specify is a state machine version ARN.

See also: AWS API Documentation

Request Syntax

client.describe_state_machine(
    stateMachineArn='string',
    includedData='ALL_DATA'|'METADATA_ONLY'
)
type stateMachineArn:

string

param stateMachineArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the state machine for which you want the information.

If you specify a state machine version ARN, this API returns details about that version. The version ARN is a combination of state machine ARN and the version number separated by a colon (:). For example, stateMachineARN:1.

type includedData:

string

param includedData:

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.

rtype:

dict

returns:

Response Syntax

{
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'ACTIVE'|'DELETING',
    'definition': 'string',
    'roleArn': 'string',
    'type': 'STANDARD'|'EXPRESS',
    'creationDate': datetime(2015, 1, 1),
    'loggingConfiguration': {
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    'tracingConfiguration': {
        'enabled': True|False
    },
    'label': 'string',
    'revisionId': 'string',
    'description': 'string',
    'encryptionConfiguration': {
        'kmsKeyId': 'string',
        'kmsDataKeyReusePeriodSeconds': 123,
        'type': 'AWS_OWNED_KEY'|'CUSTOMER_MANAGED_KMS_KEY'
    },
    'variableReferences': {
        'string': [
            'string',
        ]
    }
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the state machine.

      If you specified a state machine version ARN in your request, the API returns the version ARN. The version ARN is a combination of state machine ARN and the version number separated by a colon (:). For example, stateMachineARN:1.

    • name (string) --

      The name of the state machine.

      A name must not contain:

      • white space

      • brackets < > { } [ ]

      • wildcard characters ? *

      • special characters " # % \ ^ | ~ ` $ & , ; : /

      • control characters ( U+0000-001F, U+007F-009F)

      To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

    • status (string) --

      The current status of the state machine.

    • definition (string) --

      The Amazon States Language definition of the state machine. See Amazon States Language.

      If called with includedData = METADATA_ONLY, the returned definition will be {}.

    • roleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role used when creating this state machine. (The IAM role maintains security by granting Step Functions access to Amazon Web Services resources.)

    • type (string) --

      The type of the state machine ( STANDARD or EXPRESS).

    • creationDate (datetime) --

      The date the state machine is created.

      For a state machine version, creationDate is the date the version was created.

    • loggingConfiguration (dict) --

      The LoggingConfiguration data type is used to set CloudWatch Logs options.

      • level (string) --

        Defines which category of execution history events are logged.

      • includeExecutionData (boolean) --

        Determines whether execution data is included in your log. When set to false, data is excluded.

      • destinations (list) --

        An array of objects that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF.

        • (dict) --

          • cloudWatchLogsLogGroup (dict) --

            An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the CloudFormation User Guide.

            • logGroupArn (string) --

              The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

    • tracingConfiguration (dict) --

      Selects whether X-Ray tracing is enabled.

      • enabled (boolean) --

        When set to true, X-Ray tracing is enabled.

    • label (string) --

      A user-defined or an auto-generated string that identifies a Map state. This parameter is present only if the stateMachineArn specified in input is a qualified state machine ARN.

    • revisionId (string) --

      The revision identifier for the state machine.

      Use the revisionId parameter to compare between versions of a state machine configuration used for executions without performing a diff of the properties, such as definition and roleArn.

    • description (string) --

      The description of the state machine version.

    • encryptionConfiguration (dict) --

      Settings to configure server-side encryption.

      • kmsKeyId (string) --

        An alias, alias ARN, key ID, or key ARN of a symmetric encryption KMS key to encrypt data. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

      • kmsDataKeyReusePeriodSeconds (integer) --

        Maximum duration that Step Functions will reuse data keys. When the period expires, Step Functions will call GenerateDataKey. Only applies to customer managed keys.

      • type (string) --

        Encryption type

    • variableReferences (dict) --

      A map of state name to a list of variables referenced by that state. States that do not use variable references will not be shown in the response.

      • (string) --

        • (list) --

          • (string) --

DescribeStateMachineForExecution (updated) Link ¶
Changes (response)
{'variableReferences': {'string': ['string']}}

Provides information about a state machine's definition, its execution role ARN, and configuration. If a Map Run dispatched the execution, this action returns the Map Run Amazon Resource Name (ARN) in the response. The state machine returned is the state machine associated with the Map Run.

This API action is not supported by EXPRESS state machines.

See also: AWS API Documentation

Request Syntax

client.describe_state_machine_for_execution(
    executionArn='string',
    includedData='ALL_DATA'|'METADATA_ONLY'
)
type executionArn:

string

param executionArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the execution you want state machine information for.

type includedData:

string

param includedData:

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.

rtype:

dict

returns:

Response Syntax

{
    'stateMachineArn': 'string',
    'name': 'string',
    'definition': 'string',
    'roleArn': 'string',
    'updateDate': datetime(2015, 1, 1),
    'loggingConfiguration': {
        'level': 'ALL'|'ERROR'|'FATAL'|'OFF',
        'includeExecutionData': True|False,
        'destinations': [
            {
                'cloudWatchLogsLogGroup': {
                    'logGroupArn': 'string'
                }
            },
        ]
    },
    'tracingConfiguration': {
        'enabled': True|False
    },
    'mapRunArn': 'string',
    'label': 'string',
    'revisionId': 'string',
    'encryptionConfiguration': {
        'kmsKeyId': 'string',
        'kmsDataKeyReusePeriodSeconds': 123,
        'type': 'AWS_OWNED_KEY'|'CUSTOMER_MANAGED_KMS_KEY'
    },
    'variableReferences': {
        'string': [
            'string',
        ]
    }
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) of the state machine associated with the execution.

    • name (string) --

      The name of the state machine associated with the execution.

    • definition (string) --

      The Amazon States Language definition of the state machine. See Amazon States Language.

    • roleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role of the State Machine for the execution.

    • updateDate (datetime) --

      The date and time the state machine associated with an execution was updated. For a newly created state machine, this is the creation date.

    • loggingConfiguration (dict) --

      The LoggingConfiguration data type is used to set CloudWatch Logs options.

      • level (string) --

        Defines which category of execution history events are logged.

      • includeExecutionData (boolean) --

        Determines whether execution data is included in your log. When set to false, data is excluded.

      • destinations (list) --

        An array of objects that describes where your execution history events will be logged. Limited to size 1. Required, if your log level is not set to OFF.

        • (dict) --

          • cloudWatchLogsLogGroup (dict) --

            An object describing a CloudWatch log group. For more information, see AWS::Logs::LogGroup in the CloudFormation User Guide.

            • logGroupArn (string) --

              The ARN of the the CloudWatch log group to which you want your logs emitted to. The ARN must end with :*

    • tracingConfiguration (dict) --

      Selects whether X-Ray tracing is enabled.

      • enabled (boolean) --

        When set to true, X-Ray tracing is enabled.

    • mapRunArn (string) --

      The Amazon Resource Name (ARN) of the Map Run that started the child workflow execution. This field is returned only if the executionArn is a child workflow execution that was started by a Distributed Map state.

    • label (string) --

      A user-defined or an auto-generated string that identifies a Map state. This field is returned only if the executionArn is a child workflow execution that was started by a Distributed Map state.

    • revisionId (string) --

      The revision identifier for the state machine. The first revision ID when you create the state machine is null.

      Use the state machine revisionId parameter to compare the revision of a state machine with the configuration of the state machine used for executions without performing a diff of the properties, such as definition and roleArn.

    • encryptionConfiguration (dict) --

      Settings to configure server-side encryption.

      • kmsKeyId (string) --

        An alias, alias ARN, key ID, or key ARN of a symmetric encryption KMS key to encrypt data. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

      • kmsDataKeyReusePeriodSeconds (integer) --

        Maximum duration that Step Functions will reuse data keys. When the period expires, Step Functions will call GenerateDataKey. Only applies to customer managed keys.

      • type (string) --

        Encryption type

    • variableReferences (dict) --

      A map of state name to a list of variables referenced by that state. States that do not use variable references will not be shown in the response.

      • (string) --

        • (list) --

          • (string) --

GetExecutionHistory (updated) Link ¶
Changes (response)
{'events': {'evaluationFailedEventDetails': {'cause': 'string',
                                             'error': 'string',
                                             'location': 'string',
                                             'state': 'string'},
            'stateExitedEventDetails': {'assignedVariables': {'string': 'string'},
                                        'assignedVariablesDetails': {'truncated': 'boolean'}},
            'type': {'EvaluationFailed'}}}

Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the timeStamp of the events. Use the reverseOrder parameter to get the latest events first.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

This API action is not supported by EXPRESS state machines.

See also: AWS API Documentation

Request Syntax

client.get_execution_history(
    executionArn='string',
    maxResults=123,
    reverseOrder=True|False,
    nextToken='string',
    includeExecutionData=True|False
)
type executionArn:

string

param executionArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the execution.

type maxResults:

integer

param maxResults:

The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

type reverseOrder:

boolean

param reverseOrder:

Lists events in descending order of their timeStamp.

type nextToken:

string

param nextToken:

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

type includeExecutionData:

boolean

param includeExecutionData:

You can select whether execution data (input or output of a history event) is returned. The default is true.

rtype:

dict

returns:

Response Syntax

{
    'events': [
        {
            'timestamp': datetime(2015, 1, 1),
            'type': 'ActivityFailed'|'ActivityScheduled'|'ActivityScheduleFailed'|'ActivityStarted'|'ActivitySucceeded'|'ActivityTimedOut'|'ChoiceStateEntered'|'ChoiceStateExited'|'ExecutionAborted'|'ExecutionFailed'|'ExecutionStarted'|'ExecutionSucceeded'|'ExecutionTimedOut'|'FailStateEntered'|'LambdaFunctionFailed'|'LambdaFunctionScheduled'|'LambdaFunctionScheduleFailed'|'LambdaFunctionStarted'|'LambdaFunctionStartFailed'|'LambdaFunctionSucceeded'|'LambdaFunctionTimedOut'|'MapIterationAborted'|'MapIterationFailed'|'MapIterationStarted'|'MapIterationSucceeded'|'MapStateAborted'|'MapStateEntered'|'MapStateExited'|'MapStateFailed'|'MapStateStarted'|'MapStateSucceeded'|'ParallelStateAborted'|'ParallelStateEntered'|'ParallelStateExited'|'ParallelStateFailed'|'ParallelStateStarted'|'ParallelStateSucceeded'|'PassStateEntered'|'PassStateExited'|'SucceedStateEntered'|'SucceedStateExited'|'TaskFailed'|'TaskScheduled'|'TaskStarted'|'TaskStartFailed'|'TaskStateAborted'|'TaskStateEntered'|'TaskStateExited'|'TaskSubmitFailed'|'TaskSubmitted'|'TaskSucceeded'|'TaskTimedOut'|'WaitStateAborted'|'WaitStateEntered'|'WaitStateExited'|'MapRunAborted'|'MapRunFailed'|'MapRunStarted'|'MapRunSucceeded'|'ExecutionRedriven'|'MapRunRedriven'|'EvaluationFailed',
            'id': 123,
            'previousEventId': 123,
            'activityFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'inputDetails': {
                    'truncated': True|False
                },
                'timeoutInSeconds': 123,
                'heartbeatInSeconds': 123
            },
            'activityStartedEventDetails': {
                'workerName': 'string'
            },
            'activitySucceededEventDetails': {
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                }
            },
            'activityTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'taskFailedEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'error': 'string',
                'cause': 'string'
            },
            'taskScheduledEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'region': 'string',
                'parameters': 'string',
                'timeoutInSeconds': 123,
                'heartbeatInSeconds': 123,
                'taskCredentials': {
                    'roleArn': 'string'
                }
            },
            'taskStartFailedEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'error': 'string',
                'cause': 'string'
            },
            'taskStartedEventDetails': {
                'resourceType': 'string',
                'resource': 'string'
            },
            'taskSubmitFailedEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'error': 'string',
                'cause': 'string'
            },
            'taskSubmittedEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                }
            },
            'taskSucceededEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                }
            },
            'taskTimedOutEventDetails': {
                'resourceType': 'string',
                'resource': 'string',
                'error': 'string',
                'cause': 'string'
            },
            'executionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionStartedEventDetails': {
                'input': 'string',
                'inputDetails': {
                    'truncated': True|False
                },
                'roleArn': 'string',
                'stateMachineAliasArn': 'string',
                'stateMachineVersionArn': 'string'
            },
            'executionSucceededEventDetails': {
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                }
            },
            'executionAbortedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionRedrivenEventDetails': {
                'redriveCount': 123
            },
            'mapStateStartedEventDetails': {
                'length': 123
            },
            'mapIterationStartedEventDetails': {
                'name': 'string',
                'index': 123
            },
            'mapIterationSucceededEventDetails': {
                'name': 'string',
                'index': 123
            },
            'mapIterationFailedEventDetails': {
                'name': 'string',
                'index': 123
            },
            'mapIterationAbortedEventDetails': {
                'name': 'string',
                'index': 123
            },
            'lambdaFunctionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'inputDetails': {
                    'truncated': True|False
                },
                'timeoutInSeconds': 123,
                'taskCredentials': {
                    'roleArn': 'string'
                }
            },
            'lambdaFunctionStartFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionSucceededEventDetails': {
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                }
            },
            'lambdaFunctionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'stateEnteredEventDetails': {
                'name': 'string',
                'input': 'string',
                'inputDetails': {
                    'truncated': True|False
                }
            },
            'stateExitedEventDetails': {
                'name': 'string',
                'output': 'string',
                'outputDetails': {
                    'truncated': True|False
                },
                'assignedVariables': {
                    'string': 'string'
                },
                'assignedVariablesDetails': {
                    'truncated': True|False
                }
            },
            'mapRunStartedEventDetails': {
                'mapRunArn': 'string'
            },
            'mapRunFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'mapRunRedrivenEventDetails': {
                'mapRunArn': 'string',
                'redriveCount': 123
            },
            'evaluationFailedEventDetails': {
                'error': 'string',
                'cause': 'string',
                'location': 'string',
                'state': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • events (list) --

      The list of events that occurred in the execution.

      • (dict) --

        Contains details about the events of an execution.

        • timestamp (datetime) --

          The date and time the event occurred.

        • type (string) --

          The type of the event.

        • id (integer) --

          The id of the event. Events are numbered sequentially, starting at one.

        • previousEventId (integer) --

          The id of the previous event.

        • activityFailedEventDetails (dict) --

          Contains details about an activity that failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduleFailedEventDetails (dict) --

          Contains details about an activity schedule event that failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduledEventDetails (dict) --

          Contains details about an activity scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled activity.

          • input (string) --

            The JSON data input to the activity task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • inputDetails (dict) --

            Contains details about the input for an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the activity task.

          • heartbeatInSeconds (integer) --

            The maximum allowed duration between two heartbeats for the activity task.

        • activityStartedEventDetails (dict) --

          Contains details about the start of an activity during an execution.

          • workerName (string) --

            The name of the worker that the task is assigned to. These names are provided by the workers when calling GetActivityTask.

        • activitySucceededEventDetails (dict) --

          Contains details about an activity that successfully terminated during an execution.

          • output (string) --

            The JSON data output by the activity task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • activityTimedOutEventDetails (dict) --

          Contains details about an activity timeout that occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • taskFailedEventDetails (dict) --

          Contains details about the failure of a task.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • taskScheduledEventDetails (dict) --

          Contains details about a task that was scheduled.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • region (string) --

            The region of the scheduled task

          • parameters (string) --

            The JSON data passed to the resource referenced in a task state. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the task.

          • heartbeatInSeconds (integer) --

            The maximum allowed duration between two heartbeats for the task.

          • taskCredentials (dict) --

            The credentials that Step Functions uses for the task.

            • roleArn (string) --

              The ARN of an IAM role that Step Functions assumes for the task. The role can allow cross-account access to resources.

        • taskStartFailedEventDetails (dict) --

          Contains details about a task that failed to start.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • taskStartedEventDetails (dict) --

          Contains details about a task that was started.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

        • taskSubmitFailedEventDetails (dict) --

          Contains details about a task that where the submit failed.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • taskSubmittedEventDetails (dict) --

          Contains details about a submitted task.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • output (string) --

            The response from a resource when a task has started. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • taskSucceededEventDetails (dict) --

          Contains details about a task that succeeded.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • output (string) --

            The full JSON response from a resource when a task has succeeded. This response becomes the output of the related task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • taskTimedOutEventDetails (dict) --

          Contains details about a task that timed out.

          • resourceType (string) --

            The service name of the resource in a task state.

          • resource (string) --

            The action of the resource called by a task state.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionFailedEventDetails (dict) --

          Contains details about an execution failure event.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionStartedEventDetails (dict) --

          Contains details about the start of the execution.

          • input (string) --

            The JSON data input to the execution. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • inputDetails (dict) --

            Contains details about the input for an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

          • roleArn (string) --

            The Amazon Resource Name (ARN) of the IAM role used for executing Lambda tasks.

          • stateMachineAliasArn (string) --

            The Amazon Resource Name (ARN) that identifies a state machine alias used for starting the state machine execution.

          • stateMachineVersionArn (string) --

            The Amazon Resource Name (ARN) that identifies a state machine version used for starting the state machine execution.

        • executionSucceededEventDetails (dict) --

          Contains details about the successful termination of the execution.

          • output (string) --

            The JSON data output by the execution. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • executionAbortedEventDetails (dict) --

          Contains details about an abort of an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionTimedOutEventDetails (dict) --

          Contains details about the execution timeout that occurred during the execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • executionRedrivenEventDetails (dict) --

          Contains details about the redrive attempt of an execution.

          • redriveCount (integer) --

            The number of times you've redriven an execution. If you have not yet redriven an execution, the redriveCount is 0. This count is not updated for redrives that failed to start or are pending to be redriven.

        • mapStateStartedEventDetails (dict) --

          Contains details about Map state that was started.

          • length (integer) --

            The size of the array for Map state iterations.

        • mapIterationStartedEventDetails (dict) --

          Contains details about an iteration of a Map state that was started.

          • name (string) --

            The name of the iteration’s parent Map state.

          • index (integer) --

            The index of the array belonging to the Map state iteration.

        • mapIterationSucceededEventDetails (dict) --

          Contains details about an iteration of a Map state that succeeded.

          • name (string) --

            The name of the iteration’s parent Map state.

          • index (integer) --

            The index of the array belonging to the Map state iteration.

        • mapIterationFailedEventDetails (dict) --

          Contains details about an iteration of a Map state that failed.

          • name (string) --

            The name of the iteration’s parent Map state.

          • index (integer) --

            The index of the array belonging to the Map state iteration.

        • mapIterationAbortedEventDetails (dict) --

          Contains details about an iteration of a Map state that was aborted.

          • name (string) --

            The name of the iteration’s parent Map state.

          • index (integer) --

            The index of the array belonging to the Map state iteration.

        • lambdaFunctionFailedEventDetails (dict) --

          Contains details about a Lambda function that failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduleFailedEventDetails (dict) --

          Contains details about a failed Lambda function schedule event that occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduledEventDetails (dict) --

          Contains details about a Lambda function scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled Lambda function.

          • input (string) --

            The JSON data input to the Lambda function. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • inputDetails (dict) --

            Contains details about input for an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the Lambda function.

          • taskCredentials (dict) --

            The credentials that Step Functions uses for the task.

            • roleArn (string) --

              The ARN of an IAM role that Step Functions assumes for the task. The role can allow cross-account access to resources.

        • lambdaFunctionStartFailedEventDetails (dict) --

          Contains details about a lambda function that failed to start during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionSucceededEventDetails (dict) --

          Contains details about a Lambda function that terminated successfully during an execution.

          • output (string) --

            The JSON data output by the Lambda function. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • lambdaFunctionTimedOutEventDetails (dict) --

          Contains details about a Lambda function timeout that occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • stateEnteredEventDetails (dict) --

          Contains details about a state entered during an execution.

          • name (string) --

            The name of the state.

          • input (string) --

            The string that contains the JSON input data for the state. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • inputDetails (dict) --

            Contains details about the input for an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • stateExitedEventDetails (dict) --

          Contains details about an exit from a state during an execution.

          • name (string) --

            The name of the state.

            A name must not contain:

            • white space

            • brackets < > { } [ ]

            • wildcard characters ? *

            • special characters " # % \ ^ | ~ ` $ & , ; : /

            • control characters ( U+0000-001F, U+007F-009F)

            To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

          • output (string) --

            The JSON output data of the state. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

          • outputDetails (dict) --

            Contains details about the output of an execution history event.

            • truncated (boolean) --

              Indicates whether input or output was truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

          • assignedVariables (dict) --

            Map of variable name and value as a serialized JSON representation.

            • (string) --

              • (string) --

          • assignedVariablesDetails (dict) --

            Provides details about input or output in an execution history event.

            • truncated (boolean) --

              Indicates whether assigned variables were truncated in the response. Always false for API calls. In CloudWatch logs, the value will be true if the data is truncated due to size limits.

        • mapRunStartedEventDetails (dict) --

          Contains details, such as mapRunArn, and the start date and time of a Map Run. mapRunArn is the Amazon Resource Name (ARN) of the Map Run that was started.

          • mapRunArn (string) --

            The Amazon Resource Name (ARN) of a Map Run that was started.

        • mapRunFailedEventDetails (dict) --

          Contains error and cause details about a Map Run that failed.

          • error (string) --

            The error code of the Map Run failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • mapRunRedrivenEventDetails (dict) --

          Contains details about the redrive attempt of a Map Run.

          • mapRunArn (string) --

            The Amazon Resource Name (ARN) of a Map Run that was redriven.

          • redriveCount (integer) --

            The number of times the Map Run has been redriven at this point in the execution's history including this event. The redrive count for a redriven Map Run is always greater than 0.

        • evaluationFailedEventDetails (dict) --

          Contains details about an evaluation failure that occurred while processing a state.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

          • location (string) --

            The location of the field in the state in which the evaluation error occurred.

          • state (string) --

            The name of the state in which the evaluation error occurred.

    • nextToken (string) --

      If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

TestState (updated) Link ¶
Changes (request, response)
Request
{'variables': 'string'}
Response
{'inspectionData': {'afterArguments': 'string', 'variables': 'string'}}

Accepts the definition of a single state and executes it. You can test a state without creating a state machine or updating an existing state machine. Using this API, you can test the following:

You can call this API on only one state at a time. The states that you can test include the following:

The TestState API assumes an IAM role which must contain the required IAM permissions for the resources your state is accessing. For information about the permissions a state might need, see IAM permissions to test a state.

The TestState API can run for up to five minutes. If the execution of a state exceeds this duration, it fails with the States.Timeout error.

TestState doesn't support Activity tasks, .sync or .waitForTaskToken service integration patterns, Parallel, or Map states.

See also: AWS API Documentation

Request Syntax

client.test_state(
    definition='string',
    roleArn='string',
    input='string',
    inspectionLevel='INFO'|'DEBUG'|'TRACE',
    revealSecrets=True|False,
    variables='string'
)
type definition:

string

param definition:

[REQUIRED]

The Amazon States Language (ASL) definition of the state.

type roleArn:

string

param roleArn:

The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.

type input:

string

param input:

A string that contains the JSON input data for the state.

type inspectionLevel:

string

param inspectionLevel:

Determines the values to return when a state is tested. You can specify one of the following types:

  • INFO: Shows the final state output. By default, Step Functions sets inspectionLevel to INFO if you don't specify a level.

  • DEBUG: Shows the final state output along with the input and output data processing result.

  • TRACE: Shows the HTTP request and response for an HTTP Task. This level also shows the final state output along with the input and output data processing result.

Each of these levels also provide information about the status of the state execution and the next state to transition to.

type revealSecrets:

boolean

param revealSecrets:

Specifies whether or not to include secret information in the test result. For HTTP Tasks, a secret includes the data that an EventBridge connection adds to modify the HTTP request headers, query parameters, and body. Step Functions doesn't omit any information included in the state definition or the HTTP response.

If you set revealSecrets to true, you must make sure that the IAM user that calls the TestState API has permission for the states:RevealSecrets action. For an example of IAM policy that sets the states:RevealSecrets permission, see IAM permissions to test a state. Without this permission, Step Functions throws an access denied error.

By default, revealSecrets is set to false.

type variables:

string

param variables:

JSON object literal that sets variables used in the state under test. Object keys are the variable names and values are the variable values.

rtype:

dict

returns:

Response Syntax

{
    'output': 'string',
    'error': 'string',
    'cause': 'string',
    'inspectionData': {
        'input': 'string',
        'afterArguments': 'string',
        'afterInputPath': 'string',
        'afterParameters': 'string',
        'result': 'string',
        'afterResultSelector': 'string',
        'afterResultPath': 'string',
        'request': {
            'protocol': 'string',
            'method': 'string',
            'url': 'string',
            'headers': 'string',
            'body': 'string'
        },
        'response': {
            'protocol': 'string',
            'statusCode': 'string',
            'statusMessage': 'string',
            'headers': 'string',
            'body': 'string'
        },
        'variables': 'string'
    },
    'nextState': 'string',
    'status': 'SUCCEEDED'|'FAILED'|'RETRIABLE'|'CAUGHT_ERROR'
}

Response Structure

  • (dict) --

    • output (string) --

      The JSON output data of the state. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

    • error (string) --

      The error returned when the execution of a state fails.

    • cause (string) --

      A detailed explanation of the cause for the error when the execution of a state fails.

    • inspectionData (dict) --

      Returns additional details about the state's execution, including its input and output data processing flow, and HTTP request and response information. The inspectionLevel request parameter specifies which details are returned.

      • input (string) --

        The raw state input.

      • afterArguments (string) --

        The input after Step Functions applies an Arguments filter. This event will only be present when QueryLanguage for the state machine or individual states is set to JSONata. For more info, see Transforming data with Step Functions.

      • afterInputPath (string) --

        The input after Step Functions applies the InputPath filter. Not populated when QueryLanguage is JSONata.

      • afterParameters (string) --

        The effective input after Step Functions applies the Parameters filter. Not populated when QueryLanguage is JSONata.

      • result (string) --

        The state's raw result.

      • afterResultSelector (string) --

        The effective result after Step Functions applies the ResultSelector filter. Not populated when QueryLanguage is JSONata.

      • afterResultPath (string) --

        The effective result combined with the raw state input after Step Functions applies the ResultPath filter. Not populated when QueryLanguage is JSONata.

      • request (dict) --

        The raw HTTP request that is sent when you test an HTTP Task.

        • protocol (string) --

          The protocol used to make the HTTP request.

        • method (string) --

          The HTTP method used for the HTTP request.

        • url (string) --

          The API endpoint used for the HTTP request.

        • headers (string) --

          The request headers associated with the HTTP request.

        • body (string) --

          The request body for the HTTP request.

      • response (dict) --

        The raw HTTP response that is returned when you test an HTTP Task.

        • protocol (string) --

          The protocol used to return the HTTP response.

        • statusCode (string) --

          The HTTP response status code for the HTTP response.

        • statusMessage (string) --

          The message associated with the HTTP status code.

        • headers (string) --

          The response headers associated with the HTTP response.

        • body (string) --

          The HTTP response returned.

      • variables (string) --

        JSON string that contains the set of workflow variables after execution of the state. The set will include variables assigned in the state and variables set up as test state input.

    • nextState (string) --

      The name of the next state to transition to. If you haven't defined a next state in your definition or if the execution of the state fails, this field doesn't contain a value.

    • status (string) --

      The execution status of the state.