moru 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. moru/__init__.py +174 -0
  2. moru/api/__init__.py +164 -0
  3. moru/api/client/__init__.py +8 -0
  4. moru/api/client/api/__init__.py +1 -0
  5. moru/api/client/api/sandboxes/__init__.py +1 -0
  6. moru/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. moru/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. moru/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
  12. moru/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
  13. moru/api/client/api/sandboxes/post_sandboxes.py +172 -0
  14. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
  15. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
  16. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
  17. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
  18. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
  19. moru/api/client/api/templates/__init__.py +1 -0
  20. moru/api/client/api/templates/delete_templates_template_id.py +157 -0
  21. moru/api/client/api/templates/get_templates.py +172 -0
  22. moru/api/client/api/templates/get_templates_template_id.py +195 -0
  23. moru/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +217 -0
  24. moru/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
  25. moru/api/client/api/templates/patch_templates_template_id.py +183 -0
  26. moru/api/client/api/templates/post_templates.py +172 -0
  27. moru/api/client/api/templates/post_templates_template_id.py +181 -0
  28. moru/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
  29. moru/api/client/api/templates/post_v2_templates.py +172 -0
  30. moru/api/client/api/templates/post_v3_templates.py +172 -0
  31. moru/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
  32. moru/api/client/client.py +286 -0
  33. moru/api/client/errors.py +16 -0
  34. moru/api/client/models/__init__.py +123 -0
  35. moru/api/client/models/aws_registry.py +85 -0
  36. moru/api/client/models/aws_registry_type.py +8 -0
  37. moru/api/client/models/build_log_entry.py +89 -0
  38. moru/api/client/models/build_status_reason.py +95 -0
  39. moru/api/client/models/connect_sandbox.py +59 -0
  40. moru/api/client/models/created_access_token.py +100 -0
  41. moru/api/client/models/created_team_api_key.py +166 -0
  42. moru/api/client/models/disk_metrics.py +91 -0
  43. moru/api/client/models/error.py +67 -0
  44. moru/api/client/models/gcp_registry.py +69 -0
  45. moru/api/client/models/gcp_registry_type.py +8 -0
  46. moru/api/client/models/general_registry.py +77 -0
  47. moru/api/client/models/general_registry_type.py +8 -0
  48. moru/api/client/models/identifier_masking_details.py +83 -0
  49. moru/api/client/models/listed_sandbox.py +154 -0
  50. moru/api/client/models/log_level.py +11 -0
  51. moru/api/client/models/max_team_metric.py +78 -0
  52. moru/api/client/models/mcp_type_0.py +44 -0
  53. moru/api/client/models/new_access_token.py +59 -0
  54. moru/api/client/models/new_sandbox.py +172 -0
  55. moru/api/client/models/new_team_api_key.py +59 -0
  56. moru/api/client/models/node.py +155 -0
  57. moru/api/client/models/node_detail.py +165 -0
  58. moru/api/client/models/node_metrics.py +122 -0
  59. moru/api/client/models/node_status.py +11 -0
  60. moru/api/client/models/node_status_change.py +79 -0
  61. moru/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  62. moru/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  63. moru/api/client/models/resumed_sandbox.py +68 -0
  64. moru/api/client/models/sandbox.py +145 -0
  65. moru/api/client/models/sandbox_detail.py +183 -0
  66. moru/api/client/models/sandbox_log.py +70 -0
  67. moru/api/client/models/sandbox_log_entry.py +93 -0
  68. moru/api/client/models/sandbox_log_entry_fields.py +44 -0
  69. moru/api/client/models/sandbox_logs.py +91 -0
  70. moru/api/client/models/sandbox_metric.py +118 -0
  71. moru/api/client/models/sandbox_network_config.py +92 -0
  72. moru/api/client/models/sandbox_state.py +9 -0
  73. moru/api/client/models/sandboxes_with_metrics.py +59 -0
  74. moru/api/client/models/team.py +83 -0
  75. moru/api/client/models/team_api_key.py +158 -0
  76. moru/api/client/models/team_metric.py +86 -0
  77. moru/api/client/models/team_user.py +68 -0
  78. moru/api/client/models/template.py +217 -0
  79. moru/api/client/models/template_build.py +139 -0
  80. moru/api/client/models/template_build_file_upload.py +70 -0
  81. moru/api/client/models/template_build_info.py +126 -0
  82. moru/api/client/models/template_build_request.py +115 -0
  83. moru/api/client/models/template_build_request_v2.py +88 -0
  84. moru/api/client/models/template_build_request_v3.py +88 -0
  85. moru/api/client/models/template_build_start_v2.py +184 -0
  86. moru/api/client/models/template_build_status.py +11 -0
  87. moru/api/client/models/template_legacy.py +207 -0
  88. moru/api/client/models/template_request_response_v3.py +83 -0
  89. moru/api/client/models/template_step.py +91 -0
  90. moru/api/client/models/template_update_request.py +59 -0
  91. moru/api/client/models/template_with_builds.py +148 -0
  92. moru/api/client/models/update_team_api_key.py +59 -0
  93. moru/api/client/py.typed +1 -0
  94. moru/api/client/types.py +54 -0
  95. moru/api/client_async/__init__.py +50 -0
  96. moru/api/client_sync/__init__.py +52 -0
  97. moru/api/metadata.py +14 -0
  98. moru/connection_config.py +217 -0
  99. moru/envd/api.py +59 -0
  100. moru/envd/filesystem/filesystem_connect.py +193 -0
  101. moru/envd/filesystem/filesystem_pb2.py +76 -0
  102. moru/envd/filesystem/filesystem_pb2.pyi +233 -0
  103. moru/envd/process/process_connect.py +155 -0
  104. moru/envd/process/process_pb2.py +92 -0
  105. moru/envd/process/process_pb2.pyi +304 -0
  106. moru/envd/rpc.py +61 -0
  107. moru/envd/versions.py +6 -0
  108. moru/exceptions.py +95 -0
  109. moru/sandbox/commands/command_handle.py +69 -0
  110. moru/sandbox/commands/main.py +39 -0
  111. moru/sandbox/filesystem/filesystem.py +94 -0
  112. moru/sandbox/filesystem/watch_handle.py +60 -0
  113. moru/sandbox/main.py +210 -0
  114. moru/sandbox/mcp.py +1120 -0
  115. moru/sandbox/network.py +8 -0
  116. moru/sandbox/sandbox_api.py +210 -0
  117. moru/sandbox/signature.py +45 -0
  118. moru/sandbox/utils.py +34 -0
  119. moru/sandbox_async/commands/command.py +336 -0
  120. moru/sandbox_async/commands/command_handle.py +196 -0
  121. moru/sandbox_async/commands/pty.py +240 -0
  122. moru/sandbox_async/filesystem/filesystem.py +531 -0
  123. moru/sandbox_async/filesystem/watch_handle.py +62 -0
  124. moru/sandbox_async/main.py +734 -0
  125. moru/sandbox_async/paginator.py +69 -0
  126. moru/sandbox_async/sandbox_api.py +325 -0
  127. moru/sandbox_async/utils.py +7 -0
  128. moru/sandbox_sync/commands/command.py +328 -0
  129. moru/sandbox_sync/commands/command_handle.py +150 -0
  130. moru/sandbox_sync/commands/pty.py +230 -0
  131. moru/sandbox_sync/filesystem/filesystem.py +518 -0
  132. moru/sandbox_sync/filesystem/watch_handle.py +69 -0
  133. moru/sandbox_sync/main.py +726 -0
  134. moru/sandbox_sync/paginator.py +69 -0
  135. moru/sandbox_sync/sandbox_api.py +308 -0
  136. moru/template/consts.py +30 -0
  137. moru/template/dockerfile_parser.py +275 -0
  138. moru/template/logger.py +232 -0
  139. moru/template/main.py +1360 -0
  140. moru/template/readycmd.py +138 -0
  141. moru/template/types.py +105 -0
  142. moru/template/utils.py +320 -0
  143. moru/template_async/build_api.py +202 -0
  144. moru/template_async/main.py +366 -0
  145. moru/template_sync/build_api.py +199 -0
  146. moru/template_sync/main.py +371 -0
  147. moru-0.1.0.dist-info/METADATA +63 -0
  148. moru-0.1.0.dist-info/RECORD +152 -0
  149. moru-0.1.0.dist-info/WHEEL +4 -0
  150. moru-0.1.0.dist-info/licenses/LICENSE +9 -0
  151. moru_connect/__init__.py +1 -0
  152. moru_connect/client.py +493 -0
