Skip to content

Add Step Functions support for Variables and JSONata features #11906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 36 additions & 3 deletions localstack-core/localstack/aws/api/stepfunctions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime
from enum import StrEnum
from typing import List, Optional, TypedDict
from typing import Dict, List, Optional, TypedDict

from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler

Expand All @@ -12,6 +12,7 @@
Definition = str
Enabled = bool
ErrorMessage = str
EvaluationFailureLocation = str
HTTPBody = str
HTTPHeaders = str
HTTPMethod = str
Expand Down Expand Up @@ -52,6 +53,8 @@
ValidateStateMachineDefinitionMaxResult = int
ValidateStateMachineDefinitionMessage = str
ValidateStateMachineDefinitionTruncated = bool
VariableName = str
VariableValue = str
VersionDescription = str
VersionWeight = int
includedDetails = bool
Expand Down Expand Up @@ -145,6 +148,7 @@ class HistoryEventType(StrEnum):
MapRunSucceeded = "MapRunSucceeded"
ExecutionRedriven = "ExecutionRedriven"
MapRunRedriven = "MapRunRedriven"
EvaluationFailed = "EvaluationFailed"


class IncludedData(StrEnum):
Expand Down Expand Up @@ -473,6 +477,13 @@ class ActivityTimedOutEventDetails(TypedDict, total=False):
cause: Optional[SensitiveCause]


AssignedVariables = Dict[VariableName, VariableValue]


class AssignedVariablesDetails(TypedDict, total=False):
truncated: Optional[truncated]


BilledDuration = int
BilledMemoryUsed = int

Expand Down Expand Up @@ -721,6 +732,10 @@ class DescribeStateMachineForExecutionInput(ServiceRequest):
includedData: Optional[IncludedData]


VariableNameList = List[VariableName]
VariableReferences = Dict[StateName, VariableNameList]


class DescribeStateMachineForExecutionOutput(TypedDict, total=False):
stateMachineArn: Arn
name: Name
Expand All @@ -733,6 +748,7 @@ class DescribeStateMachineForExecutionOutput(TypedDict, total=False):
label: Optional[MapRunLabel]
revisionId: Optional[RevisionId]
encryptionConfiguration: Optional[EncryptionConfiguration]
variableReferences: Optional[VariableReferences]


class DescribeStateMachineInput(ServiceRequest):
Expand All @@ -756,9 +772,19 @@ class DescribeStateMachineInput(ServiceRequest):
"revisionId": Optional[RevisionId],
"description": Optional[VersionDescription],
"encryptionConfiguration": Optional[EncryptionConfiguration],
"variableReferences": Optional[VariableReferences],
},
total=False,
)


class EvaluationFailedEventDetails(TypedDict, total=False):
error: Optional[SensitiveError]
cause: Optional[SensitiveCause]
location: Optional[EvaluationFailureLocation]
state: StateName


EventId = int


Expand Down Expand Up @@ -848,6 +874,8 @@ class StateExitedEventDetails(TypedDict, total=False):
name: Name
output: Optional[SensitiveData]
outputDetails: Optional[HistoryEventExecutionDataDetails]
assignedVariables: Optional[AssignedVariables]
assignedVariablesDetails: Optional[AssignedVariablesDetails]


class StateEnteredEventDetails(TypedDict, total=False):
Expand Down Expand Up @@ -1004,6 +1032,7 @@ class TaskFailedEventDetails(TypedDict, total=False):
"mapRunStartedEventDetails": Optional[MapRunStartedEventDetails],
"mapRunFailedEventDetails": Optional[MapRunFailedEventDetails],
"mapRunRedrivenEventDetails": Optional[MapRunRedrivenEventDetails],
"evaluationFailedEventDetails": Optional[EvaluationFailedEventDetails],
},
total=False,
)
Expand Down Expand Up @@ -1033,13 +1062,15 @@ class InspectionDataRequest(TypedDict, total=False):

class InspectionData(TypedDict, total=False):
input: Optional[SensitiveData]
afterArguments: Optional[SensitiveData]
afterInputPath: Optional[SensitiveData]
afterParameters: Optional[SensitiveData]
result: Optional[SensitiveData]
afterResultSelector: Optional[SensitiveData]
afterResultPath: Optional[SensitiveData]
request: Optional[InspectionDataRequest]
response: Optional[InspectionDataResponse]
variables: Optional[SensitiveData]


class ListActivitiesInput(ServiceRequest):
Expand Down Expand Up @@ -1265,10 +1296,11 @@ class TagResourceOutput(TypedDict, total=False):

class TestStateInput(ServiceRequest):
definition: Definition
roleArn: Arn
roleArn: Optional[Arn]
input: Optional[SensitiveData]
inspectionLevel: Optional[InspectionLevel]
revealSecrets: Optional[RevealSecrets]
variables: Optional[SensitiveData]


class TestStateOutput(TypedDict, total=False):
Expand Down Expand Up @@ -1640,10 +1672,11 @@ def test_state(
self,
context: RequestContext,
definition: Definition,
role_arn: Arn,
role_arn: Arn = None,
input: SensitiveData = None,
inspection_level: InspectionLevel = None,
reveal_secrets: RevealSecrets = None,
variables: SensitiveData = None,
**kwargs,
) -> TestStateOutput:
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/aws/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def __init__(

# make sure we consider our custom data paths for legacy specs (like SQS query protocol)
if LOCALSTACK_BUILTIN_DATA_PATH not in self._session._loader.search_paths:
self._session._loader.search_paths.append(LOCALSTACK_BUILTIN_DATA_PATH)
self._session._loader.search_paths.insert(0, LOCALSTACK_BUILTIN_DATA_PATH)

self._create_client_lock = threading.RLock()

Expand Down
Loading
Loading