loopix-sdk 2.30.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 (238) hide show
  1. loopix/__init__.py +260 -0
  2. loopix/api/__init__.py +287 -0
  3. loopix/api/client/__init__.py +8 -0
  4. loopix/api/client/api/__init__.py +1 -0
  5. loopix/api/client/api/sandboxes/__init__.py +1 -0
  6. loopix/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. loopix/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. loopix/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
  12. loopix/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
  13. loopix/api/client/api/sandboxes/get_v_2_sandboxes_sandbox_id_logs.py +254 -0
  14. loopix/api/client/api/sandboxes/post_sandboxes.py +172 -0
  15. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
  16. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +187 -0
  17. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
  18. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
  19. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_snapshots.py +195 -0
  20. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
  21. loopix/api/client/api/sandboxes/put_sandboxes_sandbox_id_network.py +199 -0
  22. loopix/api/client/api/snapshots/__init__.py +1 -0
  23. loopix/api/client/api/snapshots/get_snapshots.py +202 -0
  24. loopix/api/client/api/tags/__init__.py +1 -0
  25. loopix/api/client/api/tags/delete_templates_tags.py +174 -0
  26. loopix/api/client/api/tags/get_templates_template_id_tags.py +172 -0
  27. loopix/api/client/api/tags/post_templates_tags.py +176 -0
  28. loopix/api/client/api/templates/__init__.py +1 -0
  29. loopix/api/client/api/templates/delete_templates_template_id.py +157 -0
  30. loopix/api/client/api/templates/get_templates.py +172 -0
  31. loopix/api/client/api/templates/get_templates_aliases_alias.py +167 -0
  32. loopix/api/client/api/templates/get_templates_template_id.py +195 -0
  33. loopix/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +272 -0
  34. loopix/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +232 -0
  35. loopix/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
  36. loopix/api/client/api/templates/patch_templates_template_id.py +183 -0
  37. loopix/api/client/api/templates/patch_v_2_templates_template_id.py +185 -0
  38. loopix/api/client/api/templates/post_templates.py +172 -0
  39. loopix/api/client/api/templates/post_templates_template_id.py +181 -0
  40. loopix/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
  41. loopix/api/client/api/templates/post_v2_templates.py +172 -0
  42. loopix/api/client/api/templates/post_v3_templates.py +176 -0
  43. loopix/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
  44. loopix/api/client/api/volumes/__init__.py +1 -0
  45. loopix/api/client/api/volumes/delete_volumes_volume_id.py +161 -0
  46. loopix/api/client/api/volumes/get_volumes.py +140 -0
  47. loopix/api/client/api/volumes/get_volumes_volume_id.py +163 -0
  48. loopix/api/client/api/volumes/post_volumes.py +172 -0
  49. loopix/api/client/client.py +286 -0
  50. loopix/api/client/errors.py +16 -0
  51. loopix/api/client/models/__init__.py +185 -0
  52. loopix/api/client/models/admin_build_cancel_result.py +67 -0
  53. loopix/api/client/models/admin_sandbox_kill_result.py +67 -0
  54. loopix/api/client/models/assign_template_tags_request.py +67 -0
  55. loopix/api/client/models/assigned_template_tags.py +68 -0
  56. loopix/api/client/models/aws_registry.py +85 -0
  57. loopix/api/client/models/aws_registry_type.py +8 -0
  58. loopix/api/client/models/build_log_entry.py +89 -0
  59. loopix/api/client/models/build_status_reason.py +95 -0
  60. loopix/api/client/models/connect_sandbox.py +59 -0
  61. loopix/api/client/models/created_access_token.py +100 -0
  62. loopix/api/client/models/created_team_api_key.py +166 -0
  63. loopix/api/client/models/delete_template_tags_request.py +67 -0
  64. loopix/api/client/models/disk_metrics.py +91 -0
  65. loopix/api/client/models/error.py +67 -0
  66. loopix/api/client/models/gcp_registry.py +69 -0
  67. loopix/api/client/models/gcp_registry_type.py +8 -0
  68. loopix/api/client/models/general_registry.py +77 -0
  69. loopix/api/client/models/general_registry_type.py +8 -0
  70. loopix/api/client/models/identifier_masking_details.py +83 -0
  71. loopix/api/client/models/listed_sandbox.py +179 -0
  72. loopix/api/client/models/log_level.py +11 -0
  73. loopix/api/client/models/logs_direction.py +9 -0
  74. loopix/api/client/models/logs_source.py +9 -0
  75. loopix/api/client/models/machine_info.py +83 -0
  76. loopix/api/client/models/max_team_metric.py +78 -0
  77. loopix/api/client/models/mcp_type_0.py +44 -0
  78. loopix/api/client/models/new_access_token.py +59 -0
  79. loopix/api/client/models/new_sandbox.py +224 -0
  80. loopix/api/client/models/new_team_api_key.py +59 -0
  81. loopix/api/client/models/new_volume.py +59 -0
  82. loopix/api/client/models/node.py +160 -0
  83. loopix/api/client/models/node_detail.py +160 -0
  84. loopix/api/client/models/node_metrics.py +122 -0
  85. loopix/api/client/models/node_status.py +12 -0
  86. loopix/api/client/models/node_status_change.py +82 -0
  87. loopix/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  88. loopix/api/client/models/post_sandboxes_sandbox_id_snapshots_body.py +60 -0
  89. loopix/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  90. loopix/api/client/models/resumed_sandbox.py +68 -0
  91. loopix/api/client/models/sandbox.py +145 -0
  92. loopix/api/client/models/sandbox_auto_resume_config.py +60 -0
  93. loopix/api/client/models/sandbox_detail.py +267 -0
  94. loopix/api/client/models/sandbox_lifecycle.py +70 -0
  95. loopix/api/client/models/sandbox_log.py +70 -0
  96. loopix/api/client/models/sandbox_log_entry.py +93 -0
  97. loopix/api/client/models/sandbox_log_entry_fields.py +44 -0
  98. loopix/api/client/models/sandbox_logs.py +91 -0
  99. loopix/api/client/models/sandbox_logs_v2_response.py +73 -0
  100. loopix/api/client/models/sandbox_metric.py +126 -0
  101. loopix/api/client/models/sandbox_network_config.py +118 -0
  102. loopix/api/client/models/sandbox_network_config_rules.py +72 -0
  103. loopix/api/client/models/sandbox_network_rule.py +74 -0
  104. loopix/api/client/models/sandbox_network_transform.py +79 -0
  105. loopix/api/client/models/sandbox_network_transform_headers.py +47 -0
  106. loopix/api/client/models/sandbox_network_update_config.py +114 -0
  107. loopix/api/client/models/sandbox_network_update_config_rules.py +71 -0
  108. loopix/api/client/models/sandbox_on_timeout.py +9 -0
  109. loopix/api/client/models/sandbox_pause_request.py +62 -0
  110. loopix/api/client/models/sandbox_state.py +9 -0
  111. loopix/api/client/models/sandbox_volume_mount.py +67 -0
  112. loopix/api/client/models/sandboxes_with_metrics.py +59 -0
  113. loopix/api/client/models/snapshot_info.py +70 -0
  114. loopix/api/client/models/team.py +83 -0
  115. loopix/api/client/models/team_api_key.py +158 -0
  116. loopix/api/client/models/team_metric.py +86 -0
  117. loopix/api/client/models/team_user.py +75 -0
  118. loopix/api/client/models/template.py +225 -0
  119. loopix/api/client/models/template_alias_response.py +67 -0
  120. loopix/api/client/models/template_build.py +139 -0
  121. loopix/api/client/models/template_build_file_upload.py +70 -0
  122. loopix/api/client/models/template_build_info.py +126 -0
  123. loopix/api/client/models/template_build_logs_response.py +73 -0
  124. loopix/api/client/models/template_build_request.py +115 -0
  125. loopix/api/client/models/template_build_request_v2.py +88 -0
  126. loopix/api/client/models/template_build_request_v3.py +107 -0
  127. loopix/api/client/models/template_build_start_v2.py +184 -0
  128. loopix/api/client/models/template_build_status.py +11 -0
  129. loopix/api/client/models/template_legacy.py +207 -0
  130. loopix/api/client/models/template_request_response_v3.py +99 -0
  131. loopix/api/client/models/template_step.py +91 -0
  132. loopix/api/client/models/template_tag.py +78 -0
  133. loopix/api/client/models/template_update_request.py +59 -0
  134. loopix/api/client/models/template_update_response.py +59 -0
  135. loopix/api/client/models/template_with_builds.py +156 -0
  136. loopix/api/client/models/update_team_api_key.py +59 -0
  137. loopix/api/client/models/volume.py +67 -0
  138. loopix/api/client/models/volume_and_token.py +75 -0
  139. loopix/api/client/models/volume_token.py +59 -0
  140. loopix/api/client/py.typed +1 -0
  141. loopix/api/client/types.py +54 -0
  142. loopix/api/client_async/__init__.py +74 -0
  143. loopix/api/client_sync/__init__.py +73 -0
  144. loopix/api/metadata.py +14 -0
  145. loopix/connection_config.py +309 -0
  146. loopix/envd/api.py +170 -0
  147. loopix/envd/filesystem/filesystem_connect.py +193 -0
  148. loopix/envd/filesystem/filesystem_pb2.py +80 -0
  149. loopix/envd/filesystem/filesystem_pb2.pyi +272 -0
  150. loopix/envd/process/process_connect.py +174 -0
  151. loopix/envd/process/process_pb2.py +96 -0
  152. loopix/envd/process/process_pb2.pyi +316 -0
  153. loopix/envd/rpc.py +139 -0
  154. loopix/envd/versions.py +11 -0
  155. loopix/exceptions.py +133 -0
  156. loopix/io_utils.py +57 -0
  157. loopix/paginator.py +52 -0
  158. loopix/py.typed +0 -0
  159. loopix/sandbox/_git/__init__.py +85 -0
  160. loopix/sandbox/_git/args.py +363 -0
  161. loopix/sandbox/_git/auth.py +132 -0
  162. loopix/sandbox/_git/config.py +32 -0
  163. loopix/sandbox/_git/parse.py +222 -0
  164. loopix/sandbox/_git/types.py +149 -0
  165. loopix/sandbox/commands/command_handle.py +69 -0
  166. loopix/sandbox/commands/main.py +39 -0
  167. loopix/sandbox/filesystem/filesystem.py +337 -0
  168. loopix/sandbox/filesystem/watch_handle.py +70 -0
  169. loopix/sandbox/main.py +227 -0
  170. loopix/sandbox/mcp.py +1949 -0
  171. loopix/sandbox/network.py +8 -0
  172. loopix/sandbox/sandbox_api.py +624 -0
  173. loopix/sandbox/signature.py +47 -0
  174. loopix/sandbox/utils.py +34 -0
  175. loopix/sandbox_async/commands/command.py +396 -0
  176. loopix/sandbox_async/commands/command_handle.py +298 -0
  177. loopix/sandbox_async/commands/pty.py +257 -0
  178. loopix/sandbox_async/filesystem/filesystem.py +720 -0
  179. loopix/sandbox_async/filesystem/watch_handle.py +97 -0
  180. loopix/sandbox_async/git.py +1100 -0
  181. loopix/sandbox_async/main.py +987 -0
  182. loopix/sandbox_async/paginator.py +140 -0
  183. loopix/sandbox_async/sandbox_api.py +504 -0
  184. loopix/sandbox_async/utils.py +7 -0
  185. loopix/sandbox_domains.py +5 -0
  186. loopix/sandbox_sync/commands/command.py +420 -0
  187. loopix/sandbox_sync/commands/command_handle.py +239 -0
  188. loopix/sandbox_sync/commands/pty.py +279 -0
  189. loopix/sandbox_sync/filesystem/filesystem.py +710 -0
  190. loopix/sandbox_sync/filesystem/watch_handle.py +102 -0
  191. loopix/sandbox_sync/git.py +1077 -0
  192. loopix/sandbox_sync/main.py +975 -0
  193. loopix/sandbox_sync/paginator.py +140 -0
  194. loopix/sandbox_sync/sandbox_api.py +491 -0
  195. loopix/template/consts.py +45 -0
  196. loopix/template/dockerfile_parser.py +286 -0
  197. loopix/template/logger.py +232 -0
  198. loopix/template/main.py +1368 -0
  199. loopix/template/readycmd.py +144 -0
  200. loopix/template/types.py +194 -0
  201. loopix/template/utils.py +426 -0
  202. loopix/template_async/build_api.py +419 -0
  203. loopix/template_async/main.py +528 -0
  204. loopix/template_sync/build_api.py +409 -0
  205. loopix/template_sync/main.py +529 -0
  206. loopix/volume/client/__init__.py +8 -0
  207. loopix/volume/client/api/__init__.py +1 -0
  208. loopix/volume/client/api/volumes/__init__.py +1 -0
  209. loopix/volume/client/api/volumes/delete_volumecontent_volume_id_path.py +174 -0
  210. loopix/volume/client/api/volumes/get_volumecontent_volume_id_dir.py +204 -0
  211. loopix/volume/client/api/volumes/get_volumecontent_volume_id_file.py +179 -0
  212. loopix/volume/client/api/volumes/get_volumecontent_volume_id_path.py +176 -0
  213. loopix/volume/client/api/volumes/patch_volumecontent_volume_id_path.py +203 -0
  214. loopix/volume/client/api/volumes/post_volumecontent_volume_id_dir.py +239 -0
  215. loopix/volume/client/api/volumes/put_volumecontent_volume_id_file.py +259 -0
  216. loopix/volume/client/client.py +286 -0
  217. loopix/volume/client/errors.py +16 -0
  218. loopix/volume/client/models/__init__.py +13 -0
  219. loopix/volume/client/models/error.py +67 -0
  220. loopix/volume/client/models/patch_volumecontent_volume_id_path_body.py +77 -0
  221. loopix/volume/client/models/volume_entry_stat.py +145 -0
  222. loopix/volume/client/models/volume_entry_stat_type.py +11 -0
  223. loopix/volume/client/py.typed +1 -0
  224. loopix/volume/client/types.py +54 -0
  225. loopix/volume/client_async/__init__.py +88 -0
  226. loopix/volume/client_sync/__init__.py +80 -0
  227. loopix/volume/connection_config.py +145 -0
  228. loopix/volume/types.py +62 -0
  229. loopix/volume/utils.py +52 -0
  230. loopix/volume/volume_async.py +639 -0
  231. loopix/volume/volume_sync.py +639 -0
  232. loopix_connect/__init__.py +1 -0
  233. loopix_connect/client.py +534 -0
  234. loopix_connect/py.typed +0 -0
  235. loopix_sdk-2.30.0.dist-info/METADATA +98 -0
  236. loopix_sdk-2.30.0.dist-info/RECORD +238 -0
  237. loopix_sdk-2.30.0.dist-info/WHEEL +4 -0
  238. loopix_sdk-2.30.0.dist-info/licenses/LICENSE +9 -0
