stackit-vpn 0.1.0__tar.gz → 0.2.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 (53) hide show
  1. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/PKG-INFO +1 -1
  2. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/pyproject.toml +1 -1
  3. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/api_client.py +15 -17
  4. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/api_error.py +4 -3
  5. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/api_error_detail.py +4 -3
  6. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/api_error_response.py +4 -3
  7. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/bgp_gateway_config.py +4 -3
  8. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/bgp_status.py +4 -3
  9. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/bgp_status_peers.py +4 -3
  10. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/bgp_status_routes.py +4 -3
  11. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/bgp_tunnel_config.py +4 -3
  12. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/connection_list.py +4 -3
  13. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/connection_response.py +7 -3
  14. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/connection_status_response.py +4 -3
  15. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/create_gateway_connection_payload.py +7 -3
  16. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/create_vpn_gateway_payload.py +7 -3
  17. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py +4 -3
  18. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/gateway.py +7 -3
  19. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/gateway_list.py +4 -3
  20. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/gateway_response.py +7 -3
  21. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/gateway_status_response.py +4 -3
  22. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/peering_config.py +10 -3
  23. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/phase.py +4 -3
  24. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/phase1_status.py +4 -3
  25. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/phase2_status.py +4 -3
  26. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/plan.py +4 -3
  27. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/plan_list.py +4 -3
  28. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/quota.py +4 -3
  29. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/quota_list.py +4 -3
  30. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/quota_list_response.py +4 -3
  31. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/tunnel_configuration.py +7 -3
  32. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/tunnel_configuration_phase1.py +4 -3
  33. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/tunnel_configuration_phase2.py +4 -3
  34. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/tunnel_status.py +4 -3
  35. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/update_gateway_connection_payload.py +7 -3
  36. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/update_vpn_gateway_payload.py +7 -3
  37. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/vpn_tunnels.py +4 -3
  38. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/.gitignore +0 -0
  39. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/LICENSE.md +0 -0
  40. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/NOTICE.txt +0 -0
  41. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/README.md +0 -0
  42. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/__init__.py +0 -0
  43. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/api/__init__.py +0 -0
  44. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/api/default_api.py +0 -0
  45. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/api_response.py +0 -0
  46. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/configuration.py +0 -0
  47. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/exceptions.py +0 -0
  48. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/__init__.py +0 -0
  49. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/gateway_status.py +0 -0
  50. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/region.py +0 -0
  51. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/models/routing_type.py +0 -0
  52. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/py.typed +0 -0
  53. {stackit_vpn-0.1.0 → stackit_vpn-0.2.0}/src/stackit/vpn/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-vpn
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: STACKIT VPN 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-vpn"
3
- version = "v0.1.0"
3
+ version = "v0.2.0"
4
4
  description = "STACKIT VPN 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:
@@ -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, StrictInt, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.api_error_detail import APIErrorDetail
@@ -35,7 +36,8 @@ class APIError(BaseModel):
35
36
  __properties: ClassVar[List[str]] = ["code", "details", "message", "status"]
36
37
 
37
38
  model_config = ConfigDict(
38
- populate_by_name=True,
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
39
41
  validate_assignment=True,
40
42
  protected_namespaces=(),
41
43
  )
@@ -46,8 +48,7 @@ class APIError(BaseModel):
46
48
 
47
49
  def to_json(self) -> str:
48
50
  """Returns the JSON representation of the model using alias"""
49
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
- return json.dumps(self.to_dict())
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
52
 
52
53
  @classmethod
