Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
"""
|
|
Pydantic schemas for terminal session API.
|
|
"""
|
|
from datetime import datetime
|
|
from typing import Optional, Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TerminalSessionRequest(BaseModel):
|
|
"""Request to create a new terminal session."""
|
|
mode: Literal["embedded", "popout"] = Field(
|
|
default="embedded",
|
|
description="Terminal display mode: embedded in drawer or popout window"
|
|
)
|
|
|
|
|
|
class TerminalSessionHost(BaseModel):
|
|
"""Host information included in session response."""
|
|
id: str
|
|
name: str
|
|
ip: str
|
|
status: str
|
|
bootstrap_ok: bool
|
|
|
|
|
|
class TerminalSessionResponse(BaseModel):
|
|
"""Response after creating a terminal session."""
|
|
session_id: str
|
|
url: str
|
|
websocket_url: str
|
|
expires_at: datetime
|
|
ttl_seconds: int
|
|
mode: str
|
|
host: TerminalSessionHost
|
|
|
|
|
|
class TerminalSessionStatus(BaseModel):
|
|
"""Current status of a terminal session."""
|
|
session_id: str
|
|
status: str
|
|
host_name: str
|
|
created_at: datetime
|
|
expires_at: datetime
|
|
remaining_seconds: int
|
|
|
|
|
|
class TerminalSessionList(BaseModel):
|
|
"""List of active terminal sessions."""
|
|
sessions: list[TerminalSessionStatus]
|
|
total: int
|
|
max_per_user: int
|