Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/mongodbflex/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0e64886dd0847341800d7191ed193b75413be998
518a18fcf435e8826badbbc0b6fa2e20412c806e
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self

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

@field_validator("name")
def name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,49 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self


class CreateUserPayload(BaseModel):
"""
CreateUserPayload
""" # noqa: E501

database: StrictStr
database: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
roles: List[StrictStr] = Field(
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.**"
)
username: Optional[StrictStr] = None
username: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
__properties: ClassVar[List[str]] = ["database", "roles", "username"]

@field_validator("database")
def database_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

@field_validator("username")
def username_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z][A-Za-z0-9-]{1,61}[A-Za-z0-9]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z][A-Za-z0-9-]{1,61}[A-Za-z0-9]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self

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

@field_validator("name")
def name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,39 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self


class PartialUpdateUserPayload(BaseModel):
"""
PartialUpdateUserPayload
""" # noqa: E501

database: Optional[StrictStr] = None
database: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
roles: Optional[List[StrictStr]] = Field(
default=None,
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.**",
)
__properties: ClassVar[List[str]] = ["database", "roles"]

@field_validator("database")
def database_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self

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

@field_validator("name")
def name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,35 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self
from typing_extensions import Annotated, Self


class UpdateUserPayload(BaseModel):
"""
UpdateUserPayload
""" # noqa: E501

database: StrictStr
database: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
roles: List[StrictStr] = Field(
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.**"
)
__properties: ClassVar[List[str]] = ["database", "roles"]

@field_validator("database")
def database_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if not isinstance(value, str):
value = str(value)

if not re.match(r"^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z_][A-Za-z0-9-_]{1,61}[A-Za-z0-9_]$/")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Loading