From 512a614a6391bdf41f7599c6d4840f834ee6d38e Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 5 Aug 2024 15:45:18 +0200 Subject: [PATCH] fix: update network subnet types - Update docs - Add deprecation --- hcloud/networks/domain.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/hcloud/networks/domain.py b/hcloud/networks/domain.py index 58e97c44..44311143 100644 --- a/hcloud/networks/domain.py +++ b/hcloud/networks/domain.py @@ -1,5 +1,6 @@ from __future__ import annotations +import warnings from typing import TYPE_CHECKING from dateutil.parser import isoparse @@ -89,12 +90,31 @@ class NetworkSubnet(BaseDomain): ID of the vSwitch. """ - TYPE_SERVER = "server" - """Subnet Type server, deprecated, use TYPE_CLOUD instead""" + @property + def TYPE_SERVER(self) -> str: # pylint: disable=invalid-name + """ + Used to connect cloud servers and load balancers. + + .. deprecated:: 2.2.0 + Use :attr:`NetworkSubnet.TYPE_CLOUD` instead. + """ + warnings.warn( + "The 'NetworkSubnet.TYPE_SERVER' property is deprecated, please use the `NetworkSubnet.TYPE_CLOUD` property instead.", + DeprecationWarning, + stacklevel=2, + ) + return "server" + TYPE_CLOUD = "cloud" - """Subnet Type cloud""" + """ + Used to connect cloud servers and load balancers. + """ TYPE_VSWITCH = "vswitch" - """Subnet Type vSwitch""" + """ + Used to connect cloud servers and load balancers with dedicated servers. + + See https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch/ + """ __api_properties__ = ("type", "ip_range", "network_zone", "gateway", "vswitch_id") __slots__ = __api_properties__