etoile_polaire/server/app/models/agent.py
2025-04-01 16:33:54 +02:00

54 lines
No EOL
1.1 KiB
Python

from pydantic import BaseModel
from typing import Optional, Dict, List
from datetime import datetime
from .container import Container
class AgentBase(BaseModel):
name: str
host: str
port: int
token: str
class AgentCreate(AgentBase):
pass
class AgentUpdate(BaseModel):
name: Optional[str] = None
host: Optional[str] = None
port: Optional[int] = None
token: Optional[str] = None
class Agent(AgentBase):
id: str
status: str
version: str
last_seen: datetime
created_at: datetime
updated_at: datetime
containers: List[Container]
class Config:
from_attributes = True
class AgentStatus(BaseModel):
status: str
version: str
last_seen: datetime
containers_count: int
system_info: Dict[str, str]
class AgentRegistration(BaseModel):
name: str
hostname: str
ip_address: str
docker_version: str
class Agent(BaseModel):
id: str
name: str
hostname: str
ip_address: str
docker_version: str
status: str
last_seen: datetime
containers: List[Container]