@@ -0,0 +1,267 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ from ..models.sandbox_state import SandboxState
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.sandbox_lifecycle import SandboxLifecycle
14
+ from ..models.sandbox_network_config import SandboxNetworkConfig
15
+ from ..models.sandbox_volume_mount import SandboxVolumeMount
16
+
17
+
18
+ T = TypeVar("T", bound="SandboxDetail")
19
+
20
+
21
+ @_attrs_define
22
+ class SandboxDetail:
23
+ """
24
+ Attributes:
25
+ client_id (str): Identifier of the client
26
+ cpu_count (int): CPU cores for the sandbox
27
+ disk_size_mb (int): Disk size for the sandbox in MiB
28
+ end_at (datetime.datetime): Time when the sandbox will expire
29
+ envd_version (str): Version of the envd running in the sandbox
30
+ memory_mb (int): Memory for the sandbox in MiB
31
+ sandbox_id (str): Identifier of the sandbox
32
+ started_at (datetime.datetime): Time when the sandbox was started
33
+ state (SandboxState): State of the sandbox
34
+ template_id (str): Identifier of the template from which is the sandbox created
35
+ alias (Union[Unset, str]): Alias of the template
36
+ allow_internet_access (Union[None, Unset, bool]): Whether internet access was explicitly enabled or disabled for
37
+ the sandbox. Null means it was not explicitly set.
38
+ domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible
39
+ envd_access_token (Union[Unset, str]): Access token used for envd communication
40
+ lifecycle (Union[Unset, SandboxLifecycle]): Sandbox lifecycle policy returned by sandbox info.
41
+ metadata (Union[Unset, Any]):
42
+ network (Union[Unset, SandboxNetworkConfig]):
43
+ volume_mounts (Union[Unset, list['SandboxVolumeMount']]):
44
+ """
45
+
46
+ client_id: str
47
+ cpu_count: int
48
+ disk_size_mb: int
49
+ end_at: datetime.datetime
50
+ envd_version: str
51
+ memory_mb: int
52
+ sandbox_id: str
53
+ started_at: datetime.datetime
54
+ state: SandboxState
55
+ template_id: str
56
+ alias: Union[Unset, str] = UNSET
57
+ allow_internet_access: Union[None, Unset, bool] = UNSET
58
+ domain: Union[None, Unset, str] = UNSET
59
+ envd_access_token: Union[Unset, str] = UNSET
60
+ lifecycle: Union[Unset, "SandboxLifecycle"] = UNSET
61
+ metadata: Union[Unset, Any] = UNSET
62
+ network: Union[Unset, "SandboxNetworkConfig"] = UNSET
63
+ volume_mounts: Union[Unset, list["SandboxVolumeMount"]] = UNSET
64
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
65
+
66
+ def to_dict(self) -> dict[str, Any]:
67
+ client_id = self.client_id
68
+
69
+ cpu_count = self.cpu_count
70
+
71
+ disk_size_mb = self.disk_size_mb
72
+
73
+ end_at = self.end_at.isoformat()
74
+
75
+ envd_version = self.envd_version
76
+
77
+ memory_mb = self.memory_mb
78
+
79
+ sandbox_id = self.sandbox_id
80
+
81
+ started_at = self.started_at.isoformat()
82
+
83
+ state = self.state.value
84
+
85
+ template_id = self.template_id
86
+
87
+ alias = self.alias
88
+
89
+ allow_internet_access: Union[None, Unset, bool]
90
+ if isinstance(self.allow_internet_access, Unset):
91
+ allow_internet_access = UNSET
92
+ else:
93
+ allow_internet_access = self.allow_internet_access
94
+
95
+ domain: Union[None, Unset, str]
96
+ if isinstance(self.domain, Unset):
97
+ domain = UNSET
98
+ else:
99
+ domain = self.domain
100
+
101
+ envd_access_token = self.envd_access_token
102
+
103
+ lifecycle: Union[Unset, dict[str, Any]] = UNSET
104
+ if not isinstance(self.lifecycle, Unset):
105
+ lifecycle = self.lifecycle.to_dict()
106
+
107
+ metadata = self.metadata
108
+
109
+ network: Union[Unset, dict[str, Any]] = UNSET
110
+ if not isinstance(self.network, Unset):
111
+ network = self.network.to_dict()
112
+
113
+ volume_mounts: Union[Unset, list[dict[str, Any]]] = UNSET
114
+ if not isinstance(self.volume_mounts, Unset):
115
+ volume_mounts = []
116
+ for volume_mounts_item_data in self.volume_mounts:
117
+ volume_mounts_item = volume_mounts_item_data.to_dict()
118
+ volume_mounts.append(volume_mounts_item)
119
+
120
+ field_dict: dict[str, Any] = {}
121
+ field_dict.update(self.additional_properties)
122
+ field_dict.update(
123
+ {
124
+ "clientID": client_id,
125
+ "cpuCount": cpu_count,
126
+ "diskSizeMB": disk_size_mb,
127
+ "endAt": end_at,
128
+ "envdVersion": envd_version,
129
+ "memoryMB": memory_mb,
130
+ "sandboxID": sandbox_id,
131
+ "startedAt": started_at,
132
+ "state": state,
133
+ "templateID": template_id,
134
+ }
135
+ )
136
+ if alias is not UNSET:
137
+ field_dict["alias"] = alias
138
+ if allow_internet_access is not UNSET:
139
+ field_dict["allowInternetAccess"] = allow_internet_access
140
+ if domain is not UNSET:
141
+ field_dict["domain"] = domain
142
+ if envd_access_token is not UNSET:
143
+ field_dict["envdAccessToken"] = envd_access_token
144
+ if lifecycle is not UNSET:
145
+ field_dict["lifecycle"] = lifecycle
146
+ if metadata is not UNSET:
147
+ field_dict["metadata"] = metadata
148
+ if network is not UNSET:
149
+ field_dict["network"] = network
150
+ if volume_mounts is not UNSET:
151
+ field_dict["volumeMounts"] = volume_mounts
152
+
153
+ return field_dict
154
+
155
+ @classmethod
156
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
157
+ from ..models.sandbox_lifecycle import SandboxLifecycle
158
+ from ..models.sandbox_network_config import SandboxNetworkConfig
159
+ from ..models.sandbox_volume_mount import SandboxVolumeMount
160
+
161
+ d = dict(src_dict)
162
+ client_id = d.pop("clientID")
163
+
164
+ cpu_count = d.pop("cpuCount")
165
+
166
+ disk_size_mb = d.pop("diskSizeMB")
167
+
168
+ end_at = isoparse(d.pop("endAt"))
169
+
170
+ envd_version = d.pop("envdVersion")
171
+
172
+ memory_mb = d.pop("memoryMB")
173
+
174
+ sandbox_id = d.pop("sandboxID")
175
+
176
+ started_at = isoparse(d.pop("startedAt"))
177
+
178
+ state = SandboxState(d.pop("state"))
179
+
180
+ template_id = d.pop("templateID")
181
+
182
+ alias = d.pop("alias", UNSET)
183
+
184
+ def _parse_allow_internet_access(data: object) -> Union[None, Unset, bool]:
185
+ if data is None:
186
+ return data
187
+ if isinstance(data, Unset):
188
+ return data
189
+ return cast(Union[None, Unset, bool], data)
190
+
191
+ allow_internet_access = _parse_allow_internet_access(
192
+ d.pop("allowInternetAccess", UNSET)
193
+ )
194
+
195
+ def _parse_domain(data: object) -> Union[None, Unset, str]:
196
+ if data is None:
197
+ return data
198
+ if isinstance(data, Unset):
199
+ return data
200
+ return cast(Union[None, Unset, str], data)
201
+
202
+ domain = _parse_domain(d.pop("domain", UNSET))
203
+
204
+ envd_access_token = d.pop("envdAccessToken", UNSET)
205
+
206
+ _lifecycle = d.pop("lifecycle", UNSET)
207
+ lifecycle: Union[Unset, SandboxLifecycle]
208
+ if isinstance(_lifecycle, Unset):
209
+ lifecycle = UNSET
210
+ else:
211
+ lifecycle = SandboxLifecycle.from_dict(_lifecycle)
212
+
213
+ metadata = d.pop("metadata", UNSET)
214
+
215
+ _network = d.pop("network", UNSET)
216
+ network: Union[Unset, SandboxNetworkConfig]
217
+ if isinstance(_network, Unset):
218
+ network = UNSET
219
+ else:
220
+ network = SandboxNetworkConfig.from_dict(_network)
221
+
222
+ volume_mounts = []
223
+ _volume_mounts = d.pop("volumeMounts", UNSET)
224
+ for volume_mounts_item_data in _volume_mounts or []:
225
+ volume_mounts_item = SandboxVolumeMount.from_dict(volume_mounts_item_data)
226
+
227
+ volume_mounts.append(volume_mounts_item)
228
+
229
+ sandbox_detail = cls(
230
+ client_id=client_id,
231
+ cpu_count=cpu_count,
232
+ disk_size_mb=disk_size_mb,
233
+ end_at=end_at,
234
+ envd_version=envd_version,
235
+ memory_mb=memory_mb,
236
+ sandbox_id=sandbox_id,
237
+ started_at=started_at,
238
+ state=state,
239
+ template_id=template_id,
240
+ alias=alias,
241
+ allow_internet_access=allow_internet_access,
242
+ domain=domain,
243
+ envd_access_token=envd_access_token,
244
+ lifecycle=lifecycle,
245
+ metadata=metadata,
246
+ network=network,
247
+ volume_mounts=volume_mounts,
248
+ )
249
+
250
+ sandbox_detail.additional_properties = d
251
+ return sandbox_detail
252
+
253
+ @property
254
+ def additional_keys(self) -> list[str]:
255
+ return list(self.additional_properties.keys())
256
+
257
+ def __getitem__(self, key: str) -> Any:
258
+ return self.additional_properties[key]
259
+
260
+ def __setitem__(self, key: str, value: Any) -> None:
261
+ self.additional_properties[key] = value
262
+
263
+ def __delitem__(self, key: str) -> None:
264
+ del self.additional_properties[key]
265
+
266
+ def __contains__(self, key: str) -> bool:
267
+ return key in self.additional_properties
@@ -0,0 +1,70 @@
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
+ from ..models.sandbox_on_timeout import SandboxOnTimeout
8
+
9
+ T = TypeVar("T", bound="SandboxLifecycle")
10
+
11
+
12
+ @_attrs_define
13
+ class SandboxLifecycle:
14
+ """Sandbox lifecycle policy returned by sandbox info.
15
+
16
+ Attributes:
17
+ auto_resume (bool): Whether the sandbox can auto-resume.
18
+ on_timeout (SandboxOnTimeout): Action taken when the sandbox times out.
19
+ """
20
+
21
+ auto_resume: bool
22
+ on_timeout: SandboxOnTimeout
23
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
+
25
+ def to_dict(self) -> dict[str, Any]:
26
+ auto_resume = self.auto_resume
27
+
28
+ on_timeout = self.on_timeout.value
29
+
30
+ field_dict: dict[str, Any] = {}
31
+ field_dict.update(self.additional_properties)
32
+ field_dict.update(
33
+ {
34
+ "autoResume": auto_resume,
35
+ "onTimeout": on_timeout,
36
+ }
37
+ )
38
+
39
+ return field_dict
40
+
41
+ @classmethod
42
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
43
+ d = dict(src_dict)
44
+ auto_resume = d.pop("autoResume")
45
+
46
+ on_timeout = SandboxOnTimeout(d.pop("onTimeout"))
47
+
48
+ sandbox_lifecycle = cls(
49
+ auto_resume=auto_resume,
50
+ on_timeout=on_timeout,
51
+ )
52
+
53
+ sandbox_lifecycle.additional_properties = d
54
+ return sandbox_lifecycle
55
+
56
+ @property
57
+ def additional_keys(self) -> list[str]:
58
+ return list(self.additional_properties.keys())
59
+
60
+ def __getitem__(self, key: str) -> Any:
61
+ return self.additional_properties[key]
62
+
63
+ def __setitem__(self, key: str, value: Any) -> None:
64
+ self.additional_properties[key] = value
65
+
66
+ def __delitem__(self, key: str) -> None:
67
+ del self.additional_properties[key]
68
+
69
+ def __contains__(self, key: str) -> bool:
70
+ return key in self.additional_properties
@@ -0,0 +1,70 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import Any, TypeVar
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ T = TypeVar("T", bound="SandboxLog")
10
+
11
+
12
+ @_attrs_define
13
+ class SandboxLog:
14
+ """Log entry with timestamp and line
15
+
16
+ Attributes:
17
+ line (str): Log line content
18
+ timestamp (datetime.datetime): Timestamp of the log entry
19
+ """
20
+
21
+ line: str
22
+ timestamp: datetime.datetime
23
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
+
25
+ def to_dict(self) -> dict[str, Any]:
26
+ line = self.line
27
+
28
+ timestamp = self.timestamp.isoformat()
29
+
30
+ field_dict: dict[str, Any] = {}
31
+ field_dict.update(self.additional_properties)
32
+ field_dict.update(
33
+ {
34
+ "line": line,
35
+ "timestamp": timestamp,
36
+ }
37
+ )
38
+
39
+ return field_dict
40
+
41
+ @classmethod
42
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
43
+ d = dict(src_dict)
44
+ line = d.pop("line")
45
+
46
+ timestamp = isoparse(d.pop("timestamp"))
47
+
48
+ sandbox_log = cls(
49
+ line=line,
50
+ timestamp=timestamp,
51
+ )
52
+
53
+ sandbox_log.additional_properties = d
54
+ return sandbox_log
55
+
56
+ @property
57
+ def additional_keys(self) -> list[str]:
58
+ return list(self.additional_properties.keys())
59
+
60
+ def __getitem__(self, key: str) -> Any:
61
+ return self.additional_properties[key]
62
+
63
+ def __setitem__(self, key: str, value: Any) -> None:
64
+ self.additional_properties[key] = value
65
+
66
+ def __delitem__(self, key: str) -> None:
67
+ del self.additional_properties[key]
68
+
69
+ def __contains__(self, key: str) -> bool:
70
+ return key in self.additional_properties
@@ -0,0 +1,93 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+ from dateutil.parser import isoparse
8
+
9
+ from ..models.log_level import LogLevel
10
+
11
+ if TYPE_CHECKING:
12
+ from ..models.sandbox_log_entry_fields import SandboxLogEntryFields
13
+
14
+
15
+ T = TypeVar("T", bound="SandboxLogEntry")
16
+
17
+
18
+ @_attrs_define
19
+ class SandboxLogEntry:
20
+ """
21
+ Attributes:
22
+ fields (SandboxLogEntryFields):
23
+ level (LogLevel): State of the sandbox
24
+ message (str): Log message content
25
+ timestamp (datetime.datetime): Timestamp of the log entry
26
+ """
27
+
28
+ fields: "SandboxLogEntryFields"
29
+ level: LogLevel
30
+ message: str
31
+ timestamp: datetime.datetime
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ fields = self.fields.to_dict()
36
+
37
+ level = self.level.value
38
+
39
+ message = self.message
40
+
41
+ timestamp = self.timestamp.isoformat()
42
+
43
+ field_dict: dict[str, Any] = {}
44
+ field_dict.update(self.additional_properties)
45
+ field_dict.update(
46
+ {
47
+ "fields": fields,
48
+ "level": level,
49
+ "message": message,
50
+ "timestamp": timestamp,
51
+ }
52
+ )
53
+
54
+ return field_dict
55
+
56
+ @classmethod
57
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
58
+ from ..models.sandbox_log_entry_fields import SandboxLogEntryFields
59
+
60
+ d = dict(src_dict)
61
+ fields = SandboxLogEntryFields.from_dict(d.pop("fields"))
62
+
63
+ level = LogLevel(d.pop("level"))
64
+
65
+ message = d.pop("message")
66
+
67
+ timestamp = isoparse(d.pop("timestamp"))
68
+
69
+ sandbox_log_entry = cls(
70
+ fields=fields,
71
+ level=level,
72
+ message=message,
73
+ timestamp=timestamp,
74
+ )
75
+
76
+ sandbox_log_entry.additional_properties = d
77
+ return sandbox_log_entry
78
+
79
+ @property
80
+ def additional_keys(self) -> list[str]:
81
+ return list(self.additional_properties.keys())
82
+
83
+ def __getitem__(self, key: str) -> Any:
84
+ return self.additional_properties[key]
85
+
86
+ def __setitem__(self, key: str, value: Any) -> None:
87
+ self.additional_properties[key] = value
88
+
89
+ def __delitem__(self, key: str) -> None:
90
+ del self.additional_properties[key]
91
+
92
+ def __contains__(self, key: str) -> bool:
93
+ return key in self.additional_properties
@@ -0,0 +1,44 @@
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="SandboxLogEntryFields")
8
+
9
+
10
+ @_attrs_define
11
+ class SandboxLogEntryFields:
12
+ """ """
13
+
14
+ additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
15
+
16
+ def to_dict(self) -> dict[str, Any]:
17
+ field_dict: dict[str, Any] = {}
18
+ field_dict.update(self.additional_properties)
19
+
20
+ return field_dict
21
+
22
+ @classmethod
23
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
24
+ d = dict(src_dict)
25
+ sandbox_log_entry_fields = cls()
26
+
27
+ sandbox_log_entry_fields.additional_properties = d
28
+ return sandbox_log_entry_fields
29
+
30
+ @property
31
+ def additional_keys(self) -> list[str]:
32
+ return list(self.additional_properties.keys())
33
+
34
+ def __getitem__(self, key: str) -> str:
35
+ return self.additional_properties[key]
36
+
37
+ def __setitem__(self, key: str, value: str) -> None:
38
+ self.additional_properties[key] = value
39
+
40
+ def __delitem__(self, key: str) -> None:
41
+ del self.additional_properties[key]
42
+
43
+ def __contains__(self, key: str) -> bool:
44
+ return key in self.additional_properties
@@ -0,0 +1,91 @@
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.sandbox_log import SandboxLog
9
+ from ..models.sandbox_log_entry import SandboxLogEntry
10
+
11
+
12
+ T = TypeVar("T", bound="SandboxLogs")
13
+
14
+
15
+ @_attrs_define
16
+ class SandboxLogs:
17
+ """
18
+ Attributes:
19
+ log_entries (list['SandboxLogEntry']): Structured logs of the sandbox
20
+ logs (list['SandboxLog']): Logs of the sandbox
21
+ """
22
+
23
+ log_entries: list["SandboxLogEntry"]
24
+ logs: list["SandboxLog"]
25
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
+
27
+ def to_dict(self) -> dict[str, Any]:
28
+ log_entries = []
29
+ for log_entries_item_data in self.log_entries:
30
+ log_entries_item = log_entries_item_data.to_dict()
31
+ log_entries.append(log_entries_item)
32
+
33
+ logs = []
34
+ for logs_item_data in self.logs:
35
+ logs_item = logs_item_data.to_dict()
36
+ logs.append(logs_item)
37
+
38
+ field_dict: dict[str, Any] = {}
39
+ field_dict.update(self.additional_properties)
40
+ field_dict.update(
41
+ {
42
+ "logEntries": log_entries,
43
+ "logs": logs,
44
+ }
45
+ )
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ from ..models.sandbox_log import SandboxLog
52
+ from ..models.sandbox_log_entry import SandboxLogEntry
53
+
54
+ d = dict(src_dict)
55
+ log_entries = []
56
+ _log_entries = d.pop("logEntries")
57
+ for log_entries_item_data in _log_entries:
58
+ log_entries_item = SandboxLogEntry.from_dict(log_entries_item_data)
59
+
60
+ log_entries.append(log_entries_item)
61
+
62
+ logs = []
63
+ _logs = d.pop("logs")
64
+ for logs_item_data in _logs:
65
+ logs_item = SandboxLog.from_dict(logs_item_data)
66
+
67
+ logs.append(logs_item)
68
+
69
+ sandbox_logs = cls(
70
+ log_entries=log_entries,
71
+ logs=logs,
72
+ )
73
+
74
+ sandbox_logs.additional_properties = d
75
+ return sandbox_logs
76
+
77
+ @property
78
+ def additional_keys(self) -> list[str]:
79
+ return list(self.additional_properties.keys())
80
+
81
+ def __getitem__(self, key: str) -> Any:
82
+ return self.additional_properties[key]
83
+
84
+ def __setitem__(self, key: str, value: Any) -> None:
85
+ self.additional_properties[key] = value
86
+
87
+ def __delitem__(self, key: str) -> None:
88
+ del self.additional_properties[key]
89
+
90
+ def __contains__(self, key: str) -> bool:
91
+ return key in self.additional_properties