main
py 122 lines 3.28 KB
Raw
1 from typing import List
2 from typing import Optional
3
4 from pydantic import BaseModel
5 from pydantic import Field
6
7
8 class ProvisionWorkerRequest(BaseModel):
9 customer_name: str = Field(
10 ...,
11 examples=["SOCFortress"],
12 description="The name of the customer",
13 )
14 customer_code: str = Field(
15 ...,
16 examples=["socfortress"],
17 description="The code of the customer",
18 )
19 wazuh_auth_password: str = Field(
20 ...,
21 examples=["password"],
22 description="The password for the Wazuh API user",
23 )
24 wazuh_registration_port: str = Field(
25 ...,
26 examples=["1515"],
27 description="The port for the Wazuh registration service",
28 )
29 wazuh_logs_port: str = Field(
30 ...,
31 examples=["1514"],
32 description="The port for the Wazuh logs service",
33 )
34 wazuh_api_port: str = Field(
35 ...,
36 examples=["55001"],
37 description="The port for the Wazuh API service",
38 )
39 wazuh_cluster_name: str = Field(
40 ...,
41 examples=["SOCFortress"],
42 description="The name of the Wazuh cluster",
43 )
44 wazuh_cluster_key: str = Field(
45 ...,
46 examples=["password"],
47 description="The password for the Wazuh cluster",
48 )
49 wazuh_master_ip: str = Field(
50 ...,
51 examples=["1.1.1.1"],
52 description="The IP address of the Wazuh master",
53 )
54 wazuh_worker_hostname: Optional[str] = Field(
55 None,
56 examples=["worker1"],
57 description="The hostname of the Wazuh worker",
58 )
59 portainer_deployment: Optional[bool] = Field(
60 None,
61 examples=[True],
62 description="Whether deployment of Portainer is occurring",
63 )
64 swarm_nodes: Optional[List[str]] = Field(
65 None,
66 examples=[["127.0.0.1"]],
67 description="The IP addresses of the swarm nodes",
68 )
69 wazuh_manager_version: Optional[str] = Field(
70 None,
71 examples=["4.10.1"],
72 description="The version of the Wazuh manager",
73 )
74 node_id: Optional[str] = Field(
75 "1",
76 examples=["1"],
77 description="The ID of the node in the swarm",
78 )
79
80
81 class ProvisionWorkerResponse(BaseModel):
82 success: bool = Field(
83 ...,
84 examples=[True],
85 description="Whether the worker was provisioned successfully",
86 )
87 message: str = Field(
88 ...,
89 examples=["Worker provisioned successfully"],
90 description="The message returned by the API",
91 )
92
93
94 class DecommissionWorkerRequest(BaseModel):
95 customer_name: str = Field(
96 ...,
97 examples=["SOCFortress"],
98 description="The name of the customer",
99 )
100 customer_code: str = Field(
101 ...,
102 examples=["socfortress"],
103 description="The code of the customer",
104 )
105 portainer_deployment: Optional[bool] = Field(
106 None,
107 examples=[True],
108 description="Whether deployment of Portainer is occurring",
109 )
110
111
112 class DecommissionWorkerResponse(BaseModel):
113 success: bool = Field(
114 ...,
115 examples=[True],
116 description="Whether the worker was decommissioned successfully",
117 )
118 message: str = Field(
119 ...,
120 examples=["Worker decommissioned successfully"],
121 description="The message returned by the API",
122 )