Skip to content

feat: Static Types for AWS Lambda #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 3, 2020
Next Next commit
feat: initial implementation as the proposed gist is
  • Loading branch information
Joris Conijn committed Aug 29, 2020
commit bf457f513a6c55ab84a6b5ff8ba2c4406c4dafd1
44 changes: 44 additions & 0 deletions aws_lambda_powertools/utilities/typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-

"""
Note: this code is used only by the static type checker!
This is copied from: https://gist.github.com/alexcasalboni/a545b68ee164b165a74a20a5fee9d133
"""
from typing import Any, Dict

LambdaDict = Dict[str, Any]


class LambdaCognitoIdentity(object):
cognito_identity_id: str
cognito_identity_pool_id: str


class LambdaClientContextMobileClient(object):
installation_id: str
app_title: str
app_version_name: str
app_version_code: str
app_package_name: str


class LambdaClientContext(object):
client: LambdaClientContextMobileClient
custom: LambdaDict
env: LambdaDict


class LambdaContext(object):
function_name: str
function_version: str
invoked_function_arn: str
memory_limit_in_mb: int
aws_request_id: str
log_group_name: str
log_stream_name: str
identity: LambdaCognitoIdentity
client_context: LambdaClientContext

@staticmethod
def get_remaining_time_in_millis() -> int:
return 0