Skip to content

Commit

Permalink
fix: update network subnet types
Browse files Browse the repository at this point in the history
- Update docs
- Add deprecation
  • Loading branch information
jooola committed Jul 31, 2024
1 parent 3799a6e commit 68b9b5c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions hcloud/networks/domain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING

from dateutil.parser import isoparse
Expand Down Expand Up @@ -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:
"""
Used to connect cloud servers.
.. 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.
"""
TYPE_VSWITCH = "vswitch"
"""Subnet Type vSwitch"""
"""
Used to connect cloud servers to 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__
Expand Down

0 comments on commit 68b9b5c

Please sign in to comment.