Skip to content

Commit aeebcf8

Browse files
authored
feat: add deprecation info to load balancer type (#674)
Add the `deprecation` object property to the `LoadBalancerType` domain. https://docs.hetzner.cloud/changelog#2026-06-05-deprecation-info-for-load-balancer-types
1 parent 629a8f8 commit aeebcf8

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

hcloud/load_balancer_types/domain.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Any
44

55
from ..core import BaseDomain, DomainIdentityMixin
6+
from ..deprecation import DeprecationInfo
67

78
__all__ = [
89
"LoadBalancerType",
@@ -28,7 +29,7 @@ class LoadBalancerType(BaseDomain, DomainIdentityMixin):
2829
Max amount of certificates the Load Balancer can serve
2930
:param prices: List of dict
3031
Prices in different locations
31-
32+
:param deprecation: Define if and when the Load Balancer Type is deprecated.
3233
"""
3334

3435
__api_properties__ = (
@@ -40,6 +41,7 @@ class LoadBalancerType(BaseDomain, DomainIdentityMixin):
4041
"max_targets",
4142
"max_assigned_certificates",
4243
"prices",
44+
"deprecation",
4345
)
4446
__slots__ = __api_properties__
4547

@@ -53,6 +55,7 @@ def __init__(
5355
max_targets: int | None = None,
5456
max_assigned_certificates: int | None = None,
5557
prices: list[dict[str, Any]] | None = None,
58+
deprecation: dict[str, Any] | None = None,
5659
):
5760
self.id = id
5861
self.name = name
@@ -62,3 +65,4 @@ def __init__(
6265
self.max_targets = max_targets
6366
self.max_assigned_certificates = max_assigned_certificates
6467
self.prices = prices
68+
self.deprecation = deprecation and DeprecationInfo.from_dict(deprecation)

tests/unit/load_balancer_types/test_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from unittest import mock
44

55
import pytest
6+
from dateutil.parser import isoparse
67

78
from hcloud import Client
89
from hcloud.load_balancer_types import LoadBalancerTypesClient
@@ -47,6 +48,10 @@ def test_get_by_id(
4748
"included_traffic": 21990232555520,
4849
}
4950
]
51+
assert result.deprecation.announced == isoparse("2023-06-01T00:00:00+00:00")
52+
assert result.deprecation.unavailable_after == isoparse(
53+
"2023-09-01T00:00:00+00:00"
54+
)
5055

5156
@pytest.mark.parametrize(
5257
"params", [{"name": "lb11", "page": 1, "per_page": 10}, {"name": ""}, {}]

0 commit comments

Comments
 (0)