# retoor <retoor@molodetz.nl>
from __future__ import annotations
from ..spec import Action
TUNNEL_ACTIONS: tuple[Action, ...] = (
Action(
name="tunnel_list",
method="GET",
path="/api/tunnel/sessions",
summary="List active SSH tunnel sessions",
description=(
"Returns all active DevTunnel sessions. For admins: every session "
"across all users. For members: only the caller's own sessions. "
"Each session includes session_id, username, subdomain, local_port, "
"remote_port, bytes in/out, and request count."
),
requires_auth=True,
read_only=True,
),
Action(
name="tunnel_kill",
method="DELETE",
path="/api/tunnel/sessions/{session_id}",
summary="Kill an active SSH tunnel session",
description=(
"Terminates a tunnel session by session_id. The tunnel's subdomain "
"is released and the nginx config snippet is removed. Admins can "
"kill any session; members can kill only their own."
),
params=(),
requires_auth=True,
requires_admin=True,
),
Action(
name="tunnel_metrics",
method="GET",
path="/api/tunnel/metrics",
summary="Get DevTunnel system metrics",
description=(
"Returns aggregate metrics: active tunnel count, total bytes in/out, "
"total requests, uptime seconds, and per-user breakdown. Admin only."
),
requires_auth=True,
requires_admin=True,
read_only=True,
),
)
__all__ = ["TUNNEL_ACTIONS"]