Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/aws_durable_execution_sdk_python/lambda_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def from_dict(cls, data: MutableMapping[str, Any]) -> InvokeDetails:
class StepOptions:
next_attempt_delay_seconds: int = 0

@classmethod
def from_dict(cls, data: MutableMapping[str, Any]) -> StepOptions:
return cls(next_attempt_delay_seconds=data.get("NextAttemptDelaySeconds", 0))

def to_dict(self) -> MutableMapping[str, Any]:
return {
"NextAttemptDelaySeconds": self.next_attempt_delay_seconds,
Expand All @@ -234,6 +238,13 @@ class CallbackOptions:
timeout_seconds: int = 0
heartbeat_timeout_seconds: int = 0

@classmethod
def from_dict(cls, data: MutableMapping[str, Any]) -> CallbackOptions:
return cls(
timeout_seconds=data.get("TimeoutSeconds", 0),
heartbeat_timeout_seconds=data.get("HeartbeatTimeoutSeconds", 0),
)

def to_dict(self) -> MutableMapping[str, Any]:
return {
"TimeoutSeconds": self.timeout_seconds,
Expand All @@ -246,6 +257,13 @@ class InvokeOptions:
function_name: str
timeout_seconds: int = 0

@classmethod
def from_dict(cls, data: MutableMapping[str, Any]) -> InvokeOptions:
return cls(
function_name=data["FunctionName"],
timeout_seconds=data.get("TimeoutSeconds", 0),
)

def to_dict(self) -> MutableMapping[str, Any]:
result: MutableMapping[str, Any] = {"FunctionName": self.function_name}
result["TimeoutSeconds"] = self.timeout_seconds
Expand All @@ -256,6 +274,10 @@ def to_dict(self) -> MutableMapping[str, Any]:
class ContextOptions:
replay_children: bool = False

@classmethod
def from_dict(cls, data: MutableMapping[str, Any]) -> ContextOptions:
return cls(replay_children=data.get("ReplayChildren", False))

def to_dict(self) -> MutableMapping[str, Any]:
return {"ReplayChildren": self.replay_children}

Expand Down