Skip to content

Commit c32a615

Browse files
authored
fix: update network subnet types (#431)
- Update the properties documentation - Add deprecation warning for long deprecated `TYPE_SERVER`.
1 parent a73050b commit c32a615

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

hcloud/networks/domain.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import warnings
34
from typing import TYPE_CHECKING
45

56
from dateutil.parser import isoparse
@@ -89,12 +90,31 @@ class NetworkSubnet(BaseDomain):
8990
ID of the vSwitch.
9091
"""
9192

92-
TYPE_SERVER = "server"
93-
"""Subnet Type server, deprecated, use TYPE_CLOUD instead"""
93+
@property
94+
def TYPE_SERVER(self) -> str: # pylint: disable=invalid-name
95+
"""
96+
Used to connect cloud servers and load balancers.
97+
98+
.. deprecated:: 2.2.0
99+
Use :attr:`NetworkSubnet.TYPE_CLOUD` instead.
100+
"""
101+
warnings.warn(
102+
"The 'NetworkSubnet.TYPE_SERVER' property is deprecated, please use the `NetworkSubnet.TYPE_CLOUD` property instead.",
103+
DeprecationWarning,
104+
stacklevel=2,
105+
)
106+
return "server"
107+
94108
TYPE_CLOUD = "cloud"
95-
"""Subnet Type cloud"""
109+
"""
110+
Used to connect cloud servers and load balancers.
111+
"""
96112
TYPE_VSWITCH = "vswitch"
97-
"""Subnet Type vSwitch"""
113+
"""
114+
Used to connect cloud servers and load balancers with dedicated servers.
115+
116+
See https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch/
117+
"""
98118

99119
__api_properties__ = ("type", "ip_range", "network_zone", "gateway", "vswitch_id")
100120
__slots__ = __api_properties__

0 commit comments

Comments
 (0)