main
py 98 lines 2.47 KB
Raw
1 from typing import Any
2 from typing import Dict
3 from typing import Optional
4
5 from pydantic import BaseModel
6 from pydantic import Field
7 from pydantic import model_validator
8
9
10 class ProvisionDefenderForEndpointRequest(BaseModel):
11 customer_code: str = Field(
12 ...,
13 description="The customer code.",
14 examples=["00001"],
15 )
16 integration_name: str = Field(
17 "DefenderForEndpoint",
18 description="The integration name.",
19 examples=["DefenderForEndpoint"],
20 )
21 hot_data_retention: Optional[int] = Field(
22 30,
23 examples=[30],
24 description="Number of days to retain hot data",
25 )
26 index_replicas: Optional[int] = Field(
27 0,
28 examples=[1],
29 description="Number of replicas for the customer's Graylog instance",
30 )
31
32 # ensure the `integration_name` is always set to "DefenderForEndpoint"
33 @model_validator(mode="before")
34 @classmethod
35 def set_integration_name(cls, values: Dict[str, Any]) -> Dict[str, Any]:
36 values["integration_name"] = "DefenderForEndpoint"
37 return values
38
39
40 class ProvisionDefenderForEndpointResponse(BaseModel):
41 success: bool
42 message: str
43
44
45 class ProvisionDefenderForEndpointAuthKeys(BaseModel):
46 CLIENT_ID: str = Field(
47 ...,
48 description="The client id.",
49 examples=["00002"],
50 )
51 CLIENT_SECRET: str = Field(
52 ...,
53 description="The client secret.",
54 examples=["00002"],
55 )
56 TENANT_ID: str = Field(
57 ...,
58 description="The tenant id.",
59 examples=["00002"],
60 )
61 SYSLOG_PORT: str = Field(
62 ...,
63 description="The syslog port.",
64 examples=["5556"],
65 )
66
67
68 class DefenderForEndpointCustomerDetails(BaseModel):
69 customer_name: str = Field(
70 ...,
71 description="The customer name.",
72 examples=["Customer 1"],
73 )
74 customer_code: str = Field(
75 ...,
76 description="The customer code.",
77 examples=["00002"],
78 )
79 protocal_type: str = Field(
80 ...,
81 description="The protocal type.",
82 examples=["TCP"],
83 )
84 syslog_port: int = Field(
85 ...,
86 description="The syslog port.",
87 examples=[514],
88 )
89 hot_data_retention: int = Field(
90 ...,
91 examples=[30],
92 description="Number of days to retain hot data",
93 )
94 index_replicas: int = Field(
95 ...,
96 examples=[1],
97 description="Number of replicas for the customer's Graylog instance",
98 )