rmi-backend/app/api/v1/admin/alerts_webhook.py
opencode c762564d40 style(rmi-backend): complete lint cleanup — 1175→0 ruff errors
- Fix 71 invalid-syntax files (class-body newline-broken assignments)
- Add from/None chain to 307 B904 raise-without-from sites
- Add B008 ignore to ruff.toml (already in pyproject.toml)
- Noqa F401 on __init__.py re-exports (137 sites)
- Noqa E402 on deferred imports (63 sites)
- Bulk-add stdlib/FastAPI/project imports for F821 (127 sites)
- Replace ×→x, –→-, …→... in docstrings (4093 chars)
- Manual refactor of 5 SIM103/SIM116 patterns

Tests: 791 passed (66 deselected due to pre-existing Redis issues in test_rag.py)
Co-authored-by: opencode <opencode@rugmunch.io>
2026-07-06 15:43:20 +02:00

32 lines
978 B
Python

"""Admin alerts webhook - /api/v1/admin/alerts/webhook.
Stub endpoint for receiving alert webhooks from external sources
(monitoring, observability platforms).
"""
from __future__ import annotations
from typing import Any
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
router = APIRouter(prefix="/alerts", tags=["admin"])
class AlertWebhookPayload(BaseModel):
"""Generic webhook payload from external alert sources."""
source: str # "prometheus" | "grafana" | "sentry" | "custom"
severity: str # "info" | "warning" | "critical"
title: str
description: str | None = None
labels: dict[str, str] = {}
@router.post("/webhook")
async def receive_alert_webhook(payload: AlertWebhookPayload) -> dict[str, Any]:
"""Receive an alert webhook from external monitoring."""
raise HTTPException(
status_code=501,
detail="Alert webhook ingestion not yet implemented - pending T08 GlitchTip wiring",
)