Skip to content

Commit a7f8b11

Browse files
author
Joris Conijn
committed
refactor: split properties and add docblocks
1 parent df346b7 commit a7f8b11

File tree

1 file changed

+56
-15
lines changed

1 file changed

+56
-15
lines changed

aws_lambda_powertools/utilities/typing/lambda_context.py

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,63 @@ class LambdaContext(object):
1717
1818
"""
1919

20-
function_name: str
21-
function_version: str
22-
invoked_function_arn: str
23-
memory_limit_in_mb: int
24-
aws_request_id: str
25-
log_group_name: str
26-
log_stream_name: str
27-
identity: LambdaCognitoIdentity
28-
client_context: LambdaClientContext
20+
_function_name: str
21+
_function_version: str
22+
_invoked_function_arn: str
23+
_memory_limit_in_mb: int
24+
_aws_request_id: str
25+
_log_group_name: str
26+
_log_stream_name: str
27+
_identity: LambdaCognitoIdentity
28+
_client_context: LambdaClientContext
2929

30-
@staticmethod
31-
def get_remaining_time_in_millis() -> int:
32-
"""
30+
@property
31+
def function_name(self) -> str:
32+
"""The name of the Lambda function."""
33+
return self._function_name
34+
35+
@property
36+
def function_version(self) -> str:
37+
"""The version of the function."""
38+
return self._function_version
39+
40+
@property
41+
def invoked_function_arn(self) -> str:
42+
"""The Amazon Resource Name (ARN) that's used to invoke the function. Indicates if the invoker specified a
43+
version number or alias."""
44+
return self._invoked_function_arn
45+
46+
@property
47+
def memory_limit_in_mb(self) -> int:
48+
"""The amount of memory that's allocated for the function."""
49+
return self._memory_limit_in_mb
50+
51+
@property
52+
def aws_request_id(self) -> str:
53+
"""The identifier of the invocation request."""
54+
return self._aws_request_id
3355

34-
Returns
35-
-------
56+
@property
57+
def log_group_name(self) -> str:
58+
"""The log group for the function."""
59+
return self._log_group_name
3660

37-
"""
61+
@property
62+
def log_stream_name(self) -> str:
63+
"""The log stream for the function instance."""
64+
return self._log_stream_name
65+
66+
@property
67+
def identity(self) -> LambdaCognitoIdentity:
68+
"""(mobile apps) Information about the Amazon Cognito identity that authorized the request."""
69+
return self._identity
70+
71+
@property
72+
def client_context(self) -> LambdaClientContext:
73+
"""(mobile apps) Client context that's provided to Lambda by the client application."""
74+
return self._client_context
75+
76+
@staticmethod
77+
def get_remaining_time_in_millis() -> int:
78+
"""Returns the number of milliseconds left before the execution times out."""
3879
return 0

0 commit comments

Comments
 (0)