File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
aws_lambda_powertools/utilities/typing
tests/functional/typing/required_dependencies Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class LambdaContext:
34
34
_aws_request_id : str
35
35
_log_group_name : str
36
36
_log_stream_name : str
37
+ _tenant_id : str | None = None
37
38
_identity : LambdaCognitoIdentity
38
39
_client_context : LambdaClientContext
39
40
@@ -75,14 +76,19 @@ def log_stream_name(self) -> str:
75
76
76
77
@property
77
78
def identity (self ) -> LambdaCognitoIdentity :
78
- """(mobile apps) Information about the Amazon Cognito identity that authorized the request."""
79
+ """Information about the Amazon Cognito identity that authorized the request."""
79
80
return self ._identity
80
81
81
82
@property
82
83
def client_context (self ) -> LambdaClientContext :
83
- """(mobile apps) Client context that's provided to Lambda by the client application."""
84
+ """Client context that's provided to Lambda by the client application."""
84
85
return self ._client_context
85
86
87
+ @property
88
+ def tenant_id (self ) -> str | None :
89
+ """The tenant_id"""
90
+ return self ._tenant_id
91
+
86
92
@staticmethod
87
93
def get_remaining_time_in_millis () -> int :
88
94
"""Returns the number of milliseconds left before the execution times out."""
Original file line number Diff line number Diff line change @@ -42,5 +42,18 @@ Using `LambdaContext` typing makes it possible to access information and hints o
42
42
--8<-- "examples/typing/src/working_with_context_function.py"
43
43
```
44
44
45
- ![ Utilities Typing All] ( ../media/utilities_typing_2.png )
46
- ![ Utilities Typing Specific] ( ../media/utilities_typing_3.png )
45
+ ### Available properties and methods
46
+
47
+ | Name | Type | Description |
48
+ | ------------------------------ | -------- | ------------------------------------------------------------------------- |
49
+ | ` function_name ` | property | The name of the Lambda function |
50
+ | ` function_version ` | property | The version of the function |
51
+ | ` invoked_function_arn ` | property | The Amazon Resource Name (ARN) that's used to invoke the function |
52
+ | ` memory_limit_in_mb ` | property | The amount of memory that's allocated for the function |
53
+ | ` aws_request_id ` | property | The identifier of the invocation request |
54
+ | ` log_group_name ` | property | The log group for the function |
55
+ | ` log_stream_name ` | property | The log stream for the function instance |
56
+ | ` identity ` | property | Information about the Amazon Cognito identity that authorized the request |
57
+ | ` client_context ` | property | Client context that's provided to Lambda by the client application |
58
+ | ` tenant_id ` | property | The tenant_id used to invoke the function |
59
+ | ` get_remaining_time_in_millis ` | method | Returns the number of milliseconds left before the execution times out |
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def test_typing():
19
19
context ._aws_request_id = "_aws_request_id"
20
20
context ._log_group_name = "_log_group_name"
21
21
context ._log_stream_name = "_log_stream_name"
22
+ context ._tenant_id = "_tenant_id"
22
23
identity = LambdaCognitoIdentity ()
23
24
identity ._cognito_identity_id = "_cognito_identity_id"
24
25
identity ._cognito_identity_pool_id = "_cognito_identity_pool_id"
@@ -42,6 +43,7 @@ def test_typing():
42
43
assert context .aws_request_id == context ._aws_request_id
43
44
assert context .log_group_name == context ._log_group_name
44
45
assert context .log_stream_name == context ._log_stream_name
46
+ assert context .tenant_id == context ._tenant_id
45
47
assert context .identity == context ._identity
46
48
assert context .identity .cognito_identity_id == identity ._cognito_identity_id
47
49
assert context .identity .cognito_identity_pool_id == identity ._cognito_identity_pool_id
You can’t perform that action at this time.
0 commit comments