53
54
  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, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -42,7 +43,8 @@ class APIErrorDetail(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 APIErrorDetail(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]:
@@ -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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.api_error import APIError
@@ -32,7 +33,8 @@ class APIErrorResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["error"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class APIErrorResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
 
@@ -41,7 +42,8 @@ class BGPGatewayConfig(BaseModel):
41
42
  __properties: ClassVar[List[str]] = ["localAsn", "overrideAdvertisedRoutes"]
42
43
 
43
44
  model_config = ConfigDict(
44
- populate_by_name=True,
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
45
47
  validate_assignment=True,
46
48
  protected_namespaces=(),
47
49
  )
@@ -52,8 +54,7 @@ class BGPGatewayConfig(BaseModel):
52
54
 
53
55
  def to_json(self) -> str:
54
56
  """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
58
 
58
59
  @classmethod
59
60
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.bgp_status_peers import BGPStatusPeers
@@ -34,7 +35,8 @@ class BGPStatus(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["peers", "routes"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class BGPStatus(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  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, StrictInt, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -36,7 +37,8 @@ class BGPStatusPeers(BaseModel):
36
37
  __properties: ClassVar[List[str]] = ["localAs", "peerUptime", "pfxRcd", "pfxSnt", "remoteAs", "remoteIP", "state"]
37
38
 
38
39
  model_config = ConfigDict(
39
- populate_by_name=True,
40
+ validate_by_name=True,
41
+ validate_by_alias=True,
40
42
  validate_assignment=True,
41
43
  protected_namespaces=(),
42
44
  )
@@ -47,8 +49,7 @@ class BGPStatusPeers(BaseModel):
47
49
 
48
50
  def to_json(self) -> str:
49
51
  """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
53
 
53
54
  @classmethod
54
55
  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, StrictInt, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -34,7 +35,8 @@ class BGPStatusRoutes(BaseModel):
34
35
  __properties: ClassVar[List[str]] = ["network", "origin", "path", "peerId", "weight"]
35
36
 
36
37
  model_config = ConfigDict(
37
- populate_by_name=True,
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
38
40
  validate_assignment=True,
39
41
  protected_namespaces=(),
40
42
  )
@@ -45,8 +47,7 @@ class BGPStatusRoutes(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
 
@@ -33,7 +34,8 @@ class BGPTunnelConfig(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["remoteAsn"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -44,8 +46,7 @@ class BGPTunnelConfig(BaseModel):
44
46
 
45
47
  def to_json(self) -> str:
46
48
  """Returns the JSON representation of the model using alias"""
47
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
- return json.dumps(self.to_dict())
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
50
 
50
51
  @classmethod
51
52
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.connection_response import ConnectionResponse
@@ -32,7 +33,8 @@ class ConnectionList(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["connections"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class ConnectionList(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
  from uuid import UUID
21
21
 
22
22
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
23
+ from pydantic_core import to_jsonable_python
23
24
  from typing_extensions import Annotated, Self
24
25
 
25
26
  from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
@@ -75,12 +76,16 @@ class ConnectionResponse(BaseModel):
75
76
  @field_validator("display_name")
76
77
  def display_name_validate_regular_expression(cls, value):
77
78
  """Validates the regular expression"""
79
+ if not isinstance(value, str):
80
+ value = str(value)
81
+
78
82
  if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
79
83
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
80
84
  return value
81
85
 
82
86
  model_config = ConfigDict(
83
- populate_by_name=True,
87
+ validate_by_name=True,
88
+ validate_by_alias=True,
84
89
  validate_assignment=True,
85
90
  protected_namespaces=(),
86
91
  )
@@ -91,8 +96,7 @@ class ConnectionResponse(BaseModel):
91
96
 
92
97
  def to_json(self) -> str:
93
98
  """Returns the JSON representation of the model using alias"""
94
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
95
- return json.dumps(self.to_dict())
99
+ return json.dumps(to_jsonable_python(self.to_dict()))
96
100
 
97
101
  @classmethod
98
102
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -25,6 +25,7 @@ from pydantic import (
25
25
  StrictBool,
26
26
  StrictStr,
27
27
  )
28
+ from pydantic_core import to_jsonable_python
28
29
  from typing_extensions import Self
29
30
 
30
31
  from stackit.vpn.models.tunnel_status import TunnelStatus
@@ -44,7 +45,8 @@ class ConnectionStatusResponse(BaseModel):
44
45
  __properties: ClassVar[List[str]] = ["displayName", "enabled", "id", "tunnels"]
45
46
 
46
47
  model_config = ConfigDict(
47
- populate_by_name=True,
48
+ validate_by_name=True,
49
+ validate_by_alias=True,
48
50
  validate_assignment=True,
49
51
  protected_namespaces=(),
50
52
  )
@@ -55,8 +57,7 @@ class ConnectionStatusResponse(BaseModel):
55
57
 
56
58
  def to_json(self) -> str:
57
59
  """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
+ return json.dumps(to_jsonable_python(self.to_dict()))
60
61
 
61
62
  @classmethod
62
63
  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, StrictBool, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
@@ -67,12 +68,16 @@ class CreateGatewayConnectionPayload(BaseModel):
67
68
  @field_validator("display_name")
68
69
  def display_name_validate_regular_expression(cls, value):
69
70
  """Validates the regular expression"""
71
+ if not isinstance(value, str):
72
+ value = str(value)
73
+
70
74
  if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
71
75
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
72
76
  return value
73
77
 
74
78
  model_config = ConfigDict(
75
- populate_by_name=True,
79
+ validate_by_name=True,
80
+ validate_by_alias=True,
76
81
  validate_assignment=True,
77
82
  protected_namespaces=(),
78
83
  )
@@ -83,8 +88,7 @@ class CreateGatewayConnectionPayload(BaseModel):
83
88
 
84
89
  def to_json(self) -> str:
85
90
  """Returns the JSON representation of the model using alias"""
86
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
- return json.dumps(self.to_dict())
91
+ return json.dumps(to_jsonable_python(self.to_dict()))
88
92
 
89
93
  @classmethod
90
94
  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.vpn.models.bgp_gateway_config import BGPGatewayConfig
@@ -49,12 +50,16 @@ class CreateVPNGatewayPayload(BaseModel):
49
50
  @field_validator("display_name")
50
51
  def display_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-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
53
57
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
54
58
  return value
55
59
 
56
60
  model_config = ConfigDict(
57
- populate_by_name=True,
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
58
63
  validate_assignment=True,
59
64
  protected_namespaces=(),
60
65
  )
@@ -65,8 +70,7 @@ class CreateVPNGatewayPayload(BaseModel):
65
70
 
66
71
  def to_json(self) -> str:
67
72
  """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())
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
74
 
71
75
  @classmethod
72
76
  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 CreateVPNGatewayPayloadAvailabilityZones(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["tunnel1", "tunnel2"]
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 CreateVPNGatewayPayloadAvailabilityZones(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]:
@@ -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.vpn.models.bgp_gateway_config import BGPGatewayConfig
@@ -49,12 +50,16 @@ class Gateway(BaseModel):
49
50
  @field_validator("display_name")
50
51
  def display_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-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
53
57
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
54
58
  return value
55
59
 
56
60
  model_config = ConfigDict(
57
- populate_by_name=True,
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
58
63
  validate_assignment=True,
59
64
  protected_namespaces=(),
60
65
  )
@@ -65,8 +70,7 @@ class Gateway(BaseModel):
65
70
 
66
71
  def to_json(self) -> str:
67
72
  """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())
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
74
 
71
75
  @classmethod
72
76
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.gateway_response import GatewayResponse
@@ -32,7 +33,8 @@ class GatewayList(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["gateways"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class GatewayList(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
  from uuid import UUID
21
21
 
22
22
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from pydantic_core import to_jsonable_python
23
24
  from typing_extensions import Annotated, Self
24
25
 
25
26
  from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig
@@ -62,12 +63,16 @@ class GatewayResponse(BaseModel):
62
63
  @field_validator("display_name")
63
64
  def display_name_validate_regular_expression(cls, value):
64
65
  """Validates the regular expression"""
66
+ if not isinstance(value, str):
67
+ value = str(value)
68
+
65
69
  if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
66
70
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
67
71
  return value
68
72
 
69
73
  model_config = ConfigDict(
70
- populate_by_name=True,
74
+ validate_by_name=True,
75
+ validate_by_alias=True,
71
76
  validate_assignment=True,
72
77
  protected_namespaces=(),
73
78
  )
@@ -78,8 +83,7 @@ class GatewayResponse(BaseModel):
78
83
 
79
84
  def to_json(self) -> str:
80
85
  """Returns the JSON representation of the model using alias"""
81
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
82
- return json.dumps(self.to_dict())
86
+ return json.dumps(to_jsonable_python(self.to_dict()))
83
87
 
84
88
  @classmethod
85
89
  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
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.vpn.models.connection_status_response import ConnectionStatusResponse
@@ -41,7 +42,8 @@ class GatewayStatusResponse(BaseModel):
41
42
  __properties: ClassVar[List[str]] = ["connections", "displayName", "gatewayStatus", "id", "tunnels"]
42
43
 
43
44
  model_config = ConfigDict(
44
- populate_by_name=True,
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
45
47
  validate_assignment=True,
46
48
  protected_namespaces=(),
47
49
  )
@@ -52,8 +54,7 @@ class GatewayStatusResponse(BaseModel):
52
54
 
53
55
  def to_json(self) -> str:
54
56
  """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
58
 
58
59
  @classmethod
59
60
  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, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -37,6 +38,9 @@ class PeeringConfig(BaseModel):
37
38
  if value is None:
38
39
  return value
39
40
 
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value):
41
45
  raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/")
42
46
  return value
@@ -47,12 +51,16 @@ class PeeringConfig(BaseModel):
47
51
  if value is None:
48
52
  return value
49
53
 
54
+ if not isinstance(value, str):
55
+ value = str(value)
56
+
50
57
  if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value):
51
58
  raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/")
52
59
  return value
53
60
 
54
61
  model_config = ConfigDict(
55
- populate_by_name=True,
62
+ validate_by_name=True,
63
+ validate_by_alias=True,
56
64
  validate_assignment=True,
57
65
  protected_namespaces=(),
58
66
  )
@@ -63,8 +71,7 @@ class PeeringConfig(BaseModel):
63
71
 
64
72
  def to_json(self) -> str:
65
73
  """Returns the JSON representation of the model using alias"""
66
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
- return json.dumps(self.to_dict())
74
+ return json.dumps(to_jsonable_python(self.to_dict()))
68
75
 
69
76
  @classmethod
70
77
  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, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -65,7 +66,8 @@ class Phase(BaseModel):
65
66
  return value
66
67
 
67
68
  model_config = ConfigDict(
68
- populate_by_name=True,
69
+ validate_by_name=True,
70
+ validate_by_alias=True,
69
71
  validate_assignment=True,
70
72
  protected_namespaces=(),
71
73
  )
@@ -76,8 +78,7 @@ class Phase(BaseModel):
76
78
 
77
79
  def to_json(self) -> str:
78
80
  """Returns the JSON representation of the model using alias"""
79
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
80
- return json.dumps(self.to_dict())
81
+ return json.dumps(to_jsonable_python(self.to_dict()))
81
82
 
82
83
  @classmethod
83
84
  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
 
@@ -41,7 +42,8 @@ class Phase1Status(BaseModel):
41
42
  __properties: ClassVar[List[str]] = ["dhGroup", "encryptionAlgorithm", "integrityAlgorithm", "state"]
42
43
 
43
44
  model_config = ConfigDict(
44
- populate_by_name=True,
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
45
47
  validate_assignment=True,
46
48
  protected_namespaces=(),
47
49
  )
@@ -52,8 +54,7 @@ class Phase1Status(BaseModel):
52
54
 
53
55
  def to_json(self) -> str:
54
56
  """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
58
 
58
59
  @classmethod
59
60
  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
 
@@ -79,7 +80,8 @@ class Phase2Status(BaseModel):
79
80
  ]
80
81
 
81
82
  model_config = ConfigDict(
82
- populate_by_name=True,
83
+ validate_by_name=True,
84
+ validate_by_alias=True,
83
85
  validate_assignment=True,
84
86
  protected_namespaces=(),
85
87
  )
@@ -90,8 +92,7 @@ class Phase2Status(BaseModel):
90
92
 
91
93
  def to_json(self) -> str:
92
94
  """Returns the JSON representation of the model using alias"""
93
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
- return json.dumps(self.to_dict())
95
+ return json.dumps(to_jsonable_python(self.to_dict()))
95
96
 
96
97
  @classmethod
97
98
  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, StrictInt, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -42,7 +43,8 @@ class Plan(BaseModel):
42
43
  __properties: ClassVar[List[str]] = ["maxBandwidth", "maxConnections", "name", "planId", "sku"]
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 Plan(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]:
@@ -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
  from stackit.vpn.models.plan import Plan
@@ -35,7 +36,8 @@ class PlanList(BaseModel):
35
36
  __properties: ClassVar[List[str]] = ["defaultPlanId", "plans"]
36
37
 
37
38
  model_config = ConfigDict(
38
- populate_by_name=True,
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
39
41
  validate_assignment=True,
40
42
  protected_namespaces=(),
41
43
  )
@@ -46,8 +48,7 @@ class PlanList(BaseModel):
46
48
 
47
49
  def to_json(self) -> str:
48
50
  """Returns the JSON representation of the model using alias"""
49
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
- return json.dumps(self.to_dict())
51
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
52
 
52
53
  @classmethod
53
54
  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, StrictInt
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -31,7 +32,8 @@ class Quota(BaseModel):
31
32
  __properties: ClassVar[List[str]] = ["limit", "usage"]
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 Quota(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]:
@@ -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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.quota import Quota
@@ -32,7 +33,8 @@ class QuotaList(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["gateways"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class QuotaList(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  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
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.quota_list import QuotaList
@@ -32,7 +33,8 @@ class QuotaListResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["quotas"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class QuotaListResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  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, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.vpn.models.bgp_tunnel_config import BGPTunnelConfig
@@ -47,12 +48,16 @@ class TunnelConfiguration(BaseModel):
47
48
  @field_validator("remote_address")
48
49
  def remote_address_validate_regular_expression(cls, value):
49
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
50
54
  if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value):
51
55
  raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/")
52
56
  return value
53
57
 
54
58
  model_config = ConfigDict(
55
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
56
61
  validate_assignment=True,
57
62
  protected_namespaces=(),
58
63
  )
@@ -63,8 +68,7 @@ class TunnelConfiguration(BaseModel):
63
68
 
64
69
  def to_json(self) -> str:
65
70
  """Returns the JSON representation of the model using alias"""
66
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
68
72
 
69
73
  @classmethod
70
74
  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, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
 
@@ -68,7 +69,8 @@ class TunnelConfigurationPhase1(BaseModel):
68
69
  return value
69
70
 
70
71
  model_config = ConfigDict(
71
- populate_by_name=True,
72
+ validate_by_name=True,
73
+ validate_by_alias=True,
72
74
  validate_assignment=True,
73
75
  protected_namespaces=(),
74
76
  )
@@ -79,8 +81,7 @@ class TunnelConfigurationPhase1(BaseModel):
79
81
 
80
82
  def to_json(self) -> str:
81
83
  """Returns the JSON representation of the model using alias"""
82
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
83
- return json.dumps(self.to_dict())
84
+ return json.dumps(to_jsonable_python(self.to_dict()))
84
85
 
85
86
  @classmethod
86
87
  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, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Annotated, Self
22
23
 
23
24
 
@@ -105,7 +106,8 @@ class TunnelConfigurationPhase2(BaseModel):
105
106
  return value
106
107
 
107
108
  model_config = ConfigDict(
108
- populate_by_name=True,
109
+ validate_by_name=True,
110
+ validate_by_alias=True,
109
111
  validate_assignment=True,
110
112
  protected_namespaces=(),
111
113
  )
@@ -116,8 +118,7 @@ class TunnelConfigurationPhase2(BaseModel):
116
118
 
117
119
  def to_json(self) -> str:
118
120
  """Returns the JSON representation of the model using alias"""
119
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
120
- return json.dumps(self.to_dict())
121
+ return json.dumps(to_jsonable_python(self.to_dict()))
121
122
 
122
123
  @classmethod
123
124
  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, StrictBool, StrictStr, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.phase1_status import Phase1Status
@@ -46,7 +47,8 @@ class TunnelStatus(BaseModel):
46
47
  return value
47
48
 
48
49
  model_config = ConfigDict(
49
- populate_by_name=True,
50
+ validate_by_name=True,
51
+ validate_by_alias=True,
50
52
  validate_assignment=True,
51
53
  protected_namespaces=(),
52
54
  )
@@ -57,8 +59,7 @@ class TunnelStatus(BaseModel):
57
59
 
58
60
  def to_json(self) -> str:
59
61
  """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
+ return json.dumps(to_jsonable_python(self.to_dict()))
62
63
 
63
64
  @classmethod
64
65
  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, StrictBool, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
@@ -67,12 +68,16 @@ class UpdateGatewayConnectionPayload(BaseModel):
67
68
  @field_validator("display_name")
68
69
  def display_name_validate_regular_expression(cls, value):
69
70
  """Validates the regular expression"""
71
+ if not isinstance(value, str):
72
+ value = str(value)
73
+
70
74
  if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
71
75
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
72
76
  return value
73
77
 
74
78
  model_config = ConfigDict(
75
- populate_by_name=True,
79
+ validate_by_name=True,
80
+ validate_by_alias=True,
76
81
  validate_assignment=True,
77
82
  protected_namespaces=(),
78
83
  )
@@ -83,8 +88,7 @@ class UpdateGatewayConnectionPayload(BaseModel):
83
88
 
84
89
  def to_json(self) -> str:
85
90
  """Returns the JSON representation of the model using alias"""
86
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
- return json.dumps(self.to_dict())
91
+ return json.dumps(to_jsonable_python(self.to_dict()))
88
92
 
89
93
  @classmethod
90
94
  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.vpn.models.bgp_gateway_config import BGPGatewayConfig
@@ -49,12 +50,16 @@ class UpdateVPNGatewayPayload(BaseModel):
49
50
  @field_validator("display_name")
50
51
  def display_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-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
53
57
  raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
54
58
  return value
55
59
 
56
60
  model_config = ConfigDict(
57
- populate_by_name=True,
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
58
63
  validate_assignment=True,
59
64
  protected_namespaces=(),
60
65
  )
@@ -65,8 +70,7 @@ class UpdateVPNGatewayPayload(BaseModel):
65
70
 
66
71
  def to_json(self) -> str:
67
72
  """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())
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
74
 
71
75
  @classmethod
72
76
  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, field_validator
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.vpn.models.bgp_status import BGPStatus
@@ -48,7 +49,8 @@ class VPNTunnels(BaseModel):
48
49
  return value
49
50
 
50
51
  model_config = ConfigDict(
51
- populate_by_name=True,
52
+ validate_by_name=True,
53
+ validate_by_alias=True,
52
54
  validate_assignment=True,
53
55
  protected_namespaces=(),
54
56
  )
@@ -59,8 +61,7 @@ class VPNTunnels(BaseModel):
59
61
 
60
62
  def to_json(self) -> str:
61
63
  """Returns the JSON representation of the model using alias"""
62
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63
- return json.dumps(self.to_dict())
64
+ return json.dumps(to_jsonable_python(self.to_dict()))
64
65
 
65
66
  @classmethod
66
67
  def from_json(cls, json_str: str) -> Optional[Self]:
File without changes
File without changes
File without changes
File without changes