Skip to content

Commit 1cf0d94

Browse files
author
Joris Conijn
committed
refactor: split the objects into seperate files
1 parent bf457f5 commit 1cf0d94

File tree

7 files changed

+89
-44
lines changed

7 files changed

+89
-44
lines changed

aws_lambda_powertools/utilities/typing.py

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
Typing for developer ease in the IDE
5+
6+
> This is copied from: https://gist.github.com/alexcasalboni/a545b68ee164b165a74a20a5fee9d133
7+
"""
8+
9+
from .lambda_client_context import LambdaClientContext
10+
from .lambda_client_context_mobile_client import LambdaClientContextMobileClient
11+
from .lambda_cognito_identity import LambdaCognitoIdentity
12+
from .lambda_context import LambdaContext
13+
from .lambda_dict import LambdaDict
14+
15+
__all__ = [
16+
"LambdaDict",
17+
"LambdaClientContext",
18+
"LambdaClientContextMobileClient",
19+
"LambdaCognitoIdentity",
20+
"LambdaContext",
21+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- coding: utf-8 -*-
2+
from aws_lambda_powertools.utilities.typing import LambdaClientContextMobileClient, LambdaDict
3+
4+
5+
class LambdaClientContext(object):
6+
client: LambdaClientContextMobileClient
7+
custom: LambdaDict
8+
env: LambdaDict
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class LambdaClientContextMobileClient(object):
5+
installation_id: str
6+
app_title: str
7+
app_version_name: str
8+
app_version_code: str
9+
app_package_name: str
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
class LambdaCognitoIdentity(object):
5+
cognito_identity_id: str
6+
cognito_identity_pool_id: str
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import annotations
3+
4+
from aws_lambda_powertools.utilities.typing import LambdaClientContext, LambdaCognitoIdentity
5+
6+
7+
class LambdaContext(object):
8+
"""The LambdaContext static object can be used to ease the development by providing the IDE type hints.
9+
10+
Example
11+
-------
12+
**A Lambda function using LambdaContext**
13+
14+
>>> from aws_lambda_powertools.utilities.typing import LambdaDict, LambdaContext
15+
>>>
16+
>>> def handler(event: LambdaDict, context: LambdaContext) -> LambdaDict:
17+
>>> # Insert business logic
18+
>>> return event
19+
20+
"""
21+
22+
function_name: str
23+
function_version: str
24+
invoked_function_arn: str
25+
memory_limit_in_mb: int
26+
aws_request_id: str
27+
log_group_name: str
28+
log_stream_name: str
29+
identity: LambdaCognitoIdentity
30+
client_context: LambdaClientContext
31+
32+
@staticmethod
33+
def get_remaining_time_in_millis() -> int:
34+
"""
35+
36+
Returns
37+
-------
38+
39+
"""
40+
return 0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from typing import Any, Dict
4+
5+
LambdaDict = Dict[str, Any]

0 commit comments

Comments
 (0)