forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
47 lines (37 loc) · 1.06 KB
/
base.py
File metadata and controls
47 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Callable
DEFAULT_ROUTE = "/default/*"
class BaseRouter(ABC):
"""Abstract base class for Router (resolvers)"""
@abstractmethod
def on_publish(
self,
path: str = DEFAULT_ROUTE,
aggregate: bool = True,
) -> Callable:
raise NotImplementedError
@abstractmethod
def async_on_publish(
self,
path: str = DEFAULT_ROUTE,
aggregate: bool = True,
) -> Callable:
raise NotImplementedError
@abstractmethod
def on_subscribe(
self,
path: str = DEFAULT_ROUTE,
) -> Callable:
raise NotImplementedError
def append_context(self, **additional_context) -> None:
"""
Appends context information available under any route.
Parameters
-----------
**additional_context: dict
Additional context key-value pairs to append.
"""
raise NotImplementedError