@@ -0,0 +1,59 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="NewTeamAPIKey")
8
+
9
+
10
+ @_attrs_define
11
+ class NewTeamAPIKey:
12
+ """
13
+ Attributes:
14
+ name (str): Name of the API key
15
+ """
16
+
17
+ name: str
18
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
+
20
+ def to_dict(self) -> dict[str, Any]:
21
+ name = self.name
22
+
23
+ field_dict: dict[str, Any] = {}
24
+ field_dict.update(self.additional_properties)
25
+ field_dict.update(
26
+ {
27
+ "name": name,
28
+ }
29
+ )
30
+
31
+ return field_dict
32
+
33
+ @classmethod
34
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
+ d = dict(src_dict)
36
+ name = d.pop("name")
37
+
38
+ new_team_api_key = cls(
39
+ name=name,
40
+ )
41
+
42
+ new_team_api_key.additional_properties = d
43
+ return new_team_api_key
44
+
45
+ @property
46
+ def additional_keys(self) -> list[str]:
47
+ return list(self.additional_properties.keys())
48
+
49
+ def __getitem__(self, key: str) -> Any:
50
+ return self.additional_properties[key]
51
+
52
+ def __setitem__(self, key: str, value: Any) -> None:
53
+ self.additional_properties[key] = value
54
+
55
+ def __delitem__(self, key: str) -> None:
56
+ del self.additional_properties[key]
57
+
58
+ def __contains__(self, key: str) -> bool:
59
+ return key in self.additional_properties
@@ -0,0 +1,155 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..models.node_status import NodeStatus
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.node_metrics import NodeMetrics
11
+
12
+
13
+ T = TypeVar("T", bound="Node")
14
+
15
+
16
+ @_attrs_define
17
+ class Node:
18
+ """
19
+ Attributes:
20
+ cluster_id (str): Identifier of the cluster
21
+ commit (str): Commit of the orchestrator
22
+ create_fails (int): Number of sandbox create fails
23
+ create_successes (int): Number of sandbox create successes
24
+ id (str): Identifier of the node
25
+ metrics (NodeMetrics): Node metrics
26
+ node_id (str): Identifier of the nomad node
27
+ sandbox_count (int): Number of sandboxes running on the node
28
+ sandbox_starting_count (int): Number of starting Sandboxes
29
+ service_instance_id (str): Service instance identifier of the node
30
+ status (NodeStatus): Status of the node
31
+ version (str): Version of the orchestrator
32
+ """
33
+
34
+ cluster_id: str
35
+ commit: str
36
+ create_fails: int
37
+ create_successes: int
38
+ id: str
39
+ metrics: "NodeMetrics"
40
+ node_id: str
41
+ sandbox_count: int
42
+ sandbox_starting_count: int
43
+ service_instance_id: str
44
+ status: NodeStatus
45
+ version: str
46
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
47
+
48
+ def to_dict(self) -> dict[str, Any]:
49
+ cluster_id = self.cluster_id
50
+
51
+ commit = self.commit
52
+
53
+ create_fails = self.create_fails
54
+
55
+ create_successes = self.create_successes
56
+
57
+ id = self.id
58
+
59
+ metrics = self.metrics.to_dict()
60
+
61
+ node_id = self.node_id
62
+
63
+ sandbox_count = self.sandbox_count
64
+
65
+ sandbox_starting_count = self.sandbox_starting_count
66
+
67
+ service_instance_id = self.service_instance_id
68
+
69
+ status = self.status.value
70
+
71
+ version = self.version
72
+
73
+ field_dict: dict[str, Any] = {}
74
+ field_dict.update(self.additional_properties)
75
+ field_dict.update(
76
+ {
77
+ "clusterID": cluster_id,
78
+ "commit": commit,
79
+ "createFails": create_fails,
80
+ "createSuccesses": create_successes,
81
+ "id": id,
82
+ "metrics": metrics,
83
+ "nodeID": node_id,
84
+ "sandboxCount": sandbox_count,
85
+ "sandboxStartingCount": sandbox_starting_count,
86
+ "serviceInstanceID": service_instance_id,
87
+ "status": status,
88
+ "version": version,
89
+ }
90
+ )
91
+
92
+ return field_dict
93
+
94
+ @classmethod
95
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
96
+ from ..models.node_metrics import NodeMetrics
97
+
98
+ d = dict(src_dict)
99
+ cluster_id = d.pop("clusterID")
100
+
101
+ commit = d.pop("commit")
102
+
103
+ create_fails = d.pop("createFails")
104
+
105
+ create_successes = d.pop("createSuccesses")
106
+
107
+ id = d.pop("id")
108
+
109
+ metrics = NodeMetrics.from_dict(d.pop("metrics"))
110
+
111
+ node_id = d.pop("nodeID")
112
+
113
+ sandbox_count = d.pop("sandboxCount")
114
+
115
+ sandbox_starting_count = d.pop("sandboxStartingCount")
116
+
117
+ service_instance_id = d.pop("serviceInstanceID")
118
+
119
+ status = NodeStatus(d.pop("status"))
120
+
121
+ version = d.pop("version")
122
+
123
+ node = cls(
124
+ cluster_id=cluster_id,
125
+ commit=commit,
126
+ create_fails=create_fails,
127
+ create_successes=create_successes,
128
+ id=id,
129
+ metrics=metrics,
130
+ node_id=node_id,
131
+ sandbox_count=sandbox_count,
132
+ sandbox_starting_count=sandbox_starting_count,
133
+ service_instance_id=service_instance_id,
134
+ status=status,
135
+ version=version,
136
+ )
137
+
138
+ node.additional_properties = d
139
+ return node
140
+
141
+ @property
142
+ def additional_keys(self) -> list[str]:
143
+ return list(self.additional_properties.keys())
144
+
145
+ def __getitem__(self, key: str) -> Any:
146
+ return self.additional_properties[key]
147
+
148
+ def __setitem__(self, key: str, value: Any) -> None:
149
+ self.additional_properties[key] = value
150
+
151
+ def __delitem__(self, key: str) -> None:
152
+ del self.additional_properties[key]
153
+
154
+ def __contains__(self, key: str) -> bool:
155
+ return key in self.additional_properties
@@ -0,0 +1,165 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..models.node_status import NodeStatus
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.listed_sandbox import ListedSandbox
11
+ from ..models.node_metrics import NodeMetrics
12
+
13
+
14
+ T = TypeVar("T", bound="NodeDetail")
15
+
16
+
17
+ @_attrs_define
18
+ class NodeDetail:
19
+ """
20
+ Attributes:
21
+ cached_builds (list[str]): List of cached builds id on the node
22
+ cluster_id (str): Identifier of the cluster
23
+ commit (str): Commit of the orchestrator
24
+ create_fails (int): Number of sandbox create fails
25
+ create_successes (int): Number of sandbox create successes
26
+ id (str): Identifier of the node
27
+ metrics (NodeMetrics): Node metrics
28
+ node_id (str): Identifier of the nomad node
29
+ sandboxes (list['ListedSandbox']): List of sandboxes running on the node
30
+ service_instance_id (str): Service instance identifier of the node
31
+ status (NodeStatus): Status of the node
32
+ version (str): Version of the orchestrator
33
+ """
34
+
35
+ cached_builds: list[str]
36
+ cluster_id: str
37
+ commit: str
38
+ create_fails: int
39
+ create_successes: int
40
+ id: str
41
+ metrics: "NodeMetrics"
42
+ node_id: str
43
+ sandboxes: list["ListedSandbox"]
44
+ service_instance_id: str
45
+ status: NodeStatus
46
+ version: str
47
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
48
+
49
+ def to_dict(self) -> dict[str, Any]:
50
+ cached_builds = self.cached_builds
51
+
52
+ cluster_id = self.cluster_id
53
+
54
+ commit = self.commit
55
+
56
+ create_fails = self.create_fails
57
+
58
+ create_successes = self.create_successes
59
+
60
+ id = self.id
61
+
62
+ metrics = self.metrics.to_dict()
63
+
64
+ node_id = self.node_id
65
+
66
+ sandboxes = []
67
+ for sandboxes_item_data in self.sandboxes:
68
+ sandboxes_item = sandboxes_item_data.to_dict()
69
+ sandboxes.append(sandboxes_item)
70
+
71
+ service_instance_id = self.service_instance_id
72
+
73
+ status = self.status.value
74
+
75
+ version = self.version
76
+
77
+ field_dict: dict[str, Any] = {}
78
+ field_dict.update(self.additional_properties)
79
+ field_dict.update(
80
+ {
81
+ "cachedBuilds": cached_builds,
82
+ "clusterID": cluster_id,
83
+ "commit": commit,
84
+ "createFails": create_fails,
85
+ "createSuccesses": create_successes,
86
+ "id": id,
87
+ "metrics": metrics,
88
+ "nodeID": node_id,
89
+ "sandboxes": sandboxes,
90
+ "serviceInstanceID": service_instance_id,
91
+ "status": status,
92
+ "version": version,
93
+ }
94
+ )
95
+
96
+ return field_dict
97
+
98
+ @classmethod
99
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
100
+ from ..models.listed_sandbox import ListedSandbox
101
+ from ..models.node_metrics import NodeMetrics
102
+
103
+ d = dict(src_dict)
104
+ cached_builds = cast(list[str], d.pop("cachedBuilds"))
105
+
106
+ cluster_id = d.pop("clusterID")
107
+
108
+ commit = d.pop("commit")
109
+
110
+ create_fails = d.pop("createFails")
111
+
112
+ create_successes = d.pop("createSuccesses")
113
+
114
+ id = d.pop("id")
115
+
116
+ metrics = NodeMetrics.from_dict(d.pop("metrics"))
117
+
118
+ node_id = d.pop("nodeID")
119
+
120
+ sandboxes = []
121
+ _sandboxes = d.pop("sandboxes")
122
+ for sandboxes_item_data in _sandboxes:
123
+ sandboxes_item = ListedSandbox.from_dict(sandboxes_item_data)
124
+
125
+ sandboxes.append(sandboxes_item)
126
+
127
+ service_instance_id = d.pop("serviceInstanceID")
128
+
129
+ status = NodeStatus(d.pop("status"))
130
+
131
+ version = d.pop("version")
132
+
133
+ node_detail = cls(
134
+ cached_builds=cached_builds,
135
+ cluster_id=cluster_id,
136
+ commit=commit,
137
+ create_fails=create_fails,
138
+ create_successes=create_successes,
139
+ id=id,
140
+ metrics=metrics,
141
+ node_id=node_id,
142
+ sandboxes=sandboxes,
143
+ service_instance_id=service_instance_id,
144
+ status=status,
145
+ version=version,
146
+ )
147
+
148
+ node_detail.additional_properties = d
149
+ return node_detail
150
+
151
+ @property
152
+ def additional_keys(self) -> list[str]:
153
+ return list(self.additional_properties.keys())
154
+
155
+ def __getitem__(self, key: str) -> Any:
156
+ return self.additional_properties[key]
157
+
158
+ def __setitem__(self, key: str, value: Any) -> None:
159
+ self.additional_properties[key] = value
160
+
161
+ def __delitem__(self, key: str) -> None:
162
+ del self.additional_properties[key]
163
+
164
+ def __contains__(self, key: str) -> bool:
165
+ return key in self.additional_properties
@@ -0,0 +1,122 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ if TYPE_CHECKING:
8
+ from ..models.disk_metrics import DiskMetrics
9
+
10
+
11
+ T = TypeVar("T", bound="NodeMetrics")
12
+
13
+
14
+ @_attrs_define
15
+ class NodeMetrics:
16
+ """Node metrics
17
+
18
+ Attributes:
19
+ allocated_cpu (int): Number of allocated CPU cores
20
+ allocated_memory_bytes (int): Amount of allocated memory in bytes
21
+ cpu_count (int): Total number of CPU cores on the node
22
+ cpu_percent (int): Node CPU usage percentage
23
+ disks (list['DiskMetrics']): Detailed metrics for each disk/mount point
24
+ memory_total_bytes (int): Total node memory in bytes
25
+ memory_used_bytes (int): Node memory used in bytes
26
+ """
27
+
28
+ allocated_cpu: int
29
+ allocated_memory_bytes: int
30
+ cpu_count: int
31
+ cpu_percent: int
32
+ disks: list["DiskMetrics"]
33
+ memory_total_bytes: int
34
+ memory_used_bytes: int
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ allocated_cpu = self.allocated_cpu
39
+
40
+ allocated_memory_bytes = self.allocated_memory_bytes
41
+
42
+ cpu_count = self.cpu_count
43
+
44
+ cpu_percent = self.cpu_percent
45
+
46
+ disks = []
47
+ for disks_item_data in self.disks:
48
+ disks_item = disks_item_data.to_dict()
49
+ disks.append(disks_item)
50
+
51
+ memory_total_bytes = self.memory_total_bytes
52
+
53
+ memory_used_bytes = self.memory_used_bytes
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update(
58
+ {
59
+ "allocatedCPU": allocated_cpu,
60
+ "allocatedMemoryBytes": allocated_memory_bytes,
61
+ "cpuCount": cpu_count,
62
+ "cpuPercent": cpu_percent,
63
+ "disks": disks,
64
+ "memoryTotalBytes": memory_total_bytes,
65
+ "memoryUsedBytes": memory_used_bytes,
66
+ }
67
+ )
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ from ..models.disk_metrics import DiskMetrics
74
+
75
+ d = dict(src_dict)
76
+ allocated_cpu = d.pop("allocatedCPU")
77
+
78
+ allocated_memory_bytes = d.pop("allocatedMemoryBytes")
79
+
80
+ cpu_count = d.pop("cpuCount")
81
+
82
+ cpu_percent = d.pop("cpuPercent")
83
+
84
+ disks = []
85
+ _disks = d.pop("disks")
86
+ for disks_item_data in _disks:
87
+ disks_item = DiskMetrics.from_dict(disks_item_data)
88
+
89
+ disks.append(disks_item)
90
+
91
+ memory_total_bytes = d.pop("memoryTotalBytes")
92
+
93
+ memory_used_bytes = d.pop("memoryUsedBytes")
94
+
95
+ node_metrics = cls(
96
+ allocated_cpu=allocated_cpu,
97
+ allocated_memory_bytes=allocated_memory_bytes,
98
+ cpu_count=cpu_count,
99
+ cpu_percent=cpu_percent,
100
+ disks=disks,
101
+ memory_total_bytes=memory_total_bytes,
102
+ memory_used_bytes=memory_used_bytes,
103
+ )
104
+
105
+ node_metrics.additional_properties = d
106
+ return node_metrics
107
+
108
+ @property
109
+ def additional_keys(self) -> list[str]:
110
+ return list(self.additional_properties.keys())
111
+
112
+ def __getitem__(self, key: str) -> Any:
113
+ return self.additional_properties[key]
114
+
115
+ def __setitem__(self, key: str, value: Any) -> None:
116
+ self.additional_properties[key] = value
117
+
118
+ def __delitem__(self, key: str) -> None:
119
+ del self.additional_properties[key]
120
+
121
+ def __contains__(self, key: str) -> bool:
122
+ return key in self.additional_properties
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class NodeStatus(str, Enum):
5
+ CONNECTING = "connecting"
6
+ DRAINING = "draining"
7
+ READY = "ready"
8
+ UNHEALTHY = "unhealthy"
9
+
10
+ def __str__(self) -> str:
11
+ return str(self.value)
@@ -0,0 +1,79 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union
3
+ from uuid import UUID
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ from ..models.node_status import NodeStatus
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="NodeStatusChange")
12
+
13
+
14
+ @_attrs_define
15
+ class NodeStatusChange:
16
+ """
17
+ Attributes:
18
+ status (NodeStatus): Status of the node
19
+ cluster_id (Union[Unset, UUID]): Identifier of the cluster
20
+ """
21
+
22
+ status: NodeStatus
23
+ cluster_id: Union[Unset, UUID] = UNSET
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ status = self.status.value
28
+
29
+ cluster_id: Union[Unset, str] = UNSET
30
+ if not isinstance(self.cluster_id, Unset):
31
+ cluster_id = str(self.cluster_id)
32
+
33
+ field_dict: dict[str, Any] = {}
34
+ field_dict.update(self.additional_properties)
35
+ field_dict.update(
36
+ {
37
+ "status": status,
38
+ }
39
+ )
40
+ if cluster_id is not UNSET:
41
+ field_dict["clusterID"] = cluster_id
42
+
43
+ return field_dict
44
+
45
+ @classmethod
46
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
47
+ d = dict(src_dict)
48
+ status = NodeStatus(d.pop("status"))
49
+
50
+ _cluster_id = d.pop("clusterID", UNSET)
51
+ cluster_id: Union[Unset, UUID]
52
+ if isinstance(_cluster_id, Unset):
53
+ cluster_id = UNSET
54
+ else:
55
+ cluster_id = UUID(_cluster_id)
56
+
57
+ node_status_change = cls(
58
+ status=status,
59
+ cluster_id=cluster_id,
60
+ )
61
+
62
+ node_status_change.additional_properties = d
63
+ return node_status_change
64
+
65
+ @property
66
+ def additional_keys(self) -> list[str]:
67
+ return list(self.additional_properties.keys())
68
+
69
+ def __getitem__(self, key: str) -> Any:
70
+ return self.additional_properties[key]
71
+
72
+ def __setitem__(self, key: str, value: Any) -> None:
73
+ self.additional_properties[key] = value
74
+
75
+ def __delitem__(self, key: str) -> None:
76
+ del self.additional_properties[key]
77
+
78
+ def __contains__(self, key: str) -> bool:
79
+ return key in self.additional_properties
@@ -0,0 +1,59 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..types import UNSET, Unset
8
+
9
+ T = TypeVar("T", bound="PostSandboxesSandboxIDRefreshesBody")
10
+
11
+
12
+ @_attrs_define
13
+ class PostSandboxesSandboxIDRefreshesBody:
14
+ """
15
+ Attributes:
16
+ duration (Union[Unset, int]): Duration for which the sandbox should be kept alive in seconds
17
+ """
18
+
19
+ duration: Union[Unset, int] = UNSET
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ duration = self.duration
24
+
25
+ field_dict: dict[str, Any] = {}
26
+ field_dict.update(self.additional_properties)
27
+ field_dict.update({})
28
+ if duration is not UNSET:
29
+ field_dict["duration"] = duration
30
+
31
+ return field_dict
32
+
33
+ @classmethod
34
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
+ d = dict(src_dict)
36
+ duration = d.pop("duration", UNSET)
37
+
38
+ post_sandboxes_sandbox_id_refreshes_body = cls(
39
+ duration=duration,
40
+ )
41
+
42
+ post_sandboxes_sandbox_id_refreshes_body.additional_properties = d
43
+ return post_sandboxes_sandbox_id_refreshes_body
44
+
45
+ @property
46
+ def additional_keys(self) -> list[str]:
47
+ return list(self.additional_properties.keys())
48
+
49
+ def __getitem__(self, key: str) -> Any:
50
+ return self.additional_properties[key]
51
+
52
+ def __setitem__(self, key: str, value: Any) -> None:
53
+ self.additional_properties[key] = value
54
+
55
+ def __delitem__(self, key: str) -> None:
56
+ del self.additional_properties[key]
57
+
58
+ def __contains__(self, key: str) -> bool:
59
+ return key in self.additional_properties