Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion hcloud/load_balancer_types/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any

from ..core import BaseDomain, DomainIdentityMixin
from ..deprecation import DeprecationInfo

__all__ = [
"LoadBalancerType",
Expand All @@ -28,7 +29,7 @@ class LoadBalancerType(BaseDomain, DomainIdentityMixin):
Max amount of certificates the Load Balancer can serve
:param prices: List of dict
Prices in different locations

:param deprecation: Define if and when the Load Balancer Type is deprecated.
"""

__api_properties__ = (
Expand All @@ -40,6 +41,7 @@ class LoadBalancerType(BaseDomain, DomainIdentityMixin):
"max_targets",
"max_assigned_certificates",
"prices",
"deprecation",
)
__slots__ = __api_properties__

Expand All @@ -53,6 +55,7 @@ def __init__(
max_targets: int | None = None,
max_assigned_certificates: int | None = None,
prices: list[dict[str, Any]] | None = None,
deprecation: dict[str, Any] | None = None,
):
self.id = id
self.name = name
Expand All @@ -62,3 +65,4 @@ def __init__(
self.max_targets = max_targets
self.max_assigned_certificates = max_assigned_certificates
self.prices = prices
self.deprecation = deprecation and DeprecationInfo.from_dict(deprecation)
5 changes: 5 additions & 0 deletions tests/unit/load_balancer_types/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest import mock

import pytest
from dateutil.parser import isoparse

from hcloud import Client
from hcloud.load_balancer_types import LoadBalancerTypesClient
Expand Down Expand Up @@ -47,6 +48,10 @@ def test_get_by_id(
"included_traffic": 21990232555520,
}
]
assert result.deprecation.announced == isoparse("2023-06-01T00:00:00+00:00")
assert result.deprecation.unavailable_after == isoparse(
"2023-09-01T00:00:00+00:00"
)

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