from pydantic import BaseModel from typing import Dict, List, Optional, Any from datetime import datetime class PortBinding(BaseModel): host_ip: str = "0.0.0.0" host_port: int container_port: int protocol: str = "tcp" class NetworkStats(BaseModel): rx_bytes: int rx_packets: int rx_errors: int rx_dropped: int tx_bytes: int tx_packets: int tx_errors: int tx_dropped: int class ContainerStats(BaseModel): cpu_percent: float memory_usage: int memory_limit: int network: Dict[str, NetworkStats] block_read: int block_write: int class Container(BaseModel): id: str name: str status: str image: str created: str ports: Optional[List[PortBinding]] = None volumes: Optional[List[str]] = None environment: Optional[Dict[str, str]] = None networks: Optional[List[str]] = None health_status: Optional[str] = None restart_policy: Optional[str] = None command: Optional[str] = None class ContainerUpdate(BaseModel): image: Optional[str] = None command: Optional[str] = None environment: Optional[Dict[str, str]] = None ports: Optional[List[PortBinding]] = None volumes: Optional[List[str]] = None restart_policy: Optional[str] = None class ContainerLog(BaseModel): timestamp: datetime message: str stream: str = "stdout"