diff --git a/plugins/module_utils/vendor/hcloud/_version.py b/plugins/module_utils/vendor/hcloud/_version.py index 206817e..c99e801 100644 --- a/plugins/module_utils/vendor/hcloud/_version.py +++ b/plugins/module_utils/vendor/hcloud/_version.py @@ -1,3 +1,3 @@ from __future__ import annotations -__version__ = "2.6.0" # x-releaser-pleaser-version +__version__ = "2.7.0" # x-releaser-pleaser-version diff --git a/plugins/module_utils/vendor/hcloud/server_types/__init__.py b/plugins/module_utils/vendor/hcloud/server_types/__init__.py index 2cdab17..6840e32 100644 --- a/plugins/module_utils/vendor/hcloud/server_types/__init__.py +++ b/plugins/module_utils/vendor/hcloud/server_types/__init__.py @@ -5,11 +5,12 @@ from .client import ( ServerTypesClient, ServerTypesPageResult, ) -from .domain import ServerType +from .domain import ServerType, ServerTypeLocation __all__ = [ "BoundServerType", "ServerType", + "ServerTypeLocation", "ServerTypesClient", "ServerTypesPageResult", ] diff --git a/plugins/module_utils/vendor/hcloud/server_types/client.py b/plugins/module_utils/vendor/hcloud/server_types/client.py index 085b66f..bfa525c 100644 --- a/plugins/module_utils/vendor/hcloud/server_types/client.py +++ b/plugins/module_utils/vendor/hcloud/server_types/client.py @@ -3,7 +3,8 @@ from __future__ import annotations from typing import Any, NamedTuple from ..core import BoundModelBase, Meta, ResourceClientBase -from .domain import ServerType +from ..locations import BoundLocation +from .domain import ServerType, ServerTypeLocation class BoundServerType(BoundModelBase, ServerType): @@ -11,6 +12,28 @@ class BoundServerType(BoundModelBase, ServerType): model = ServerType + def __init__( + self, + client: ServerTypesClient, + data: dict, + complete: bool = True, + ): + raw = data.get("locations") + if raw is not None: + data["locations"] = [ + ServerTypeLocation.from_dict( + { + "location": BoundLocation( + client._parent.locations, o, complete=False + ), + **o, + } + ) + for o in raw + ] + + super().__init__(client, data, complete) + class ServerTypesPageResult(NamedTuple): server_types: list[BoundServerType] diff --git a/plugins/module_utils/vendor/hcloud/server_types/domain.py b/plugins/module_utils/vendor/hcloud/server_types/domain.py index ad5ca4b..ff9e3fd 100644 --- a/plugins/module_utils/vendor/hcloud/server_types/domain.py +++ b/plugins/module_utils/vendor/hcloud/server_types/domain.py @@ -4,6 +4,7 @@ import warnings from ..core import BaseDomain, DomainIdentityMixin from ..deprecation import DeprecationInfo +from ..locations import BoundLocation class ServerType(BaseDomain, DomainIdentityMixin): @@ -38,6 +39,7 @@ class ServerType(BaseDomain, DomainIdentityMixin): deprecated. If it has a value, it is considered deprecated. :param included_traffic: int Free traffic per month in bytes + :param locations: Supported Location of the Server Type. """ __properties__ = ( @@ -52,18 +54,22 @@ class ServerType(BaseDomain, DomainIdentityMixin): "storage_type", "cpu_type", "architecture", - "deprecated", - "deprecation", + "locations", ) __api_properties__ = ( *__properties__, + "deprecated", + "deprecation", "included_traffic", ) __slots__ = ( *__properties__, + "_deprecated", + "_deprecation", "_included_traffic", ) + # pylint: disable=too-many-locals def __init__( self, id: int | None = None, @@ -80,6 +86,7 @@ class ServerType(BaseDomain, DomainIdentityMixin): deprecated: bool | None = None, deprecation: dict | None = None, included_traffic: int | None = None, + locations: list[ServerTypeLocation] | None = None, ): self.id = id self.name = name @@ -92,12 +99,58 @@ class ServerType(BaseDomain, DomainIdentityMixin): self.storage_type = storage_type self.cpu_type = cpu_type self.architecture = architecture + self.locations = locations + self.deprecated = deprecated self.deprecation = ( DeprecationInfo.from_dict(deprecation) if deprecation is not None else None ) self.included_traffic = included_traffic + @property + def deprecated(self) -> bool | None: + """ + .. deprecated:: 2.6.0 + The 'deprecated' property is deprecated and will gradually be phased starting 24 September 2025. + Please refer to the '.locations[].deprecation' property instead. + + See https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types. + """ + warnings.warn( + "The 'deprecated' property is deprecated and will gradually be phased starting 24 September 2025. " + "Please refer to the '.locations[].deprecation' property instead. " + "See https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types", + DeprecationWarning, + stacklevel=2, + ) + return self._deprecated + + @deprecated.setter + def deprecated(self, value: bool | None) -> None: + self._deprecated = value + + @property + def deprecation(self) -> DeprecationInfo | None: + """ + .. deprecated:: 2.6.0 + The 'deprecation' property is deprecated and will gradually be phased starting 24 September 2025. + Please refer to the '.locations[].deprecation' property instead. + + See https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types. + """ + warnings.warn( + "The 'deprecation' property is deprecated and will gradually be phased starting 24 September 2025. " + "Please refer to the '.locations[].deprecation' property instead. " + "See https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types", + DeprecationWarning, + stacklevel=2, + ) + return self._deprecation + + @deprecation.setter + def deprecation(self, value: DeprecationInfo | None) -> None: + self._deprecation = value + @property def included_traffic(self) -> int | None: """ @@ -119,3 +172,28 @@ class ServerType(BaseDomain, DomainIdentityMixin): @included_traffic.setter def included_traffic(self, value: int | None) -> None: self._included_traffic = value + + +class ServerTypeLocation(BaseDomain): + """Server Type Location Domain + + :param location: Location of the Server Type. + :param deprecation: Wether the Server Type is deprecated in this Location. + """ + + __api_properties__ = ( + "location", + "deprecation", + ) + __slots__ = __api_properties__ + + def __init__( + self, + *, + location: BoundLocation, + deprecation: dict | None, + ): + self.location = location + self.deprecation = ( + DeprecationInfo.from_dict(deprecation) if deprecation is not None else None + ) diff --git a/scripts/vendor.py b/scripts/vendor.py index 5e70c30..ee29974 100755 --- a/scripts/vendor.py +++ b/scripts/vendor.py @@ -22,7 +22,7 @@ from textwrap import dedent logger = logging.getLogger("vendor") HCLOUD_SOURCE_URL = "https://github.com/hetznercloud/hcloud-python" -HCLOUD_VERSION = "v2.6.0" +HCLOUD_VERSION = "v2.7.0" HCLOUD_VENDOR_PATH = "plugins/module_utils/vendor/hcloud"