Skip to content

Commit e7a91b0

Browse files
committed
fix implement for sns.py
1 parent 2154812 commit e7a91b0

File tree

1 file changed

+13
-1
lines changed
  • aws_lambda_powertools/event_handler/async_execution/routes

1 file changed

+13
-1
lines changed

aws_lambda_powertools/event_handler/async_execution/routes/sns.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,19 @@ def match(self, event: dict[str, Any]) -> tuple[Callable, SNSEvent] | None:
9191
else:
9292
subject = None
9393

94-
if self.is_target(arn, subject):
94+
flag_arn = self.is_target_with_arn(arn=arn)
95+
flag_subject = self.is_target_with_subject(subject=subject)
96+
97+
text = ", ".join(["arn: x" if arn is None else "arn: o", "subject: x" if subject is None else "subject: o"])
98+
99+
mapping = {
100+
"arn: o, subject: o": flag_arn and flag_subject,
101+
"arn: o, subject: x": flag_arn,
102+
"arn: x, subject: o": flag_subject,
103+
"arn: x, subject: x": False,
104+
}
105+
106+
if mapping[text]:
95107
return self.func, SNSEvent(event)
96108
else:
97109
return None

0 commit comments

Comments
 (0)