| 1 | from typing import Any |
| 2 | from typing import Dict |
| 3 | from typing import List |
| 4 | from typing import Optional |
| 5 | |
| 6 | from pydantic import UUID4 |
| 7 | from pydantic import BaseModel |
| 8 | from pydantic import Field |
| 9 | |
| 10 | |
| 11 | class WorkflowsResponse(BaseModel): |
| 12 | message: str |
| 13 | success: bool |
| 14 | workflows: Optional[List[Dict[str, Any]]] = Field( |
| 15 | [], |
| 16 | description="The alerts returned from the search.", |
| 17 | ) |
| 18 | |
| 19 | |
| 20 | class WorkflowStatusExecutionModel(BaseModel): |
| 21 | executions: Optional[str] = Field(None, description="Status of workflow executions") |
| 22 | message: str = Field(..., description="Status message") |
| 23 | success: bool = Field(..., description="Success status") |
| 24 | |
| 25 | |
| 26 | class WorkflowExecutionBodyModel(BaseModel): |
| 27 | workflow_id: str = Field(..., description="Unique identifier for the workflow") |
| 28 | |
| 29 | |
| 30 | class WorkflowExecutionStatusResponseModel(BaseModel): |
| 31 | last_run: Optional[str] = Field(..., description="Status of workflow executions") |
| 32 | |
| 33 | |
| 34 | class WorkflowExecutionModel(BaseModel): |
| 35 | status: WorkflowExecutionStatusResponseModel = Field( |
| 36 | ..., |
| 37 | description="Status object", |
| 38 | ) |
| 39 | workflow_id: str = Field(..., description="Unique identifier for the workflow") |
| 40 | workflow_name: str = Field(..., description="Name of the workflow") |
| 41 | |
| 42 | |
| 43 | class WorkflowExecutionResponseModel(BaseModel): |
| 44 | message: str = Field(..., description="Response message") |
| 45 | success: bool = Field(..., description="Success status") |
| 46 | workflows: List[WorkflowExecutionModel] = Field( |
| 47 | ..., |
| 48 | description="List of workflow objects", |
| 49 | ) |
| 50 | |
| 51 | |
| 52 | class RequestWorkflowExecutionModel(BaseModel): |
| 53 | workflow_id: str = Field(..., description="Unique identifier for the workflow") |
| 54 | execution_argument: str = Field(..., description="Execution argument for the workflow") |
| 55 | |
| 56 | |
| 57 | class ExecuteWorklow(BaseModel): |
| 58 | success: bool = Field(..., description="Indicates if the workflow execution was successful") |
| 59 | execution_id: UUID4 = Field(..., description="The unique identifier for the workflow execution") |
| 60 | authorization: UUID4 = Field(..., description="The authorization token for the workflow execution") |
| 61 | |
| 62 | |
| 63 | class RequestWorkflowExecutionResponse(BaseModel): |
| 64 | message: str = Field(..., description="Response message") |
| 65 | success: bool = Field(..., description="Success status") |
| 66 | data: Dict[str, Any] = Field(..., description="Data object") |