mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
Implement Phase 4: ML threat detection, automated playbooks, and advanced reporting
Co-authored-by: mblanke <9078342+mblanke@users.noreply.github.com>
This commit is contained in:
55
backend/app/schemas/playbook.py
Normal file
55
backend/app/schemas/playbook.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List, Dict, Any
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class PlaybookBase(BaseModel):
|
||||
"""Base playbook schema"""
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
trigger_type: str
|
||||
trigger_config: Optional[Dict[str, Any]] = None
|
||||
actions: List[Dict[str, Any]]
|
||||
is_enabled: bool = True
|
||||
|
||||
|
||||
class PlaybookCreate(PlaybookBase):
|
||||
"""Schema for creating a playbook"""
|
||||
pass
|
||||
|
||||
|
||||
class PlaybookUpdate(BaseModel):
|
||||
"""Schema for updating a playbook"""
|
||||
name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
trigger_type: Optional[str] = None
|
||||
trigger_config: Optional[Dict[str, Any]] = None
|
||||
actions: Optional[List[Dict[str, Any]]] = None
|
||||
is_enabled: Optional[bool] = None
|
||||
|
||||
|
||||
class PlaybookRead(PlaybookBase):
|
||||
"""Schema for reading playbook data"""
|
||||
id: int
|
||||
tenant_id: int
|
||||
created_by: int
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class PlaybookExecutionRead(BaseModel):
|
||||
"""Schema for playbook execution"""
|
||||
id: int
|
||||
playbook_id: int
|
||||
tenant_id: int
|
||||
status: str
|
||||
started_at: datetime
|
||||
completed_at: Optional[datetime]
|
||||
result: Optional[Dict[str, Any]]
|
||||
error_message: Optional[str]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user