-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdomain.py
More file actions
72 lines (58 loc) · 2.09 KB
/
domain.py
File metadata and controls
72 lines (58 loc) · 2.09 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
from __future__ import annotations
from typing import TYPE_CHECKING
from ..core import BaseDomain, DomainIdentityMixin
if TYPE_CHECKING:
from ..actions import BoundAction
from .client import BoundPlacementGroup
class PlacementGroup(BaseDomain, DomainIdentityMixin):
"""Placement Group Domain
:param id: int
ID of the Placement Group
:param name: str
Name of the Placement Group
:param labels: dict
User-defined labels (key-value pairs)
:param servers: List[ int ]
List of server IDs assigned to the Placement Group
:param type: str
Type of the Placement Group
:param created: datetime
Point in time when the image was created
"""
__api_properties__ = ("id", "name", "labels", "servers", "type", "created")
__slots__ = __api_properties__
"""Placement Group type spread
spreads all servers in the group on different vhosts
"""
TYPE_SPREAD = "spread"
def __init__(
self,
id: int | None = None,
name: str | None = None,
labels: dict[str, str] | None = None,
servers: list[int] | None = None,
type: str | None = None,
created: str | None = None,
):
self.id = id
self.name = name
self.labels = labels
self.servers = servers
self.type = type
self.created = self._parse_datetime(created)
class CreatePlacementGroupResponse(BaseDomain):
"""Create Placement Group Response Domain
:param placement_group: :class:`BoundPlacementGroup <hcloud.placement_groups.client.BoundPlacementGroup>`
The Placement Group which was created
:param action: :class:`BoundAction <hcloud.actions.client.BoundAction>`
The Action which shows the progress of the Placement Group Creation
"""
__api_properties__ = ("placement_group", "action")
__slots__ = __api_properties__
def __init__(
self,
placement_group: BoundPlacementGroup,
action: BoundAction | None,
):
self.placement_group = placement_group
self.action = action