11from __future__ import annotations
22
3+ import warnings
34from typing import TYPE_CHECKING , Literal , TypedDict
45
56from ..core import BaseDomain , DomainIdentityMixin
1112 from ..floating_ips import BoundFloatingIP
1213 from ..images import BoundImage
1314 from ..isos import BoundIso
15+ from ..locations import BoundLocation
1416 from ..metrics import Metrics
1517 from ..networks import BoundNetwork , Network
1618 from ..placement_groups import BoundPlacementGroup
@@ -36,6 +38,12 @@ class Server(BaseDomain, DomainIdentityMixin):
3638 Public network information.
3739 :param server_type: :class:`BoundServerType <hcloud.server_types.client.BoundServerType>`
3840 :param datacenter: :class:`BoundDatacenter <hcloud.datacenters.client.BoundDatacenter>`
41+
42+ This property is deprecated and will be removed after 1 July 2026.
43+ Please use the ``location`` property instead.
44+
45+ See https://docs.hetzner.cloud/changelog#2025-12-16-phasing-out-datacenters.
46+ :param location: :class:`BoundLocation <hcloud.locations.client.BoundLocation>`
3947 :param image: :class:`BoundImage <hcloud.images.client.BoundImage>`, None
4048 :param iso: :class:`BoundIso <hcloud.isos.client.BoundIso>`, None
4149 :param rescue_enabled: bool
@@ -81,13 +89,13 @@ class Server(BaseDomain, DomainIdentityMixin):
8189 STATUS_UNKNOWN = "unknown"
8290 """Server Status unknown"""
8391
84- __api_properties__ = (
92+ __properties__ = (
8593 "id" ,
8694 "name" ,
8795 "status" ,
8896 "public_net" ,
8997 "server_type" ,
90- "datacenter " ,
98+ "location " ,
9199 "image" ,
92100 "iso" ,
93101 "rescue_enabled" ,
@@ -104,7 +112,14 @@ class Server(BaseDomain, DomainIdentityMixin):
104112 "primary_disk_size" ,
105113 "placement_group" ,
106114 )
107- __slots__ = __api_properties__
115+ __api_properties__ = (
116+ * __properties__ ,
117+ "datacenter" ,
118+ )
119+ __slots__ = (
120+ * __properties__ ,
121+ "_datacenter" ,
122+ )
108123
109124 # pylint: disable=too-many-locals
110125 def __init__ (
@@ -116,6 +131,7 @@ def __init__(
116131 public_net : PublicNetwork | None = None ,
117132 server_type : BoundServerType | None = None ,
118133 datacenter : BoundDatacenter | None = None ,
134+ location : BoundLocation | None = None ,
119135 image : BoundImage | None = None ,
120136 iso : BoundIso | None = None ,
121137 rescue_enabled : bool | None = None ,
@@ -138,6 +154,7 @@ def __init__(
138154 self .public_net = public_net
139155 self .server_type = server_type
140156 self .datacenter = datacenter
157+ self .location = location
141158 self .image = image
142159 self .iso = iso
143160 self .rescue_enabled = rescue_enabled
@@ -163,6 +180,24 @@ def private_net_for(self, network: BoundNetwork | Network) -> PrivateNet | None:
163180 return o
164181 return None
165182
183+ @property
184+ def datacenter (self ) -> BoundDatacenter | None :
185+ """
186+ :meta private:
187+ """
188+ warnings .warn (
189+ "The 'datacenter' property is deprecated and will be removed after 1 July 2026. "
190+ "Please use the 'location' property instead. "
191+ "See https://docs.hetzner.cloud/changelog#2025-12-16-phasing-out-datacenters." ,
192+ DeprecationWarning ,
193+ stacklevel = 2 ,
194+ )
195+ return self ._datacenter
196+
197+ @datacenter .setter
198+ def datacenter (self , value : BoundDatacenter | None ) -> None :
199+ self ._datacenter = value
200+
166201
167202class ServerProtection (TypedDict ):
168203 rebuild : bool
0 commit comments