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,158 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4
+ from uuid import UUID
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+ from dateutil.parser import isoparse
9
+
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
14
+ from ..models.team_user import TeamUser
15
+
16
+
17
+ T = TypeVar("T", bound="TeamAPIKey")
18
+
19
+
20
+ @_attrs_define
21
+ class TeamAPIKey:
22
+ """
23
+ Attributes:
24
+ created_at (datetime.datetime): Timestamp of API key creation
25
+ id (UUID): Identifier of the API key
26
+ mask (IdentifierMaskingDetails):
27
+ name (str): Name of the API key
28
+ created_by (Union['TeamUser', None, Unset]):
29
+ last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used
30
+ """
31
+
32
+ created_at: datetime.datetime
33
+ id: UUID
34
+ mask: "IdentifierMaskingDetails"
35
+ name: str
36
+ created_by: Union["TeamUser", None, Unset] = UNSET
37
+ last_used: Union[None, Unset, datetime.datetime] = UNSET
38
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ from ..models.team_user import TeamUser
42
+
43
+ created_at = self.created_at.isoformat()
44
+
45
+ id = str(self.id)
46
+
47
+ mask = self.mask.to_dict()
48
+
49
+ name = self.name
50
+
51
+ created_by: Union[None, Unset, dict[str, Any]]
52
+ if isinstance(self.created_by, Unset):
53
+ created_by = UNSET
54
+ elif isinstance(self.created_by, TeamUser):
55
+ created_by = self.created_by.to_dict()
56
+ else:
57
+ created_by = self.created_by
58
+
59
+ last_used: Union[None, Unset, str]
60
+ if isinstance(self.last_used, Unset):
61
+ last_used = UNSET
62
+ elif isinstance(self.last_used, datetime.datetime):
63
+ last_used = self.last_used.isoformat()
64
+ else:
65
+ last_used = self.last_used
66
+
67
+ field_dict: dict[str, Any] = {}
68
+ field_dict.update(self.additional_properties)
69
+ field_dict.update(
70
+ {
71
+ "createdAt": created_at,
72
+ "id": id,
73
+ "mask": mask,
74
+ "name": name,
75
+ }
76
+ )
77
+ if created_by is not UNSET:
78
+ field_dict["createdBy"] = created_by
79
+ if last_used is not UNSET:
80
+ field_dict["lastUsed"] = last_used
81
+
82
+ return field_dict
83
+
84
+ @classmethod
85
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
86
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
87
+ from ..models.team_user import TeamUser
88
+
89
+ d = dict(src_dict)
90
+ created_at = isoparse(d.pop("createdAt"))
91
+
92
+ id = UUID(d.pop("id"))
93
+
94
+ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))
95
+
96
+ name = d.pop("name")
97
+
98
+ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]:
99
+ if data is None:
100
+ return data
101
+ if isinstance(data, Unset):
102
+ return data
103
+ try:
104
+ if not isinstance(data, dict):
105
+ raise TypeError()
106
+ created_by_type_1 = TeamUser.from_dict(data)
107
+
108
+ return created_by_type_1
109
+ except: # noqa: E722
110
+ pass
111
+ return cast(Union["TeamUser", None, Unset], data)
112
+
113
+ created_by = _parse_created_by(d.pop("createdBy", UNSET))
114
+
115
+ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]:
116
+ if data is None:
117
+ return data
118
+ if isinstance(data, Unset):
119
+ return data
120
+ try:
121
+ if not isinstance(data, str):
122
+ raise TypeError()
123
+ last_used_type_0 = isoparse(data)
124
+
125
+ return last_used_type_0
126
+ except: # noqa: E722
127
+ pass
128
+ return cast(Union[None, Unset, datetime.datetime], data)
129
+
130
+ last_used = _parse_last_used(d.pop("lastUsed", UNSET))
131
+
132
+ team_api_key = cls(
133
+ created_at=created_at,
134
+ id=id,
135
+ mask=mask,
136
+ name=name,
137
+ created_by=created_by,
138
+ last_used=last_used,
139
+ )
140
+
141
+ team_api_key.additional_properties = d
142
+ return team_api_key
143
+
144
+ @property
145
+ def additional_keys(self) -> list[str]:
146
+ return list(self.additional_properties.keys())
147
+
148
+ def __getitem__(self, key: str) -> Any:
149
+ return self.additional_properties[key]
150
+
151
+ def __setitem__(self, key: str, value: Any) -> None:
152
+ self.additional_properties[key] = value
153
+
154
+ def __delitem__(self, key: str) -> None:
155
+ del self.additional_properties[key]
156
+
157
+ def __contains__(self, key: str) -> bool:
158
+ return key in self.additional_properties
@@ -0,0 +1,86 @@
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="TeamMetric")
10
+
11
+
12
+ @_attrs_define
13
+ class TeamMetric:
14
+ """Team metric with timestamp
15
+
16
+ Attributes:
17
+ concurrent_sandboxes (int): The number of concurrent sandboxes for the team
18
+ sandbox_start_rate (float): Number of sandboxes started per second
19
+ timestamp (datetime.datetime): Timestamp of the metric entry
20
+ timestamp_unix (int): Timestamp of the metric entry in Unix time (seconds since epoch)
21
+ """
22
+
23
+ concurrent_sandboxes: int
24
+ sandbox_start_rate: float
25
+ timestamp: datetime.datetime
26
+ timestamp_unix: int
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ concurrent_sandboxes = self.concurrent_sandboxes
31
+
32
+ sandbox_start_rate = self.sandbox_start_rate
33
+
34
+ timestamp = self.timestamp.isoformat()
35
+
36
+ timestamp_unix = self.timestamp_unix
37
+
38
+ field_dict: dict[str, Any] = {}
39
+ field_dict.update(self.additional_properties)
40
+ field_dict.update(
41
+ {
42
+ "concurrentSandboxes": concurrent_sandboxes,
43
+ "sandboxStartRate": sandbox_start_rate,
44
+ "timestamp": timestamp,
45
+ "timestampUnix": timestamp_unix,
46
+ }
47
+ )
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
53
+ d = dict(src_dict)
54
+ concurrent_sandboxes = d.pop("concurrentSandboxes")
55
+
56
+ sandbox_start_rate = d.pop("sandboxStartRate")
57
+
58
+ timestamp = isoparse(d.pop("timestamp"))
59
+
60
+ timestamp_unix = d.pop("timestampUnix")
61
+
62
+ team_metric = cls(
63
+ concurrent_sandboxes=concurrent_sandboxes,
64
+ sandbox_start_rate=sandbox_start_rate,
65
+ timestamp=timestamp,
66
+ timestamp_unix=timestamp_unix,
67
+ )
68
+
69
+ team_metric.additional_properties = d
70
+ return team_metric
71
+
72
+ @property
73
+ def additional_keys(self) -> list[str]:
74
+ return list(self.additional_properties.keys())
75
+
76
+ def __getitem__(self, key: str) -> Any:
77
+ return self.additional_properties[key]
78
+
79
+ def __setitem__(self, key: str, value: Any) -> None:
80
+ self.additional_properties[key] = value
81
+
82
+ def __delitem__(self, key: str) -> None:
83
+ del self.additional_properties[key]
84
+
85
+ def __contains__(self, key: str) -> bool:
86
+ return key in self.additional_properties
@@ -0,0 +1,75 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
3
+ from uuid import UUID
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ T = TypeVar("T", bound="TeamUser")
9
+
10
+
11
+ @_attrs_define
12
+ class TeamUser:
13
+ """
14
+ Attributes:
15
+ email (Union[None, str]): Email of the user
16
+ id (UUID): Identifier of the user
17
+ """
18
+
19
+ email: Union[None, str]
20
+ id: UUID
21
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
22
+
23
+ def to_dict(self) -> dict[str, Any]:
24
+ email: Union[None, str]
25
+ email = self.email
26
+
27
+ id = str(self.id)
28
+
29
+ field_dict: dict[str, Any] = {}
30
+ field_dict.update(self.additional_properties)
31
+ field_dict.update(
32
+ {
33
+ "email": email,
34
+ "id": id,
35
+ }
36
+ )
37
+
38
+ return field_dict
39
+
40
+ @classmethod
41
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
42
+ d = dict(src_dict)
43
+
44
+ def _parse_email(data: object) -> Union[None, str]:
45
+ if data is None:
46
+ return data
47
+ return cast(Union[None, str], data)
48
+
49
+ email = _parse_email(d.pop("email"))
50
+
51
+ id = UUID(d.pop("id"))
52
+
53
+ team_user = cls(
54
+ email=email,
55
+ id=id,
56
+ )
57
+
58
+ team_user.additional_properties = d
59
+ return team_user
60
+
61
+ @property
62
+ def additional_keys(self) -> list[str]:
63
+ return list(self.additional_properties.keys())
64
+
65
+ def __getitem__(self, key: str) -> Any:
66
+ return self.additional_properties[key]
67
+
68
+ def __setitem__(self, key: str, value: Any) -> None:
69
+ self.additional_properties[key] = value
70
+
71
+ def __delitem__(self, key: str) -> None:
72
+ del self.additional_properties[key]
73
+
74
+ def __contains__(self, key: str) -> bool:
75
+ return key in self.additional_properties
@@ -0,0 +1,225 @@
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.template_build_status import TemplateBuildStatus
10
+
11
+ if TYPE_CHECKING:
12
+ from ..models.team_user import TeamUser
13
+
14
+
15
+ T = TypeVar("T", bound="Template")
16
+
17
+
18
+ @_attrs_define
19
+ class Template:
20
+ """
21
+ Attributes:
22
+ aliases (list[str]): Aliases of the template
23
+ build_count (int): Number of times the template was built
24
+ build_id (str): Identifier of the last successful build for given template
25
+ build_status (TemplateBuildStatus): Status of the template build
26
+ cpu_count (int): CPU cores for the sandbox
27
+ created_at (datetime.datetime): Time when the template was created
28
+ created_by (Union['TeamUser', None]):
29
+ disk_size_mb (int): Disk size for the sandbox in MiB
30
+ envd_version (str): Version of the envd running in the sandbox
31
+ last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used
32
+ memory_mb (int): Memory for the sandbox in MiB
33
+ names (list[str]): Names of the template (namespace/alias format when namespaced)
34
+ public (bool): Whether the template is public or only accessible by the team
35
+ spawn_count (int): Number of times the template was used
36
+ template_id (str): Identifier of the template
37
+ updated_at (datetime.datetime): Time when the template was last updated
38
+ """
39
+
40
+ aliases: list[str]
41
+ build_count: int
42
+ build_id: str
43
+ build_status: TemplateBuildStatus
44
+ cpu_count: int
45
+ created_at: datetime.datetime
46
+ created_by: Union["TeamUser", None]
47
+ disk_size_mb: int
48
+ envd_version: str
49
+ last_spawned_at: Union[None, datetime.datetime]
50
+ memory_mb: int
51
+ names: list[str]
52
+ public: bool
53
+ spawn_count: int
54
+ template_id: str
55
+ updated_at: datetime.datetime
56
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
57
+
58
+ def to_dict(self) -> dict[str, Any]:
59
+ from ..models.team_user import TeamUser
60
+
61
+ aliases = self.aliases
62
+
63
+ build_count = self.build_count
64
+
65
+ build_id = self.build_id
66
+
67
+ build_status = self.build_status.value
68
+
69
+ cpu_count = self.cpu_count
70
+
71
+ created_at = self.created_at.isoformat()
72
+
73
+ created_by: Union[None, dict[str, Any]]
74
+ if isinstance(self.created_by, TeamUser):
75
+ created_by = self.created_by.to_dict()
76
+ else:
77
+ created_by = self.created_by
78
+
79
+ disk_size_mb = self.disk_size_mb
80
+
81
+ envd_version = self.envd_version
82
+
83
+ last_spawned_at: Union[None, str]
84
+ if isinstance(self.last_spawned_at, datetime.datetime):
85
+ last_spawned_at = self.last_spawned_at.isoformat()
86
+ else:
87
+ last_spawned_at = self.last_spawned_at
88
+
89
+ memory_mb = self.memory_mb
90
+
91
+ names = self.names
92
+
93
+ public = self.public
94
+
95
+ spawn_count = self.spawn_count
96
+
97
+ template_id = self.template_id
98
+
99
+ updated_at = self.updated_at.isoformat()
100
+
101
+ field_dict: dict[str, Any] = {}
102
+ field_dict.update(self.additional_properties)
103
+ field_dict.update(
104
+ {
105
+ "aliases": aliases,
106
+ "buildCount": build_count,
107
+ "buildID": build_id,
108
+ "buildStatus": build_status,
109
+ "cpuCount": cpu_count,
110
+ "createdAt": created_at,
111
+ "createdBy": created_by,
112
+ "diskSizeMB": disk_size_mb,
113
+ "envdVersion": envd_version,
114
+ "lastSpawnedAt": last_spawned_at,
115
+ "memoryMB": memory_mb,
116
+ "names": names,
117
+ "public": public,
118
+ "spawnCount": spawn_count,
119
+ "templateID": template_id,
120
+ "updatedAt": updated_at,
121
+ }
122
+ )
123
+
124
+ return field_dict
125
+
126
+ @classmethod
127
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
128
+ from ..models.team_user import TeamUser
129
+
130
+ d = dict(src_dict)
131
+ aliases = cast(list[str], d.pop("aliases"))
132
+
133
+ build_count = d.pop("buildCount")
134
+
135
+ build_id = d.pop("buildID")
136
+
137
+ build_status = TemplateBuildStatus(d.pop("buildStatus"))
138
+
139
+ cpu_count = d.pop("cpuCount")
140
+
141
+ created_at = isoparse(d.pop("createdAt"))
142
+
143
+ def _parse_created_by(data: object) -> Union["TeamUser", None]:
144
+ if data is None:
145
+ return data
146
+ try:
147
+ if not isinstance(data, dict):
148
+ raise TypeError()
149
+ created_by_type_1 = TeamUser.from_dict(data)
150
+
151
+ return created_by_type_1
152
+ except: # noqa: E722
153
+ pass
154
+ return cast(Union["TeamUser", None], data)
155
+
156
+ created_by = _parse_created_by(d.pop("createdBy"))
157
+
158
+ disk_size_mb = d.pop("diskSizeMB")
159
+
160
+ envd_version = d.pop("envdVersion")
161
+
162
+ def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]:
163
+ if data is None:
164
+ return data
165
+ try:
166
+ if not isinstance(data, str):
167
+ raise TypeError()
168
+ last_spawned_at_type_0 = isoparse(data)
169
+
170
+ return last_spawned_at_type_0
171
+ except: # noqa: E722
172
+ pass
173
+ return cast(Union[None, datetime.datetime], data)
174
+
175
+ last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt"))
176
+
177
+ memory_mb = d.pop("memoryMB")
178
+
179
+ names = cast(list[str], d.pop("names"))
180
+
181
+ public = d.pop("public")
182
+
183
+ spawn_count = d.pop("spawnCount")
184
+
185
+ template_id = d.pop("templateID")
186
+
187
+ updated_at = isoparse(d.pop("updatedAt"))
188
+
189
+ template = cls(
190
+ aliases=aliases,
191
+ build_count=build_count,
192
+ build_id=build_id,
193
+ build_status=build_status,
194
+ cpu_count=cpu_count,
195
+ created_at=created_at,
196
+ created_by=created_by,
197
+ disk_size_mb=disk_size_mb,
198
+ envd_version=envd_version,
199
+ last_spawned_at=last_spawned_at,
200
+ memory_mb=memory_mb,
201
+ names=names,
202
+ public=public,
203
+ spawn_count=spawn_count,
204
+ template_id=template_id,
205
+ updated_at=updated_at,
206
+ )
207
+
208
+ template.additional_properties = d
209
+ return template
210
+
211
+ @property
212
+ def additional_keys(self) -> list[str]:
213
+ return list(self.additional_properties.keys())
214
+
215
+ def __getitem__(self, key: str) -> Any:
216
+ return self.additional_properties[key]
217
+
218
+ def __setitem__(self, key: str, value: Any) -> None:
219
+ self.additional_properties[key] = value
220
+
221
+ def __delitem__(self, key: str) -> None:
222
+ del self.additional_properties[key]
223
+
224
+ def __contains__(self, key: str) -> bool:
225
+ return key in self.additional_properties
@@ -0,0 +1,67 @@
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="TemplateAliasResponse")
8
+
9
+
10
+ @_attrs_define
11
+ class TemplateAliasResponse:
12
+ """
13
+ Attributes:
14
+ public (bool): Whether the template is public or only accessible by the team
15
+ template_id (str): Identifier of the template
16
+ """
17
+
18
+ public: bool
19
+ template_id: str
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ public = self.public
24
+
25
+ template_id = self.template_id
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "public": public,
32
+ "templateID": template_id,
33
+ }
34
+ )
35
+
36
+ return field_dict
37
+
38
+ @classmethod
39
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
40
+ d = dict(src_dict)
41
+ public = d.pop("public")
42
+
43
+ template_id = d.pop("templateID")
44
+
45
+ template_alias_response = cls(
46
+ public=public,
47
+ template_id=template_id,
48
+ )
49
+
50
+ template_alias_response.additional_properties = d
51
+ return template_alias_response
52
+
53
+ @property
54
+ def additional_keys(self) -> list[str]:
55
+ return list(self.additional_properties.keys())
56
+
57
+ def __getitem__(self, key: str) -> Any:
58
+ return self.additional_properties[key]
59
+
60
+ def __setitem__(self, key: str, value: Any) -> None:
61
+ self.additional_properties[key] = value
62
+
63
+ def __delitem__(self, key: str) -> None:
64
+ del self.additional_properties[key]
65
+
66
+ def __contains__(self, key: str) -> bool:
67
+ return key in self.additional_properties