| 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 ProvisionBitdefenderRequest(BaseModel): |
| 11 | customer_code: str = Field( |
| 12 | ..., |
| 13 | description="The customer code.", |
| 14 | examples=["00001"], |
| 15 | ) |
| 16 | integration_name: str = Field( |
| 17 | "Bitdefender", |
| 18 | description="The integration name.", |
| 19 | examples=["BitDefender"], |
| 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 "Bitdefender" |
| 33 | @model_validator(mode="before") |
| 34 | @classmethod |
| 35 | def set_integration_name(cls, values: Dict[str, Any]) -> Dict[str, Any]: |
| 36 | values["integration_name"] = "BitDefender" |
| 37 | return values |
| 38 | |
| 39 | |
| 40 | class ProvisionBitdefenderResponse(BaseModel): |
| 41 | success: bool |
| 42 | message: str |
| 43 | |
| 44 | |
| 45 | class ProvisionBitdefenderAuthKeys(BaseModel): |
| 46 | BASIC_AUTH_USERNAME: str = Field( |
| 47 | ..., |
| 48 | description="The basic auth username.", |
| 49 | examples=["admin"], |
| 50 | ) |
| 51 | BASIC_AUTH_PASSWORD: str = Field( |
| 52 | ..., |
| 53 | description="The basic auth password.", |
| 54 | examples=["password"], |
| 55 | ) |
| 56 | WEBSERVER_HOSTNAME: str = Field( |
| 57 | ..., |
| 58 | description="The webserver hostname.", |
| 59 | examples=["firehose.socfortress.co"], |
| 60 | ) |
| 61 | WEBSERVER_PORT: str = Field( |
| 62 | ..., |
| 63 | description="The webserver port.", |
| 64 | examples=["3200"], |
| 65 | ) |
| 66 | GRAYLOG_PORT: str = Field( |
| 67 | ..., |
| 68 | description="The Graylog port.", |
| 69 | examples=["10514"], |
| 70 | ) |
| 71 | API_KEY: str = Field( |
| 72 | ..., |
| 73 | description="The API key.", |
| 74 | examples=["api_key"], |
| 75 | ) |
| 76 | |
| 77 | |
| 78 | class BitdefenderCustomerDetails(BaseModel): |
| 79 | customer_name: str = Field( |
| 80 | ..., |
| 81 | description="The customer name.", |
| 82 | examples=["Customer 1"], |
| 83 | ) |
| 84 | customer_code: str = Field( |
| 85 | ..., |
| 86 | description="The customer code.", |
| 87 | examples=["00002"], |
| 88 | ) |
| 89 | protocal_type: str = Field( |
| 90 | ..., |
| 91 | description="The protocal type.", |
| 92 | examples=["TCP"], |
| 93 | ) |
| 94 | syslog_port: int = Field( |
| 95 | ..., |
| 96 | description="The syslog port.", |
| 97 | examples=[514], |
| 98 | ) |
| 99 | hot_data_retention: int = Field( |
| 100 | ..., |
| 101 | examples=[30], |
| 102 | description="Number of days to retain hot data", |
| 103 | ) |
| 104 | index_replicas: int = Field( |
| 105 | ..., |
| 106 | examples=[1], |
| 107 | description="Number of replicas for the customer's Graylog instance", |
| 108 | ) |