Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update network subnet types #431

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: # 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__
Expand Down