-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdomain.py
More file actions
199 lines (177 loc) · 6.72 KB
/
domain.py
File metadata and controls
199 lines (177 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
from __future__ import annotations
import warnings
from ..core import BaseDomain, DomainIdentityMixin
from ..deprecation import DeprecationInfo
from ..locations import BoundLocation
class ServerType(BaseDomain, DomainIdentityMixin):
"""ServerType Domain
:param id: int
ID of the server type
:param name: str
Unique identifier of the server type
:param description: str
Description of the server type
:param category: str
Category of the Server Type.
:param cores: int
Number of cpu cores a server of this type will have
:param memory: int
Memory a server of this type will have in GB
:param disk: int
Disk size a server of this type will have in GB
:param prices: List of dict
Prices in different locations
:param storage_type: str
Type of server boot drive. Local has higher speed. Network has better availability. Choices: `local`, `network`
:param cpu_type: string
Type of cpu. Choices: `shared`, `dedicated`
:param architecture: string
Architecture of cpu. Choices: `x86`, `arm`
:param deprecated: bool
True if server type is deprecated. This field is deprecated. Use `deprecation` instead.
:param deprecation: :class:`DeprecationInfo <hcloud.deprecation.domain.DeprecationInfo>`, None
Describes if, when & how the resources was deprecated. If this field is set to None the resource is not
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__ = (
"id",
"name",
"description",
"category",
"cores",
"memory",
"disk",
"prices",
"storage_type",
"cpu_type",
"architecture",
"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,
name: str | None = None,
description: str | None = None,
category: str | None = None,
cores: int | None = None,
memory: int | None = None,
disk: int | None = None,
prices: list[dict] | None = None,
storage_type: str | None = None,
cpu_type: str | None = None,
architecture: str | None = None,
deprecated: bool | None = None,
deprecation: dict | None = None,
included_traffic: int | None = None,
locations: list[ServerTypeLocation] | None = None,
):
self.id = id
self.name = name
self.description = description
self.category = category
self.cores = cores
self.memory = memory
self.disk = disk
self.prices = prices
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:
"""
.. deprecated:: 2.1.0
The 'included_traffic' property is deprecated and will be set to 'None' on 5 August 2024.
Please refer to the 'prices' property instead.
See https://docs.hetzner.cloud/changelog#2024-07-25-cloud-api-returns-traffic-information-in-different-format.
"""
warnings.warn(
"The 'included_traffic' property is deprecated and will be set to 'None' on 5 August 2024. "
"Please refer to the 'prices' property instead. "
"See https://docs.hetzner.cloud/changelog#2024-07-25-cloud-api-returns-traffic-information-in-different-format",
DeprecationWarning,
stacklevel=2,
)
return self._included_traffic
@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
)