stackit-resourcemanager 0.7.1__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/PKG-INFO +1 -1
  2. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/pyproject.toml +1 -1
  3. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/api_client.py +15 -17
  4. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/container_search_result.py +4 -3
  5. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/create_folder_payload.py +8 -4
  6. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/create_project_payload.py +8 -4
  7. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/error_response.py +4 -3
  8. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/folder_response.py +5 -4
  9. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/get_folder_details_response.py +5 -4
  10. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/get_project_response.py +5 -4
  11. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/list_folders_response.py +4 -3
  12. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/list_folders_response_items_inner.py +5 -4
  13. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/list_organizations_response.py +4 -3
  14. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/list_organizations_response_items_inner.py +5 -4
  15. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/list_projects_response.py +4 -3
  16. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/member.py +4 -3
  17. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/organization_response.py +5 -4
  18. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/parent.py +4 -3
  19. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/parent_list_inner.py +4 -3
  20. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/partial_update_folder_payload.py +8 -4
  21. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/partial_update_organization_payload.py +8 -4
  22. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/partial_update_project_payload.py +8 -4
  23. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/project.py +5 -4
  24. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/.gitignore +0 -0
  25. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/LICENSE.md +0 -0
  26. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/NOTICE.txt +0 -0
  27. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/README.md +0 -0
  28. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/__init__.py +0 -0
  29. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/api/__init__.py +0 -0
  30. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/api/default_api.py +0 -0
  31. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/api_response.py +0 -0
  32. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/configuration.py +0 -0
  33. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/exceptions.py +0 -0
  34. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/__init__.py +0 -0
  35. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/models/lifecycle_state.py +0 -0
  36. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/py.typed +0 -0
  37. {stackit_resourcemanager-0.7.1 → stackit_resourcemanager-0.8.0}/src/stackit/resourcemanager/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-resourcemanager
3
- Version: 0.7.1
3
+ Version: 0.8.0
4
4
  Summary: Resource Manager API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-resourcemanager"
3
- version = "v0.7.1"
3
+ version = "v0.8.0"
4
4
  description = "Resource Manager API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.9,<4.0"
@@ -66,6 +66,7 @@ class ApiClient:
66
66
  "date": datetime.date,
67
67
  "datetime": datetime.datetime,
68
68
  "decimal": decimal.Decimal,
69
+ "UUID": uuid.UUID,
69
70
  "object": object,
70
71
  }
71
72
  _pool = None
@@ -265,7 +266,7 @@ class ApiClient:
265
266
  response_text = None
266
267
  return_data = None
267
268
  try:
268
- if response_type == "bytearray":
269
+ if response_type in ("bytearray", "bytes"):
269
270
  return_data = response_data.data
270
271
  elif response_type == "file":
271
272
  return_data = self.__deserialize_file(response_data)
@@ -326,25 +327,20 @@ class ApiClient:
326
327
  return obj.isoformat()
327
328
  elif isinstance(obj, decimal.Decimal):
328
329
  return str(obj)
329
-
330
330
  elif isinstance(obj, dict):
331
- obj_dict = obj
331
+ return {key: self.sanitize_for_serialization(val) for key, val in obj.items()}
332
+
333
+ # Convert model obj to dict except
334
+ # attributes `openapi_types`, `attribute_map`
335
+ # and attributes which value is not None.
336
+ # Convert attribute name to json key in
337
+ # model definition for request.
338
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
+ obj_dict = obj.to_dict()
332
340
  else:
333
- # Convert model obj to dict except
334
- # attributes `openapi_types`, `attribute_map`
335
- # and attributes which value is not None.
336
- # Convert attribute name to json key in
337
- # model definition for request.
338
- if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
- obj_dict = obj.to_dict()
340
- else:
341
- obj_dict = obj.__dict__
342
-
343
- if isinstance(obj_dict, list):
344
- # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
345
- return self.sanitize_for_serialization(obj_dict)
341
+ obj_dict = obj.__dict__
346
342
 
347
- return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
343
+ return self.sanitize_for_serialization(obj_dict)
348
344
 
349
345
  def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
