Skip to content

Commit cc5bb9b

Browse files
Generate mongodbflex
1 parent eb3e33a commit cc5bb9b

7 files changed

Lines changed: 105 additions & 20 deletions

File tree

services/mongodbflex/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0e64886dd0847341800d7191ed193b75413be998
1+
9873a8f7a4120017699e43baba2e8b2af7bca93e

services/mongodbflex/src/stackit/mongodbflex/models/create_instance_payload.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526
from stackit.mongodbflex.models.acl import ACL
2627
from stackit.mongodbflex.models.storage import Storage
@@ -37,7 +38,7 @@ class CreateInstancePayload(BaseModel):
3738
backup_schedule: StrictStr = Field(alias="backupSchedule")
3839
flavor_id: StrictStr = Field(alias="flavorId")
3940
labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels field is not certain/clear")
40-
name: StrictStr
41+
name: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
4142
options: Dict[str, StrictStr]
4243
replicas: StrictInt
4344
storage: Storage
@@ -54,6 +55,16 @@ class CreateInstancePayload(BaseModel):
5455
"version",
5556
]
5657

58+
@field_validator("name")
59+
def name_validate_regular_expression(cls, value):
60+
"""Validates the regular expression"""
61+
if not isinstance(value, str):
62+
value = str(value)
63+
64+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
65+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
66+
return value
67+
5768
model_config = ConfigDict(
5869
validate_by_name=True,
5970
validate_by_alias=True,

services/mongodbflex/src/stackit/mongodbflex/models/create_user_payload.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,49 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class CreateUserPayload(BaseModel):
2728
"""
2829
CreateUserPayload
2930
""" # noqa: E501
3031

31-
database: StrictStr
32+
database: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
3233
roles: List[StrictStr] = Field(
3334
description="The roles defined for a user. Currently only one role in the list is supported, therefore only the first role from this list is used. The *roles* attribute can contain the following values: 'read', 'readWrite', 'readAnyDatabase', 'readWriteAnyDatabase', 'stackitAdmin'. **The 'readAnyDatabase', 'readWriteAnyDatabase' and 'stackitAdmin' roles will always be created in the admin database.**"
3435
)
35-
username: Optional[StrictStr] = None
36+
username: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
3637
__properties: ClassVar[List[str]] = ["database", "roles", "username"]
3738

39+
@field_validator("database")
40+
def database_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if not isinstance(value, str):
43+
value = str(value)
44+
45+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
46+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
47+
return value
48+
49+
@field_validator("username")
50+
def username_validate_regular_expression(cls, value):
51+
"""Validates the regular expression"""
52+
if value is None:
53+
return value
54+
55+
if not isinstance(value, str):
56+
value = str(value)
57+
58+
if not re.match(r"^[A-Za-z][A-Za-z0-9-]{1,61}[A-Za-z0-9]$", value):
59+
raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9-]{1,61}[A-Za-z0-9]$/")
60+
return value
61+
3862
model_config = ConfigDict(
3963
validate_by_name=True,
4064
validate_by_alias=True,

services/mongodbflex/src/stackit/mongodbflex/models/partial_update_instance_payload.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526
from stackit.mongodbflex.models.acl import ACL
2627
from stackit.mongodbflex.models.storage import Storage
@@ -35,7 +36,7 @@ class PartialUpdateInstancePayload(BaseModel):
3536
backup_schedule: Optional[StrictStr] = Field(default=None, alias="backupSchedule")
3637
flavor_id: Optional[StrictStr] = Field(default=None, alias="flavorId")
3738
labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels field is not certain/clear")
38-
name: Optional[StrictStr] = None
39+
name: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
3940
options: Optional[Dict[str, StrictStr]] = None
4041
replicas: Optional[StrictInt] = None
4142
storage: Optional[Storage] = None
@@ -52,6 +53,19 @@ class PartialUpdateInstancePayload(BaseModel):
5253
"version",
5354
]
5455

