Module aws_lambda_powertools.utilities.data_classes.alb_event

Expand source code
from typing import Dict, List, Optional

from aws_lambda_powertools.utilities.data_classes.common import BaseProxyEvent, DictWrapper


class ALBEventRequestContext(DictWrapper):
    @property
    def elb_target_group_arn(self) -> str:
        return self["requestContext"]["elb"]["targetGroupArn"]


class ALBEvent(BaseProxyEvent):
    """Application load balancer event

    Documentation:
    --------------
    - https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html
    """

    @property
    def request_context(self) -> ALBEventRequestContext:
        return ALBEventRequestContext(self._data)

    @property
    def http_method(self) -> str:
        return self["httpMethod"]

    @property
    def path(self) -> str:
        return self["path"]

    @property
    def multi_value_query_string_parameters(self) -> Optional[Dict[str, List[str]]]:
        return self.get("multiValueQueryStringParameters")

    @property
    def multi_value_headers(self) -> Optional[Dict[str, List[str]]]:
        return self.get("multiValueHeaders")

Classes

class ALBEvent (data: Dict[str, Any])

Application load balancer event

Documentation:

Expand source code
class ALBEvent(BaseProxyEvent):
    """Application load balancer event

    Documentation:
    --------------
    - https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html
    """

    @property
    def request_context(self) -> ALBEventRequestContext:
        return ALBEventRequestContext(self._data)

    @property
    def http_method(self) -> str:
        return self["httpMethod"]

    @property
    def path(self) -> str:
        return self["path"]

    @property
    def multi_value_query_string_parameters(self) -> Optional[Dict[str, List[str]]]:
        return self.get("multiValueQueryStringParameters")

    @property
    def multi_value_headers(self) -> Optional[Dict[str, List[str]]]:
        return self.get("multiValueHeaders")

Ancestors

Instance variables

var http_method : str
Expand source code
@property
def http_method(self) -> str:
    return self["httpMethod"]
var multi_value_headers : Union[Dict[str, List[str]], NoneType]
Expand source code
@property
def multi_value_headers(self) -> Optional[Dict[str, List[str]]]:
    return self.get("multiValueHeaders")
var multi_value_query_string_parameters : Union[Dict[str, List[str]], NoneType]
Expand source code
@property
def multi_value_query_string_parameters(self) -> Optional[Dict[str, List[str]]]:
    return self.get("multiValueQueryStringParameters")
var path : str
Expand source code
@property
def path(self) -> str:
    return self["path"]
var request_contextALBEventRequestContext
Expand source code
@property
def request_context(self) -> ALBEventRequestContext:
    return ALBEventRequestContext(self._data)

Inherited members

class ALBEventRequestContext (data: Dict[str, Any])

Provides a single read only access to a wrapper dict

Expand source code
class ALBEventRequestContext(DictWrapper):
    @property
    def elb_target_group_arn(self) -> str:
        return self["requestContext"]["elb"]["targetGroupArn"]

Ancestors

Instance variables

var elb_target_group_arn : str
Expand source code
@property
def elb_target_group_arn(self) -> str:
    return self["requestContext"]["elb"]["targetGroupArn"]

Inherited members