350
346
  """Deserializes response into an object.
@@ -417,6 +413,8 @@ class ApiClient:
417
413
  return self.__deserialize_datetime(data)
418
414
  elif klass is decimal.Decimal:
419
415
  return decimal.Decimal(data)
416
+ elif klass is uuid.UUID:
417
+ return uuid.UUID(data)
420
418
  elif issubclass(klass, Enum):
421
419
  return self.__deserialize_enum(data, klass)
422
420
  else:
@@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
  from uuid import UUID
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -54,7 +55,8 @@ class ContainerSearchResult(BaseModel):
54
55
  return value
55
56
 
56
57
  model_config = ConfigDict(
57
- populate_by_name=True,
58
+ validate_by_name=True,
59
+ validate_by_alias=True,
58
60
  validate_assignment=True,
59
61
  protected_namespaces=(),
60
62
  )
@@ -65,8 +67,7 @@ class ContainerSearchResult(BaseModel):
65
67
 
66
68
  def to_json(self) -> str:
67
69
  """Returns the JSON representation of the model using alias"""
68
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
- return json.dumps(self.to_dict())
70
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
71
 
71
72
  @classmethod
72
73
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.resourcemanager.models.member import Member
@@ -35,7 +36,7 @@ class CreateFolderPayload(BaseModel):
35
36
  )
36
37
  labels: Optional[Dict[str, StrictStr]] = Field(
37
38
  default=None,
38
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
39
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
39
40
  )
40
41
  members: Optional[Annotated[List[Member], Field(min_length=1)]] = Field(
41
42
  default=None,
@@ -49,6 +50,9 @@ class CreateFolderPayload(BaseModel):
49
50
  @field_validator("name")
50
51
  def name_validate_regular_expression(cls, value):
51
52
  """Validates the regular expression"""
53
+ if not isinstance(value, str):
54
+ value = str(value)
55
+
52
56
  if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
53
57
  raise ValueError(
54
58
  r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
@@ -56,7 +60,8 @@ class CreateFolderPayload(BaseModel):
56
60
  return value
57
61
 
58
62
  model_config = ConfigDict(
59
- populate_by_name=True,
63
+ validate_by_name=True,
64
+ validate_by_alias=True,
60
65
  validate_assignment=True,
61
66
  protected_namespaces=(),
62
67
  )
@@ -67,8 +72,7 @@ class CreateFolderPayload(BaseModel):
67
72
 
68
73
  def to_json(self) -> str:
69
74
  """Returns the JSON representation of the model using alias"""
70
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
71
- return json.dumps(self.to_dict())
75
+ return json.dumps(to_jsonable_python(self.to_dict()))
72
76
 
73
77
  @classmethod
74
78
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.resourcemanager.models.member import Member
@@ -35,7 +36,7 @@ class CreateProjectPayload(BaseModel):
35
36
  )
36
37
  labels: Optional[Dict[str, StrictStr]] = Field(
37
38
  default=None,
38
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
39
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
39
40
  )
40
41
  members: Annotated[List[Member], Field(min_length=1)] = Field(
41
42
  description="The initial members assigned to the project. At least one subject needs to be a user, and not a client or service account."
@@ -48,6 +49,9 @@ class CreateProjectPayload(BaseModel):
48
49
  @field_validator("name")
49
50
  def name_validate_regular_expression(cls, value):
50
51
  """Validates the regular expression"""
52
+ if not isinstance(value, str):
53
+ value = str(value)
54
+
51
55
  if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
52
56
  raise ValueError(
53
57
  r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
@@ -55,7 +59,8 @@ class CreateProjectPayload(BaseModel):
55
59
  return value
56
60
 
57
61
  model_config = ConfigDict(
58
- populate_by_name=True,
62
+ validate_by_name=True,
63
+ validate_by_alias=True,
59
64
  validate_assignment=True,
60
65
  protected_namespaces=(),
61
66
  )
@@ -66,8 +71,7 @@ class CreateProjectPayload(BaseModel):
66
71
 
67
72
  def to_json(self) -> str:
68
73
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
74
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
75
 
72
76
  @classmethod
73
77
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -28,6 +28,7 @@ from pydantic import (
28
28
  StrictStr,
29
29
  field_validator,
30
30
  )
31
+ from pydantic_core import to_jsonable_python
31
32
  from typing_extensions import Self
32
33
 
33
34
 
@@ -57,7 +58,8 @@ class ErrorResponse(BaseModel):
57
58
  return value
58
59
 
59
60
  model_config = ConfigDict(
60
- populate_by_name=True,
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
61
63
  validate_assignment=True,
62
64
  protected_namespaces=(),
63
65
  )
@@ -68,8 +70,7 @@ class ErrorResponse(BaseModel):
68
70
 
69
71
  def to_json(self) -> str:
70
72
  """Returns the JSON representation of the model using alias"""
71
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
72
- return json.dumps(self.to_dict())
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
73
74
 
74
75
  @classmethod
75
76
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.parent import Parent
@@ -36,7 +37,7 @@ class FolderResponse(BaseModel):
36
37
  folder_id: UUID = Field(description="Globally unique folder identifier.", alias="folderId")
37
38
  labels: Optional[Dict[str, StrictStr]] = Field(
38
39
  default=None,
39
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
40
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
40
41
  )
41
42
  name: StrictStr = Field(description="Folder name.")
42
43
  parent: Parent
@@ -78,7 +79,8 @@ class FolderResponse(BaseModel):
78
79
  return value
79
80
 
80
81
  model_config = ConfigDict(
81
- populate_by_name=True,
82
+ validate_by_name=True,
83
+ validate_by_alias=True,
82
84
  validate_assignment=True,
83
85
  protected_namespaces=(),
84
86
  )
@@ -89,8 +91,7 @@ class FolderResponse(BaseModel):
89
91
 
90
92
  def to_json(self) -> str:
91
93
  """Returns the JSON representation of the model using alias"""
92
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
93
- return json.dumps(self.to_dict())
94
+ return json.dumps(to_jsonable_python(self.to_dict()))
94
95
 
95
96
  @classmethod
96
97
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.parent import Parent
@@ -37,7 +38,7 @@ class GetFolderDetailsResponse(BaseModel):
37
38
  folder_id: UUID = Field(description="Globally unique folder identifier.", alias="folderId")
38
39
  labels: Optional[Dict[str, StrictStr]] = Field(
39
40
  default=None,
40
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
41
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
41
42
  )
42
43
  name: StrictStr = Field(description="Folder name.")
43
44
  parent: Parent
@@ -81,7 +82,8 @@ class GetFolderDetailsResponse(BaseModel):
81
82
  return value
82
83
 
83
84
  model_config = ConfigDict(
84
- populate_by_name=True,
85
+ validate_by_name=True,
86
+ validate_by_alias=True,
85
87
  validate_assignment=True,
86
88
  protected_namespaces=(),
87
89
  )
@@ -92,8 +94,7 @@ class GetFolderDetailsResponse(BaseModel):
92
94
 
93
95
  def to_json(self) -> str:
94
96
  """Returns the JSON representation of the model using alias"""
95
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
96
- return json.dumps(self.to_dict())
97
+ return json.dumps(to_jsonable_python(self.to_dict()))
97
98
 
98
99
  @classmethod
99
100
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -37,7 +38,7 @@ class GetProjectResponse(BaseModel):
37
38
  creation_time: datetime = Field(description="Timestamp at which the project was created.", alias="creationTime")
38
39
  labels: Optional[Dict[str, StrictStr]] = Field(
39
40
  default=None,
40
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
41
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
41
42
  )
42
43
  lifecycle_state: LifecycleState = Field(alias="lifecycleState")
43
44
  name: StrictStr = Field(description="Project name.")
@@ -84,7 +85,8 @@ class GetProjectResponse(BaseModel):
84
85
  return value
85
86
 
86
87
  model_config = ConfigDict(
87
- populate_by_name=True,
88
+ validate_by_name=True,
89
+ validate_by_alias=True,
88
90
  validate_assignment=True,
89
91
  protected_namespaces=(),
90
92
  )
@@ -95,8 +97,7 @@ class GetProjectResponse(BaseModel):
95
97
 
96
98
  def to_json(self) -> str:
97
99
  """Returns the JSON representation of the model using alias"""
98
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
99
- return json.dumps(self.to_dict())
100
+ return json.dumps(to_jsonable_python(self.to_dict()))
100
101
 
101
102
  @classmethod
102
103
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set, Union
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
  from stackit.resourcemanager.models.list_folders_response_items_inner import (
@@ -42,7 +43,8 @@ class ListFoldersResponse(BaseModel):
42
43
  __properties: ClassVar[List[str]] = ["items", "limit", "offset"]
43
44
 
44
45
  model_config = ConfigDict(
45
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
46
48
  validate_assignment=True,
47
49
  protected_namespaces=(),
48
50
  )
@@ -53,8 +55,7 @@ class ListFoldersResponse(BaseModel):
53
55
 
54
56
  def to_json(self) -> str:
55
57
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
59
 
59
60
  @classmethod
60
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.parent import Parent
@@ -36,7 +37,7 @@ class ListFoldersResponseItemsInner(BaseModel):
36
37
  folder_id: UUID = Field(description="Globally unique folder identifier.", alias="folderId")
37
38
  labels: Optional[Dict[str, StrictStr]] = Field(
38
39
  default=None,
39
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
40
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
40
41
  )
41
42
  name: StrictStr = Field(description="Name of the folder.")
42
43
  parent: Parent
@@ -78,7 +79,8 @@ class ListFoldersResponseItemsInner(BaseModel):
78
79
  return value
79
80
 
80
81
  model_config = ConfigDict(
81
- populate_by_name=True,
82
+ validate_by_name=True,
83
+ validate_by_alias=True,
82
84
  validate_assignment=True,
83
85
  protected_namespaces=(),
84
86
  )
@@ -89,8 +91,7 @@ class ListFoldersResponseItemsInner(BaseModel):
89
91
 
90
92
  def to_json(self) -> str:
91
93
  """Returns the JSON representation of the model using alias"""
92
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
93
- return json.dumps(self.to_dict())
94
+ return json.dumps(to_jsonable_python(self.to_dict()))
94
95
 
95
96
  @classmethod
96
97
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set, Union
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
  from stackit.resourcemanager.models.list_organizations_response_items_inner import (
@@ -42,7 +43,8 @@ class ListOrganizationsResponse(BaseModel):
42
43
  __properties: ClassVar[List[str]] = ["items", "limit", "offset"]
43
44
 
44
45
  model_config = ConfigDict(
45
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
46
48
  validate_assignment=True,
47
49
  protected_namespaces=(),
48
50
  )
@@ -53,8 +55,7 @@ class ListOrganizationsResponse(BaseModel):
53
55
 
54
56
  def to_json(self) -> str:
55
57
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
59
 
59
60
  @classmethod
60
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -37,7 +38,7 @@ class ListOrganizationsResponseItemsInner(BaseModel):
37
38
  )
38
39
  labels: Optional[Dict[str, StrictStr]] = Field(
39
40
  default=None,
40
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
41
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
41
42
  )
42
43
  lifecycle_state: LifecycleState = Field(alias="lifecycleState")
43
44
  name: StrictStr = Field(description="Name of the organization.")
@@ -82,7 +83,8 @@ class ListOrganizationsResponseItemsInner(BaseModel):
82
83
  return value
83
84
 
84
85
  model_config = ConfigDict(
85
- populate_by_name=True,
86
+ validate_by_name=True,
87
+ validate_by_alias=True,
86
88
  validate_assignment=True,
87
89
  protected_namespaces=(),
88
90
  )
@@ -93,8 +95,7 @@ class ListOrganizationsResponseItemsInner(BaseModel):
93
95
 
94
96
  def to_json(self) -> str:
95
97
  """Returns the JSON representation of the model using alias"""
96
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
97
- return json.dumps(self.to_dict())
98
+ return json.dumps(to_jsonable_python(self.to_dict()))
98
99
 
99
100
  @classmethod
100
101
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set, Union
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
  from stackit.resourcemanager.models.project import Project
@@ -40,7 +41,8 @@ class ListProjectsResponse(BaseModel):
40
41
  __properties: ClassVar[List[str]] = ["items", "limit", "offset"]
41
42
 
42
43
  model_config = ConfigDict(
43
- populate_by_name=True,
44
+ validate_by_name=True,
45
+ validate_by_alias=True,
44
46
  validate_assignment=True,
45
47
  protected_namespaces=(),
46
48
  )
@@ -51,8 +53,7 @@ class ListProjectsResponse(BaseModel):
51
53
 
52
54
  def to_json(self) -> str:
53
55
  """Returns the JSON representation of the model using alias"""
54
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
- return json.dumps(self.to_dict())
56
+ return json.dumps(to_jsonable_python(self.to_dict()))
56
57
 
57
58
  @classmethod
58
59
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -31,7 +32,8 @@ class Member(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["role", "subject"]
32
33
 
33
34
  model_config = ConfigDict(
34
- populate_by_name=True,
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
35
37
  validate_assignment=True,
36
38
  protected_namespaces=(),
37
39
  )
@@ -42,8 +44,7 @@ class Member(BaseModel):
42
44
 
43
45
  def to_json(self) -> str:
44
46
  """Returns the JSON representation of the model using alias"""
45
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
- return json.dumps(self.to_dict())
47
+ return json.dumps(to_jsonable_python(self.to_dict()))
47
48
 
48
49
  @classmethod
49
50
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -37,7 +38,7 @@ class OrganizationResponse(BaseModel):
37
38
  )
38
39
  labels: Optional[Dict[str, StrictStr]] = Field(
39
40
  default=None,
40
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
41
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
41
42
  )
42
43
  lifecycle_state: LifecycleState = Field(alias="lifecycleState")
43
44
  name: StrictStr = Field(description="Organization name.")
@@ -82,7 +83,8 @@ class OrganizationResponse(BaseModel):
82
83
  return value
83
84
 
84
85
  model_config = ConfigDict(
85
- populate_by_name=True,
86
+ validate_by_name=True,
87
+ validate_by_alias=True,
86
88
  validate_assignment=True,
87
89
  protected_namespaces=(),
88
90
  )
@@ -93,8 +95,7 @@ class OrganizationResponse(BaseModel):
93
95
 
94
96
  def to_json(self) -> str:
95
97
  """Returns the JSON representation of the model using alias"""
96
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
97
- return json.dumps(self.to_dict())
98
+ return json.dumps(to_jsonable_python(self.to_dict()))
98
99
 
99
100
  @classmethod
100
101
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
  from uuid import UUID
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -42,7 +43,8 @@ class Parent(BaseModel):
42
43
  return value
43
44
 
44
45
  model_config = ConfigDict(
45
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
46
48
  validate_assignment=True,
47
49
  protected_namespaces=(),
48
50
  )
@@ -53,8 +55,7 @@ class Parent(BaseModel):
53
55
 
54
56
  def to_json(self) -> str:
55
57
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
59
 
59
60
  @classmethod
60
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
  from uuid import UUID
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
 
@@ -51,7 +52,8 @@ class ParentListInner(BaseModel):
51
52
  return value
52
53
 
53
54
  model_config = ConfigDict(
54
- populate_by_name=True,
55
+ validate_by_name=True,
56
+ validate_by_alias=True,
55
57
  validate_assignment=True,
56
58
  protected_namespaces=(),
57
59
  )
@@ -62,8 +64,7 @@ class ParentListInner(BaseModel):
62
64
 
63
65
  def to_json(self) -> str:
64
66
  """Returns the JSON representation of the model using alias"""
65
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
- return json.dumps(self.to_dict())
67
+ return json.dumps(to_jsonable_python(self.to_dict()))
67
68
 
68
69
  @classmethod
69
70
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -34,7 +35,7 @@ class PartialUpdateFolderPayload(BaseModel):
34
35
  )
35
36
  labels: Optional[Dict[str, StrictStr]] = Field(
36
37
  default=None,
37
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
38
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
38
39
  )
39
40
  name: Optional[Annotated[str, Field(strict=True)]] = Field(
40
41
  default=None,
@@ -48,6 +49,9 @@ class PartialUpdateFolderPayload(BaseModel):
48
49
  if value is None:
49
50
  return value
50
51
 
52
+ if not isinstance(value, str):
53
+ value = str(value)
54
+
51
55
  if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
52
56
  raise ValueError(
53
57
  r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
@@ -55,7 +59,8 @@ class PartialUpdateFolderPayload(BaseModel):
55
59
  return value
56
60
 
57
61
  model_config = ConfigDict(
58
- populate_by_name=True,
62
+ validate_by_name=True,
63
+ validate_by_alias=True,
59
64
  validate_assignment=True,
60
65
  protected_namespaces=(),
61
66
  )
@@ -66,8 +71,7 @@ class PartialUpdateFolderPayload(BaseModel):
66
71
 
67
72
  def to_json(self) -> str:
68
73
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
74
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
75
 
72
76
  @classmethod
73
77
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -29,7 +30,7 @@ class PartialUpdateOrganizationPayload(BaseModel):
29
30
 
30
31
  labels: Optional[Dict[str, StrictStr]] = Field(
31
32
  default=None,
32
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
33
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
33
34
  )
34
35
  name: Optional[Annotated[str, Field(strict=True)]] = Field(
35
36
  default=None,
@@ -43,6 +44,9 @@ class PartialUpdateOrganizationPayload(BaseModel):
43
44
  if value is None:
44
45
  return value
45
46
 
47
+ if not isinstance(value, str):
48
+ value = str(value)
49
+
46
50
  if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
47
51
  raise ValueError(
48
52
  r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
@@ -50,7 +54,8 @@ class PartialUpdateOrganizationPayload(BaseModel):
50
54
  return value
51
55
 
52
56
  model_config = ConfigDict(
53
- populate_by_name=True,
57
+ validate_by_name=True,
58
+ validate_by_alias=True,
54
59
  validate_assignment=True,
55
60
  protected_namespaces=(),
56
61
  )
@@ -61,8 +66,7 @@ class PartialUpdateOrganizationPayload(BaseModel):
61
66
 
62
67
  def to_json(self) -> str:
63
68
  """Returns the JSON representation of the model using alias"""
64
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
- return json.dumps(self.to_dict())
69
+ return json.dumps(to_jsonable_python(self.to_dict()))
66
70
 
67
71
  @classmethod
68
72
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -34,7 +35,7 @@ class PartialUpdateProjectPayload(BaseModel):
34
35
  )
35
36
  labels: Optional[Dict[str, StrictStr]] = Field(
36
37
  default=None,
37
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
38
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
38
39
  )
39
40
  name: Optional[Annotated[str, Field(strict=True)]] = Field(
40
41
  default=None,
@@ -48,6 +49,9 @@ class PartialUpdateProjectPayload(BaseModel):
48
49
  if value is None:
49
50
  return value
50
51
 
52
+ if not isinstance(value, str):
53
+ value = str(value)
54
+
51
55
  if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
52
56
  raise ValueError(
53
57
  r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
@@ -55,7 +59,8 @@ class PartialUpdateProjectPayload(BaseModel):
55
59
  return value
56
60
 
57
61
  model_config = ConfigDict(
58
- populate_by_name=True,
62
+ validate_by_name=True,
63
+ validate_by_alias=True,
59
64
  validate_assignment=True,
60
65
  protected_namespaces=(),
61
66
  )
@@ -66,8 +71,7 @@ class PartialUpdateProjectPayload(BaseModel):
66
71
 
67
72
  def to_json(self) -> str:
68
73
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
74
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
75
 
72
76
  @classmethod
73
77
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Self
25
26
 
26
27
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -36,7 +37,7 @@ class Project(BaseModel):
36
37
  creation_time: datetime = Field(description="Timestamp at which the project was created.", alias="creationTime")
37
38
  labels: Optional[Dict[str, StrictStr]] = Field(
38
39
  default=None,
39
- description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
40
+ description='Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - To create a project within a STACKIT Network Area, setting the label `"networkArea": "<networkAreaID>"` is required. This can not be changed after project creation.',
40
41
  )
41
42
  lifecycle_state: LifecycleState = Field(alias="lifecycleState")
42
43
  name: StrictStr = Field(description="Project name.")
@@ -81,7 +82,8 @@ class Project(BaseModel):
81
82
  return value
82
83
 
83
84
  model_config = ConfigDict(
84
- populate_by_name=True,
85
+ validate_by_name=True,
86
+ validate_by_alias=True,
85
87
  validate_assignment=True,
86
88
  protected_namespaces=(),
87
89
  )
@@ -92,8 +94,7 @@ class Project(BaseModel):
92
94
 
93
95
  def to_json(self) -> str:
94
96
  """Returns the JSON representation of the model using alias"""
95
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
96
- return json.dumps(self.to_dict())
97
+ return json.dumps(to_jsonable_python(self.to_dict()))
97
98
 
98
99
  @classmethod
99
100
  def from_json(cls, json_str: str) -> Optional[Self]: