Coverage for serverctl_deployd/models/deployments.py : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2Models related to the deployments feature
3"""
5from enum import Enum
6from typing import Dict, Optional
8from pydantic import BaseModel
9from pydantic.fields import Field
12class DBType(str, Enum):
13 """Enum of supported databases"""
14 MYSQL = "mysql"
15 MONGODB = "mongodb"
18class DBConfig(BaseModel):
19 """Class for database config"""
20 dbtype: DBType = Field(
21 ..., title="Type of the database service"
22 )
23 username: str = Field(
24 ..., title="Username for connecting to database service"
25 )
26 password: str = Field(
27 ..., title="Password for connecting to the database service"
28 )
31class UpdateDBConfig(BaseModel):
32 """Class for updating database config"""
33 dbtype: Optional[DBType] = Field(
34 None, title="Type of the database service"
35 )
36 username: Optional[str] = Field(
37 None, title="Username for connecting to database service"
38 )
39 password: Optional[str] = Field(
40 None, title="Password for connecting to the database service"
41 )
44class Deployment(BaseModel):
45 """Class for deployment"""
46 name: str = Field(
47 ..., title="Name of the deployment"
48 )
49 compose_file: str = Field(
50 ..., title="Content of the docker-compose file"
51 )
52 env_file: Optional[str] = Field(
53 None, title="Content of the .env file"
54 )
55 databases: Optional[Dict[str, DBConfig]] = Field(
56 None, title="List of database services"
57 )
60class UpdateDeployment(BaseModel):
61 """Class for updating deployment"""
62 compose_file: str = Field(
63 None, title="Content of the docker-compose file"
64 )
65 env_file: Optional[str] = Field(
66 None, title="Content of the .env file"
67 )
68 databases: Optional[Dict[str, UpdateDBConfig]] = Field(
69 None, title="List of database services"
70 )