main
py 29 lines 812 Bytes
Raw
1 from fastapi import APIRouter
2 from fastapi import Security
3 from loguru import logger
4
5 from app.auth.utils import AuthHandler
6 from app.connectors.graylog.schema.streams import GraylogStreamsResponse
7 from app.connectors.graylog.services.streams import get_streams
8
9 # App specific imports
10
11
12 graylog_streams_router = APIRouter()
13
14
15 @graylog_streams_router.get(
16 "/streams",
17 response_model=GraylogStreamsResponse,
18 description="Get all streams",
19 dependencies=[Security(AuthHandler().require_any_scope("admin", "analyst"))],
20 )
21 async def get_all_streams() -> GraylogStreamsResponse:
22 """
23 Fetches all graylog streams.
24
25 Returns:
26 GraylogStreamsResponse: The response containing all the graylog streams.
27 """
28 logger.info("Fetching all graylog streams")
29 return await get_streams()