diff --git a/services/vpn/oas_commit b/services/vpn/oas_commit index 36076afe8..b129c2291 100644 --- a/services/vpn/oas_commit +++ b/services/vpn/oas_commit @@ -1 +1 @@ -87a3ad63dec0a953ff5c6072ad9a15fddd8ec5f8 +98c11e0ee4834ddaaa474eccc437d234e6276a70 diff --git a/services/vpn/src/stackit/vpn/__init__.py b/services/vpn/src/stackit/vpn/__init__.py index f996eedb9..3c2369e87 100644 --- a/services/vpn/src/stackit/vpn/__init__.py +++ b/services/vpn/src/stackit/vpn/__init__.py @@ -7,7 +7,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/api/default_api.py b/services/vpn/src/stackit/vpn/api/default_api.py index b5f4d779f..298c1cfbe 100644 --- a/services/vpn/src/stackit/vpn/api/default_api.py +++ b/services/vpn/src/stackit/vpn/api/default_api.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -334,7 +334,7 @@ def _create_gateway_connection_serialize( return self.api_client.param_serialize( method="POST", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -613,7 +613,7 @@ def _create_vpn_gateway_serialize( return self.api_client.param_serialize( method="POST", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -899,7 +899,7 @@ def _delete_gateway_connection_serialize( return self.api_client.param_serialize( method="DELETE", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1167,7 +1167,7 @@ def _delete_vpn_gateway_serialize( return self.api_client.param_serialize( method="DELETE", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1453,7 +1453,7 @@ def _get_gateway_connection_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1739,7 +1739,7 @@ def _get_gateway_connection_status_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}/status", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}/status", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2010,7 +2010,7 @@ def _get_vpn_gateway_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2281,7 +2281,7 @@ def _get_vpn_gateway_status_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/status", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/status", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2575,7 +2575,7 @@ def _list_gateway_connections_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2807,7 +2807,7 @@ def _list_plans_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/regions/{region}/plans", + resource_path="/v1/regions/{region}/plans", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3054,7 +3054,7 @@ def _list_quotas_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/quotas", + resource_path="/v1/projects/{projectId}/regions/{region}/quotas", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3330,7 +3330,7 @@ def _list_vpn_gateways_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3639,7 +3639,7 @@ def _update_gateway_connection_serialize( return self.api_client.param_serialize( method="PUT", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}/connections/{connectionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3933,7 +3933,7 @@ def _update_vpn_gateway_serialize( return self.api_client.param_serialize( method="PUT", - resource_path="/v1beta1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", + resource_path="/v1/projects/{projectId}/regions/{region}/gateways/{gatewayId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/services/vpn/src/stackit/vpn/api_client.py b/services/vpn/src/stackit/vpn/api_client.py index 9d5053fa5..52c281a70 100644 --- a/services/vpn/src/stackit/vpn/api_client.py +++ b/services/vpn/src/stackit/vpn/api_client.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -66,6 +66,7 @@ class ApiClient: "date": datetime.date, "datetime": datetime.datetime, "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } _pool = None @@ -265,7 +266,7 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) @@ -326,25 +327,20 @@ def sanitize_for_serialization(self, obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return str(obj) - elif isinstance(obj, dict): - obj_dict = obj + return {key: self.sanitize_for_serialization(val) for key, val in obj.items()} + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - if isinstance(obj_dict, list): - # 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 - return self.sanitize_for_serialization(obj_dict) + obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return self.sanitize_for_serialization(obj_dict) def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. @@ -417,6 +413,8 @@ def __deserialize(self, data, klass): return self.__deserialize_datetime(data) elif klass is decimal.Decimal: return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/services/vpn/src/stackit/vpn/configuration.py b/services/vpn/src/stackit/vpn/configuration.py index fd94651f4..bdb518195 100644 --- a/services/vpn/src/stackit/vpn/configuration.py +++ b/services/vpn/src/stackit/vpn/configuration.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/exceptions.py b/services/vpn/src/stackit/vpn/exceptions.py index 6d62709fd..843d3b588 100644 --- a/services/vpn/src/stackit/vpn/exceptions.py +++ b/services/vpn/src/stackit/vpn/exceptions.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/models/__init__.py b/services/vpn/src/stackit/vpn/models/__init__.py index 105031e08..7f57391b8 100644 --- a/services/vpn/src/stackit/vpn/models/__init__.py +++ b/services/vpn/src/stackit/vpn/models/__init__.py @@ -6,7 +6,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/models/api_error.py b/services/vpn/src/stackit/vpn/models/api_error.py index 5eaefdca8..7874a7772 100644 --- a/services/vpn/src/stackit/vpn/models/api_error.py +++ b/services/vpn/src/stackit/vpn/models/api_error.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.api_error_detail import APIErrorDetail @@ -35,7 +36,8 @@ class APIError(BaseModel): __properties: ClassVar[List[str]] = ["code", "details", "message", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/api_error_detail.py b/services/vpn/src/stackit/vpn/models/api_error_detail.py index b0a61ec6e..28806d27d 100644 --- a/services/vpn/src/stackit/vpn/models/api_error_detail.py +++ b/services/vpn/src/stackit/vpn/models/api_error_detail.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -42,7 +43,8 @@ def reason_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/api_error_response.py b/services/vpn/src/stackit/vpn/models/api_error_response.py index 340d4d387..c347c1335 100644 --- a/services/vpn/src/stackit/vpn/models/api_error_response.py +++ b/services/vpn/src/stackit/vpn/models/api_error_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.api_error import APIError @@ -32,7 +33,8 @@ class APIErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/bgp_gateway_config.py b/services/vpn/src/stackit/vpn/models/bgp_gateway_config.py index c7a909047..c60a82be4 100644 --- a/services/vpn/src/stackit/vpn/models/bgp_gateway_config.py +++ b/services/vpn/src/stackit/vpn/models/bgp_gateway_config.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -41,7 +42,8 @@ class BGPGatewayConfig(BaseModel): __properties: ClassVar[List[str]] = ["localAsn", "overrideAdvertisedRoutes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/bgp_status.py b/services/vpn/src/stackit/vpn/models/bgp_status.py index 07b7fc994..5c320dfd7 100644 --- a/services/vpn/src/stackit/vpn/models/bgp_status.py +++ b/services/vpn/src/stackit/vpn/models/bgp_status.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.bgp_status_peers import BGPStatusPeers @@ -34,7 +35,8 @@ class BGPStatus(BaseModel): __properties: ClassVar[List[str]] = ["peers", "routes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/bgp_status_peers.py b/services/vpn/src/stackit/vpn/models/bgp_status_peers.py index 7ff7cf26f..71ad17584 100644 --- a/services/vpn/src/stackit/vpn/models/bgp_status_peers.py +++ b/services/vpn/src/stackit/vpn/models/bgp_status_peers.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -36,7 +37,8 @@ class BGPStatusPeers(BaseModel): __properties: ClassVar[List[str]] = ["localAs", "peerUptime", "pfxRcd", "pfxSnt", "remoteAs", "remoteIP", "state"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/bgp_status_routes.py b/services/vpn/src/stackit/vpn/models/bgp_status_routes.py index 4281e4c58..558e9c3f5 100644 --- a/services/vpn/src/stackit/vpn/models/bgp_status_routes.py +++ b/services/vpn/src/stackit/vpn/models/bgp_status_routes.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class BGPStatusRoutes(BaseModel): __properties: ClassVar[List[str]] = ["network", "origin", "path", "peerId", "weight"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/bgp_tunnel_config.py b/services/vpn/src/stackit/vpn/models/bgp_tunnel_config.py index b815e9463..f54288bdd 100644 --- a/services/vpn/src/stackit/vpn/models/bgp_tunnel_config.py +++ b/services/vpn/src/stackit/vpn/models/bgp_tunnel_config.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -33,7 +34,8 @@ class BGPTunnelConfig(BaseModel): __properties: ClassVar[List[str]] = ["remoteAsn"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/connection_list.py b/services/vpn/src/stackit/vpn/models/connection_list.py index a93c36ebf..1ecc08381 100644 --- a/services/vpn/src/stackit/vpn/models/connection_list.py +++ b/services/vpn/src/stackit/vpn/models/connection_list.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.connection_response import ConnectionResponse @@ -32,7 +33,8 @@ class ConnectionList(BaseModel): __properties: ClassVar[List[str]] = ["connections"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/connection_response.py b/services/vpn/src/stackit/vpn/models/connection_response.py index 38d1a1774..f69404966 100644 --- a/services/vpn/src/stackit/vpn/models/connection_response.py +++ b/services/vpn/src/stackit/vpn/models/connection_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.tunnel_configuration import TunnelConfiguration @@ -75,12 +76,16 @@ class ConnectionResponse(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -91,8 +96,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/connection_status_response.py b/services/vpn/src/stackit/vpn/models/connection_status_response.py index b2590f036..ee045b785 100644 --- a/services/vpn/src/stackit/vpn/models/connection_status_response.py +++ b/services/vpn/src/stackit/vpn/models/connection_status_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -25,6 +25,7 @@ StrictBool, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.tunnel_status import TunnelStatus @@ -44,7 +45,8 @@ class ConnectionStatusResponse(BaseModel): __properties: ClassVar[List[str]] = ["displayName", "enabled", "id", "tunnels"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/create_gateway_connection_payload.py b/services/vpn/src/stackit/vpn/models/create_gateway_connection_payload.py index 7e637d74f..d938507e0 100644 --- a/services/vpn/src/stackit/vpn/models/create_gateway_connection_payload.py +++ b/services/vpn/src/stackit/vpn/models/create_gateway_connection_payload.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.tunnel_configuration import TunnelConfiguration @@ -67,12 +68,16 @@ class CreateGatewayConnectionPayload(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -83,8 +88,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload.py b/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload.py index 95bc7e664..d053c42ad 100644 --- a/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload.py +++ b/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig @@ -49,12 +50,16 @@ class CreateVPNGatewayPayload(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +70,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py b/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py index e35134648..a45b53caf 100644 --- a/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py +++ b/services/vpn/src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class CreateVPNGatewayPayloadAvailabilityZones(BaseModel): __properties: ClassVar[List[str]] = ["tunnel1", "tunnel2"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/gateway.py b/services/vpn/src/stackit/vpn/models/gateway.py index 6ca3d44fd..3fb190753 100644 --- a/services/vpn/src/stackit/vpn/models/gateway.py +++ b/services/vpn/src/stackit/vpn/models/gateway.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig @@ -49,12 +50,16 @@ class Gateway(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +70,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/gateway_list.py b/services/vpn/src/stackit/vpn/models/gateway_list.py index 0f22b8494..aeea89728 100644 --- a/services/vpn/src/stackit/vpn/models/gateway_list.py +++ b/services/vpn/src/stackit/vpn/models/gateway_list.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.gateway_response import GatewayResponse @@ -32,7 +33,8 @@ class GatewayList(BaseModel): __properties: ClassVar[List[str]] = ["gateways"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/gateway_response.py b/services/vpn/src/stackit/vpn/models/gateway_response.py index cc2694e02..1aa143faf 100644 --- a/services/vpn/src/stackit/vpn/models/gateway_response.py +++ b/services/vpn/src/stackit/vpn/models/gateway_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig @@ -62,12 +63,16 @@ class GatewayResponse(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -78,8 +83,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/gateway_status.py b/services/vpn/src/stackit/vpn/models/gateway_status.py index c3a7d7177..c382797ab 100644 --- a/services/vpn/src/stackit/vpn/models/gateway_status.py +++ b/services/vpn/src/stackit/vpn/models/gateway_status.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/models/gateway_status_response.py b/services/vpn/src/stackit/vpn/models/gateway_status_response.py index f61d1238c..50d2b66cd 100644 --- a/services/vpn/src/stackit/vpn/models/gateway_status_response.py +++ b/services/vpn/src/stackit/vpn/models/gateway_status_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.connection_status_response import ConnectionStatusResponse @@ -41,7 +42,8 @@ class GatewayStatusResponse(BaseModel): __properties: ClassVar[List[str]] = ["connections", "displayName", "gatewayStatus", "id", "tunnels"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/peering_config.py b/services/vpn/src/stackit/vpn/models/peering_config.py index a9d42d1c0..8d77ae61b 100644 --- a/services/vpn/src/stackit/vpn/models/peering_config.py +++ b/services/vpn/src/stackit/vpn/models/peering_config.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -37,6 +38,9 @@ def local_address_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value): raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/") return value @@ -47,12 +51,16 @@ def remote_address_validate_regular_expression(cls, value): if value is None: return value + if not isinstance(value, str): + value = str(value) + if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value): raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +71,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/phase.py b/services/vpn/src/stackit/vpn/models/phase.py index 3a74c5ba6..8e0c5b5c3 100644 --- a/services/vpn/src/stackit/vpn/models/phase.py +++ b/services/vpn/src/stackit/vpn/models/phase.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -65,7 +66,8 @@ def integrity_algorithms_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -76,8 +78,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/phase1_status.py b/services/vpn/src/stackit/vpn/models/phase1_status.py index ff75e6a95..4019bf720 100644 --- a/services/vpn/src/stackit/vpn/models/phase1_status.py +++ b/services/vpn/src/stackit/vpn/models/phase1_status.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -41,7 +42,8 @@ class Phase1Status(BaseModel): __properties: ClassVar[List[str]] = ["dhGroup", "encryptionAlgorithm", "integrityAlgorithm", "state"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/phase2_status.py b/services/vpn/src/stackit/vpn/models/phase2_status.py index 750590746..95d7416c4 100644 --- a/services/vpn/src/stackit/vpn/models/phase2_status.py +++ b/services/vpn/src/stackit/vpn/models/phase2_status.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -79,7 +80,8 @@ class Phase2Status(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -90,8 +92,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/plan.py b/services/vpn/src/stackit/vpn/models/plan.py index f53285358..9d0237a30 100644 --- a/services/vpn/src/stackit/vpn/models/plan.py +++ b/services/vpn/src/stackit/vpn/models/plan.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -42,7 +43,8 @@ class Plan(BaseModel): __properties: ClassVar[List[str]] = ["maxBandwidth", "maxConnections", "name", "planId", "sku"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/plan_list.py b/services/vpn/src/stackit/vpn/models/plan_list.py index 67f23f32f..8de9dfc77 100644 --- a/services/vpn/src/stackit/vpn/models/plan_list.py +++ b/services/vpn/src/stackit/vpn/models/plan_list.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.plan import Plan @@ -35,7 +36,8 @@ class PlanList(BaseModel): __properties: ClassVar[List[str]] = ["defaultPlanId", "plans"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/quota.py b/services/vpn/src/stackit/vpn/models/quota.py index cfe67dd19..6960b26b6 100644 --- a/services/vpn/src/stackit/vpn/models/quota.py +++ b/services/vpn/src/stackit/vpn/models/quota.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class Quota(BaseModel): __properties: ClassVar[List[str]] = ["limit", "usage"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/quota_list.py b/services/vpn/src/stackit/vpn/models/quota_list.py index 9527ccbe2..5de29b106 100644 --- a/services/vpn/src/stackit/vpn/models/quota_list.py +++ b/services/vpn/src/stackit/vpn/models/quota_list.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.quota import Quota @@ -32,7 +33,8 @@ class QuotaList(BaseModel): __properties: ClassVar[List[str]] = ["gateways"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/quota_list_response.py b/services/vpn/src/stackit/vpn/models/quota_list_response.py index c3b4d6f11..3b6231f9c 100644 --- a/services/vpn/src/stackit/vpn/models/quota_list_response.py +++ b/services/vpn/src/stackit/vpn/models/quota_list_response.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.quota_list import QuotaList @@ -32,7 +33,8 @@ class QuotaListResponse(BaseModel): __properties: ClassVar[List[str]] = ["quotas"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/region.py b/services/vpn/src/stackit/vpn/models/region.py index aac90cdf4..91f24909e 100644 --- a/services/vpn/src/stackit/vpn/models/region.py +++ b/services/vpn/src/stackit/vpn/models/region.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/models/routing_type.py b/services/vpn/src/stackit/vpn/models/routing_type.py index 9ea70dbd2..1a1a1d50a 100644 --- a/services/vpn/src/stackit/vpn/models/routing_type.py +++ b/services/vpn/src/stackit/vpn/models/routing_type.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/vpn/src/stackit/vpn/models/tunnel_configuration.py b/services/vpn/src/stackit/vpn/models/tunnel_configuration.py index 1209d700d..c50aafdfb 100644 --- a/services/vpn/src/stackit/vpn/models/tunnel_configuration.py +++ b/services/vpn/src/stackit/vpn/models/tunnel_configuration.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.bgp_tunnel_config import BGPTunnelConfig @@ -47,12 +48,16 @@ class TunnelConfiguration(BaseModel): @field_validator("remote_address") def remote_address_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value): raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +68,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase1.py b/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase1.py index 882089d99..74c6fa47c 100644 --- a/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase1.py +++ b/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase1.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -68,7 +69,8 @@ def integrity_algorithms_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -79,8 +81,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase2.py b/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase2.py index 10fb60137..b5fa50787 100644 --- a/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase2.py +++ b/services/vpn/src/stackit/vpn/models/tunnel_configuration_phase2.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -105,7 +106,8 @@ def start_action_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -116,8 +118,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/tunnel_status.py b/services/vpn/src/stackit/vpn/models/tunnel_status.py index 7441d8da8..ea7a3c4d6 100644 --- a/services/vpn/src/stackit/vpn/models/tunnel_status.py +++ b/services/vpn/src/stackit/vpn/models/tunnel_status.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.phase1_status import Phase1Status @@ -46,7 +47,8 @@ def name_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/update_gateway_connection_payload.py b/services/vpn/src/stackit/vpn/models/update_gateway_connection_payload.py index ae16885a7..469c9220a 100644 --- a/services/vpn/src/stackit/vpn/models/update_gateway_connection_payload.py +++ b/services/vpn/src/stackit/vpn/models/update_gateway_connection_payload.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.tunnel_configuration import TunnelConfiguration @@ -67,12 +68,16 @@ class UpdateGatewayConnectionPayload(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -83,8 +88,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/update_vpn_gateway_payload.py b/services/vpn/src/stackit/vpn/models/update_vpn_gateway_payload.py index 25a1420a0..b74adcb1f 100644 --- a/services/vpn/src/stackit/vpn/models/update_vpn_gateway_payload.py +++ b/services/vpn/src/stackit/vpn/models/update_vpn_gateway_payload.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig @@ -49,12 +50,16 @@ class UpdateVPNGatewayPayload(BaseModel): @field_validator("display_name") def display_name_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +70,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/models/vpn_tunnels.py b/services/vpn/src/stackit/vpn/models/vpn_tunnels.py index 6b49121d5..4a20c0957 100644 --- a/services/vpn/src/stackit/vpn/models/vpn_tunnels.py +++ b/services/vpn/src/stackit/vpn/models/vpn_tunnels.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.vpn.models.bgp_status import BGPStatus @@ -48,7 +49,8 @@ def name_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/vpn/src/stackit/vpn/rest.py b/services/vpn/src/stackit/vpn/rest.py index 0900cf371..d6a71d097 100644 --- a/services/vpn/src/stackit/vpn/rest.py +++ b/services/vpn/src/stackit/vpn/rest.py @@ -5,7 +5,7 @@ Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec - The version of the OpenAPI document: 1beta1 + The version of the OpenAPI document: 1 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually.