Skip to content

Base

Base utilities and helpers for Lambda handlers.


HandlerMixins

Mixin class providing common handler utilities.

Provides access to the Lambda context and handler/service name utilities that are shared across all Lambda handlers.

context property writable

context

Get the Lambda context for the current invocation.

Returns:

Type Description
LambdaContext

The AWS Lambda context object.

Raises:

Type Description
ValueError

If context has not been set.

handler_name classmethod

handler_name()

Get the name of this handler class.

Returns:

Type Description
str

The class name as a string.

Source code in src/aibs_informatics_aws_lambda/common/base.py
37
38
39
40
41
42
43
44
@classmethod
def handler_name(cls) -> str:
    """Get the name of this handler class.

    Returns:
        The class name as a string.
    """
    return cls.__name__

service_name classmethod

service_name()

Get the service name for logging and metrics.

Returns:

Type Description
str

The class name as the service identifier.

Source code in src/aibs_informatics_aws_lambda/common/base.py
46
47
48
49
50
51
52
53
@classmethod
def service_name(cls) -> str:
    """Get the service name for logging and metrics.

    Returns:
        The class name as the service identifier.
    """
    return cls.__name__