56+
@field_validator("name")
57+
def name_validate_regular_expression(cls, value):
58+
"""Validates the regular expression"""
59+
if value is None:
60+
return value
61+
62+
if not isinstance(value, str):
63+
value = str(value)
64+
65+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
66+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
67+
return value
68+
5569
model_config = ConfigDict(
5670
validate_by_name=True,
5771
validate_by_alias=True,

services/mongodbflex/src/stackit/mongodbflex/models/partial_update_user_payload.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,39 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class PartialUpdateUserPayload(BaseModel):
2728
"""
2829
PartialUpdateUserPayload
2930
""" # noqa: E501
3031

31-
database: Optional[StrictStr] = None
32+
database: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
3233
roles: Optional[List[StrictStr]] = Field(
3334
default=None,
3435
description="The roles defined for a user. Currently only one role in the list is supported, therefore only the first role from this list is used. The *roles* attribute can contain the following values: 'read', 'readWrite', 'readAnyDatabase', 'readWriteAnyDatabase', 'stackitAdmin'. **The 'readAnyDatabase', 'readWriteAnyDatabase' and 'stackitAdmin' roles will always be created in the admin database.**",
3536
)
3637
__properties: ClassVar[List[str]] = ["database", "roles"]
3738

39+
@field_validator("database")
40+
def database_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if value is None:
43+
return value
44+
45+
if not isinstance(value, str):
46+
value = str(value)
47+
48+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
49+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
50+
return value
51+
3852
model_config = ConfigDict(
3953
validate_by_name=True,
4054
validate_by_alias=True,

services/mongodbflex/src/stackit/mongodbflex/models/update_instance_payload.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526
from stackit.mongodbflex.models.acl import ACL
2627
from stackit.mongodbflex.models.storage import Storage
@@ -35,7 +36,7 @@ class UpdateInstancePayload(BaseModel):
3536
backup_schedule: StrictStr = Field(alias="backupSchedule")
3637
flavor_id: StrictStr = Field(alias="flavorId")
3738
labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Labels field is not certain/clear")
38-
name: StrictStr
39+
name: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
3940
options: Dict[str, StrictStr]
4041
replicas: StrictInt
4142
storage: Storage
@@ -52,6 +53,16 @@ class UpdateInstancePayload(BaseModel):
5253
"version",
5354
]
5455

56+
@field_validator("name")
57+
def name_validate_regular_expression(cls, value):
58+
"""Validates the regular expression"""
59+
if not isinstance(value, str):
60+
value = str(value)
61+
62+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
63+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
64+
return value
65+
5566
model_config = ConfigDict(
5667
validate_by_name=True,
5768
validate_by_alias=True,

services/mongodbflex/src/stackit/mongodbflex/models/update_user_payload.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,35 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class UpdateUserPayload(BaseModel):
2728
"""
2829
UpdateUserPayload
2930
""" # noqa: E501
3031

31-
database: StrictStr
32+
database: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
3233
roles: List[StrictStr] = Field(
3334
description="The roles defined for a user. Currently only one role in the list is supported, therefore only the first role from this list is used. The *roles* attribute can contain the following values: 'read', 'readWrite', 'readAnyDatabase', 'readWriteAnyDatabase', 'stackitAdmin'. **The 'readAnyDatabase', 'readWriteAnyDatabase' and 'stackitAdmin' roles will always be created in the admin database.**"
3435
)
3536
__properties: ClassVar[List[str]] = ["database", "roles"]
3637

38+
@field_validator("database")
39+
def database_validate_regular_expression(cls, value):
40+
"""Validates the regular expression"""
41+
if not isinstance(value, str):
42+
value = str(value)
43+
44+
if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
45+
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
46+
return value
47+
3748
model_config = ConfigDict(
3849
validate_by_name=True,
3950
validate_by_alias=True,

0 commit comments

Comments
 (0)