Skip to content

Commit d814aba

Browse files
Adding tenant_id property
1 parent 18f20d2 commit d814aba

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

aws_lambda_powertools/utilities/typing/lambda_context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class LambdaContext:
3434
_aws_request_id: str
3535
_log_group_name: str
3636
_log_stream_name: str
37+
_tenant_id: str | None = None
3738
_identity: LambdaCognitoIdentity
3839
_client_context: LambdaClientContext
3940

@@ -83,6 +84,11 @@ def client_context(self) -> LambdaClientContext:
8384
"""(mobile apps) Client context that's provided to Lambda by the client application."""
8485
return self._client_context
8586

87+
@property
88+
def tenant_id(self) -> str | None:
89+
"""The tenant_id"""
90+
return self._tenant_id
91+
8692
@staticmethod
8793
def get_remaining_time_in_millis() -> int:
8894
"""Returns the number of milliseconds left before the execution times out."""

tests/functional/typing/required_dependencies/test_utilities_typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_typing():
1919
context._aws_request_id = "_aws_request_id"
2020
context._log_group_name = "_log_group_name"
2121
context._log_stream_name = "_log_stream_name"
22+
context._tenant_id = "_tenant_id"
2223
identity = LambdaCognitoIdentity()
2324
identity._cognito_identity_id = "_cognito_identity_id"
2425
identity._cognito_identity_pool_id = "_cognito_identity_pool_id"
@@ -42,6 +43,7 @@ def test_typing():
4243
assert context.aws_request_id == context._aws_request_id
4344
assert context.log_group_name == context._log_group_name
4445
assert context.log_stream_name == context._log_stream_name
46+
assert context.tenant_id == context._tenant_id
4547
assert context.identity == context._identity
4648
assert context.identity.cognito_identity_id == identity._cognito_identity_id
4749
assert context.identity.cognito_identity_pool_id == identity._cognito_identity_pool_id

0 commit comments

Comments
 (0)