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,115 @@
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="TemplateBuildRequest")
10
+
11
+
12
+ @_attrs_define
13
+ class TemplateBuildRequest:
14
+ """
15
+ Attributes:
16
+ dockerfile (str): Dockerfile for the template
17
+ alias (Union[Unset, str]): Alias of the template
18
+ cpu_count (Union[Unset, int]): CPU cores for the sandbox
19
+ memory_mb (Union[Unset, int]): Memory for the sandbox in MiB
20
+ ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build
21
+ start_cmd (Union[Unset, str]): Start command to execute in the template after the build
22
+ team_id (Union[Unset, str]): Identifier of the team
23
+ """
24
+
25
+ dockerfile: str
26
+ alias: Union[Unset, str] = UNSET
27
+ cpu_count: Union[Unset, int] = UNSET
28
+ memory_mb: Union[Unset, int] = UNSET
29
+ ready_cmd: Union[Unset, str] = UNSET
30
+ start_cmd: Union[Unset, str] = UNSET
31
+ team_id: Union[Unset, str] = UNSET
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ dockerfile = self.dockerfile
36
+
37
+ alias = self.alias
38
+
39
+ cpu_count = self.cpu_count
40
+
41
+ memory_mb = self.memory_mb
42
+
43
+ ready_cmd = self.ready_cmd
44
+
45
+ start_cmd = self.start_cmd
46
+
47
+ team_id = self.team_id
48
+
49
+ field_dict: dict[str, Any] = {}
50
+ field_dict.update(self.additional_properties)
51
+ field_dict.update(
52
+ {
53
+ "dockerfile": dockerfile,
54
+ }
55
+ )
56
+ if alias is not UNSET:
57
+ field_dict["alias"] = alias
58
+ if cpu_count is not UNSET:
59
+ field_dict["cpuCount"] = cpu_count
60
+ if memory_mb is not UNSET:
61
+ field_dict["memoryMB"] = memory_mb
62
+ if ready_cmd is not UNSET:
63
+ field_dict["readyCmd"] = ready_cmd
64
+ if start_cmd is not UNSET:
65
+ field_dict["startCmd"] = start_cmd
66
+ if team_id is not UNSET:
67
+ field_dict["teamID"] = team_id
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ d = dict(src_dict)
74
+ dockerfile = d.pop("dockerfile")
75
+
76
+ alias = d.pop("alias", UNSET)
77
+
78
+ cpu_count = d.pop("cpuCount", UNSET)
79
+
80
+ memory_mb = d.pop("memoryMB", UNSET)
81
+
82
+ ready_cmd = d.pop("readyCmd", UNSET)
83
+
84
+ start_cmd = d.pop("startCmd", UNSET)
85
+
86
+ team_id = d.pop("teamID", UNSET)
87
+
88
+ template_build_request = cls(
89
+ dockerfile=dockerfile,
90
+ alias=alias,
91
+ cpu_count=cpu_count,
92
+ memory_mb=memory_mb,
93
+ ready_cmd=ready_cmd,
94
+ start_cmd=start_cmd,
95
+ team_id=team_id,
96
+ )
97
+
98
+ template_build_request.additional_properties = d
99
+ return template_build_request
100
+
101
+ @property
102
+ def additional_keys(self) -> list[str]:
103
+ return list(self.additional_properties.keys())
104
+
105
+ def __getitem__(self, key: str) -> Any:
106
+ return self.additional_properties[key]
107
+
108
+ def __setitem__(self, key: str, value: Any) -> None:
109
+ self.additional_properties[key] = value
110
+
111
+ def __delitem__(self, key: str) -> None:
112
+ del self.additional_properties[key]
113
+
114
+ def __contains__(self, key: str) -> bool:
115
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
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="TemplateBuildRequestV2")
10
+
11
+
12
+ @_attrs_define
13
+ class TemplateBuildRequestV2:
14
+ """
15
+ Attributes:
16
+ alias (str): Alias of the template
17
+ cpu_count (Union[Unset, int]): CPU cores for the sandbox
18
+ memory_mb (Union[Unset, int]): Memory for the sandbox in MiB
19
+ team_id (Union[Unset, str]): Identifier of the team
20
+ """
21
+
22
+ alias: str
23
+ cpu_count: Union[Unset, int] = UNSET
24
+ memory_mb: Union[Unset, int] = UNSET
25
+ team_id: Union[Unset, str] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ alias = self.alias
30
+
31
+ cpu_count = self.cpu_count
32
+
33
+ memory_mb = self.memory_mb
34
+
35
+ team_id = self.team_id
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "alias": alias,
42
+ }
43
+ )
44
+ if cpu_count is not UNSET:
45
+ field_dict["cpuCount"] = cpu_count
46
+ if memory_mb is not UNSET:
47
+ field_dict["memoryMB"] = memory_mb
48
+ if team_id is not UNSET:
49
+ field_dict["teamID"] = team_id
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ alias = d.pop("alias")
57
+
58
+ cpu_count = d.pop("cpuCount", UNSET)
59
+
60
+ memory_mb = d.pop("memoryMB", UNSET)
61
+
62
+ team_id = d.pop("teamID", UNSET)
63
+
64
+ template_build_request_v2 = cls(
65
+ alias=alias,
66
+ cpu_count=cpu_count,
67
+ memory_mb=memory_mb,
68
+ team_id=team_id,
69
+ )
70
+
71
+ template_build_request_v2.additional_properties = d
72
+ return template_build_request_v2
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
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="TemplateBuildRequestV3")
10
+
11
+
12
+ @_attrs_define
13
+ class TemplateBuildRequestV3:
14
+ """
15
+ Attributes:
16
+ alias (str): Alias of the template
17
+ cpu_count (Union[Unset, int]): CPU cores for the sandbox
18
+ memory_mb (Union[Unset, int]): Memory for the sandbox in MiB
19
+ team_id (Union[Unset, str]): Identifier of the team
20
+ """
21
+
22
+ alias: str
23
+ cpu_count: Union[Unset, int] = UNSET
24
+ memory_mb: Union[Unset, int] = UNSET
25
+ team_id: Union[Unset, str] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ alias = self.alias
30
+
31
+ cpu_count = self.cpu_count
32
+
33
+ memory_mb = self.memory_mb
34
+
35
+ team_id = self.team_id
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "alias": alias,
42
+ }
43
+ )
44
+ if cpu_count is not UNSET:
45
+ field_dict["cpuCount"] = cpu_count
46
+ if memory_mb is not UNSET:
47
+ field_dict["memoryMB"] = memory_mb
48
+ if team_id is not UNSET:
49
+ field_dict["teamID"] = team_id
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ alias = d.pop("alias")
57
+
58
+ cpu_count = d.pop("cpuCount", UNSET)
59
+
60
+ memory_mb = d.pop("memoryMB", UNSET)
61
+
62
+ team_id = d.pop("teamID", UNSET)
63
+
64
+ template_build_request_v3 = cls(
65
+ alias=alias,
66
+ cpu_count=cpu_count,
67
+ memory_mb=memory_mb,
68
+ team_id=team_id,
69
+ )
70
+
71
+ template_build_request_v3.additional_properties = d
72
+ return template_build_request_v3
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,184 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
10
+ from ..models.aws_registry import AWSRegistry
11
+ from ..models.gcp_registry import GCPRegistry
12
+ from ..models.general_registry import GeneralRegistry
13
+ from ..models.template_step import TemplateStep
14
+
15
+
16
+ T = TypeVar("T", bound="TemplateBuildStartV2")
17
+
18
+
19
+ @_attrs_define
20
+ class TemplateBuildStartV2:
21
+ """
22
+ Attributes:
23
+ force (Union[Unset, bool]): Whether the whole build should be forced to run regardless of the cache Default:
24
+ False.
25
+ from_image (Union[Unset, str]): Image to use as a base for the template build
26
+ from_image_registry (Union['AWSRegistry', 'GCPRegistry', 'GeneralRegistry', Unset]):
27
+ from_template (Union[Unset, str]): Template to use as a base for the template build
28
+ ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build
29
+ start_cmd (Union[Unset, str]): Start command to execute in the template after the build
30
+ steps (Union[Unset, list['TemplateStep']]): List of steps to execute in the template build
31
+ """
32
+
33
+ force: Union[Unset, bool] = False
34
+ from_image: Union[Unset, str] = UNSET
35
+ from_image_registry: Union[
36
+ "AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset
37
+ ] = UNSET
38
+ from_template: Union[Unset, str] = UNSET
39
+ ready_cmd: Union[Unset, str] = UNSET
40
+ start_cmd: Union[Unset, str] = UNSET
41
+ steps: Union[Unset, list["TemplateStep"]] = UNSET
42
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
43
+
44
+ def to_dict(self) -> dict[str, Any]:
45
+ from ..models.aws_registry import AWSRegistry
46
+ from ..models.gcp_registry import GCPRegistry
47
+
48
+ force = self.force
49
+
50
+ from_image = self.from_image
51
+
52
+ from_image_registry: Union[Unset, dict[str, Any]]
53
+ if isinstance(self.from_image_registry, Unset):
54
+ from_image_registry = UNSET
55
+ elif isinstance(self.from_image_registry, AWSRegistry):
56
+ from_image_registry = self.from_image_registry.to_dict()
57
+ elif isinstance(self.from_image_registry, GCPRegistry):
58
+ from_image_registry = self.from_image_registry.to_dict()
59
+ else:
60
+ from_image_registry = self.from_image_registry.to_dict()
61
+
62
+ from_template = self.from_template
63
+
64
+ ready_cmd = self.ready_cmd
65
+
66
+ start_cmd = self.start_cmd
67
+
68
+ steps: Union[Unset, list[dict[str, Any]]] = UNSET
69
+ if not isinstance(self.steps, Unset):
70
+ steps = []
71
+ for steps_item_data in self.steps:
72
+ steps_item = steps_item_data.to_dict()
73
+ steps.append(steps_item)
74
+
75
+ field_dict: dict[str, Any] = {}
76
+ field_dict.update(self.additional_properties)
77
+ field_dict.update({})
78
+ if force is not UNSET:
79
+ field_dict["force"] = force
80
+ if from_image is not UNSET:
81
+ field_dict["fromImage"] = from_image
82
+ if from_image_registry is not UNSET:
83
+ field_dict["fromImageRegistry"] = from_image_registry
84
+ if from_template is not UNSET:
85
+ field_dict["fromTemplate"] = from_template
86
+ if ready_cmd is not UNSET:
87
+ field_dict["readyCmd"] = ready_cmd
88
+ if start_cmd is not UNSET:
89
+ field_dict["startCmd"] = start_cmd
90
+ if steps is not UNSET:
91
+ field_dict["steps"] = steps
92
+
93
+ return field_dict
94
+
95
+ @classmethod
96
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
97
+ from ..models.aws_registry import AWSRegistry
98
+ from ..models.gcp_registry import GCPRegistry
99
+ from ..models.general_registry import GeneralRegistry
100
+ from ..models.template_step import TemplateStep
101
+
102
+ d = dict(src_dict)
103
+ force = d.pop("force", UNSET)
104
+
105
+ from_image = d.pop("fromImage", UNSET)
106
+
107
+ def _parse_from_image_registry(
108
+ data: object,
109
+ ) -> Union["AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset]:
110
+ if isinstance(data, Unset):
111
+ return data
112
+ try:
113
+ if not isinstance(data, dict):
114
+ raise TypeError()
115
+ componentsschemas_from_image_registry_type_0 = AWSRegistry.from_dict(
116
+ data
117
+ )
118
+
119
+ return componentsschemas_from_image_registry_type_0
120
+ except: # noqa: E722
121
+ pass
122
+ try:
123
+ if not isinstance(data, dict):
124
+ raise TypeError()
125
+ componentsschemas_from_image_registry_type_1 = GCPRegistry.from_dict(
126
+ data
127
+ )
128
+
129
+ return componentsschemas_from_image_registry_type_1
130
+ except: # noqa: E722
131
+ pass
132
+ if not isinstance(data, dict):
133
+ raise TypeError()
134
+ componentsschemas_from_image_registry_type_2 = GeneralRegistry.from_dict(
135
+ data
136
+ )
137
+
138
+ return componentsschemas_from_image_registry_type_2
139
+
140
+ from_image_registry = _parse_from_image_registry(
141
+ d.pop("fromImageRegistry", UNSET)
142
+ )
143
+
144
+ from_template = d.pop("fromTemplate", UNSET)
145
+
146
+ ready_cmd = d.pop("readyCmd", UNSET)
147
+
148
+ start_cmd = d.pop("startCmd", UNSET)
149
+
150
+ steps = []
151
+ _steps = d.pop("steps", UNSET)
152
+ for steps_item_data in _steps or []:
153
+ steps_item = TemplateStep.from_dict(steps_item_data)
154
+
155
+ steps.append(steps_item)
156
+
157
+ template_build_start_v2 = cls(
158
+ force=force,
159
+ from_image=from_image,
160
+ from_image_registry=from_image_registry,
161
+ from_template=from_template,
162
+ ready_cmd=ready_cmd,
163
+ start_cmd=start_cmd,
164
+ steps=steps,
165
+ )
166
+
167
+ template_build_start_v2.additional_properties = d
168
+ return template_build_start_v2
169
+
170
+ @property
171
+ def additional_keys(self) -> list[str]:
172
+ return list(self.additional_properties.keys())
173
+
174
+ def __getitem__(self, key: str) -> Any:
175
+ return self.additional_properties[key]
176
+
177
+ def __setitem__(self, key: str, value: Any) -> None:
178
+ self.additional_properties[key] = value
179
+
180
+ def __delitem__(self, key: str) -> None:
181
+ del self.additional_properties[key]
182
+
183
+ def __contains__(self, key: str) -> bool:
184
+ return key in self.additional_properties
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TemplateBuildStatus(str, Enum):
5
+ BUILDING = "building"
6
+ ERROR = "error"
7
+ READY = "ready"
8
+ WAITING = "waiting"
9
+
10
+ def __str__(self) -> str:
11
+ return str(self.value)
@@ -0,0 +1,207 @@
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
+ if TYPE_CHECKING:
10
+ from ..models.team_user import TeamUser
11
+
12
+
13
+ T = TypeVar("T", bound="TemplateLegacy")
14
+
15
+
16
+ @_attrs_define
17
+ class TemplateLegacy:
18
+ """
19
+ Attributes:
20
+ aliases (list[str]): Aliases of the template
21
+ build_count (int): Number of times the template was built
22
+ build_id (str): Identifier of the last successful build for given template
23
+ cpu_count (int): CPU cores for the sandbox
24
+ created_at (datetime.datetime): Time when the template was created
25
+ created_by (Union['TeamUser', None]):
26
+ disk_size_mb (int): Disk size for the sandbox in MiB
27
+ envd_version (str): Version of the envd running in the sandbox
28
+ last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used
29
+ memory_mb (int): Memory for the sandbox in MiB
30
+ public (bool): Whether the template is public or only accessible by the team
31
+ spawn_count (int): Number of times the template was used
32
+ template_id (str): Identifier of the template
33
+ updated_at (datetime.datetime): Time when the template was last updated
34
+ """
35
+
36
+ aliases: list[str]
37
+ build_count: int
38
+ build_id: str
39
+ cpu_count: int
40
+ created_at: datetime.datetime
41
+ created_by: Union["TeamUser", None]
42
+ disk_size_mb: int
43
+ envd_version: str
44
+ last_spawned_at: Union[None, datetime.datetime]
45
+ memory_mb: int
46
+ public: bool
47
+ spawn_count: int
48
+ template_id: str
49
+ updated_at: datetime.datetime
50
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
51
+
52
+ def to_dict(self) -> dict[str, Any]:
53
+ from ..models.team_user import TeamUser
54
+
55
+ aliases = self.aliases
56
+
57
+ build_count = self.build_count
58
+
59
+ build_id = self.build_id
60
+
61
+ cpu_count = self.cpu_count
62
+
63
+ created_at = self.created_at.isoformat()
64
+
65
+ created_by: Union[None, dict[str, Any]]
66
+ if isinstance(self.created_by, TeamUser):
67
+ created_by = self.created_by.to_dict()
68
+ else:
69
+ created_by = self.created_by
70
+
71
+ disk_size_mb = self.disk_size_mb
72
+
73
+ envd_version = self.envd_version
74
+
75
+ last_spawned_at: Union[None, str]
76
+ if isinstance(self.last_spawned_at, datetime.datetime):
77
+ last_spawned_at = self.last_spawned_at.isoformat()
78
+ else:
79
+ last_spawned_at = self.last_spawned_at
80
+
81
+ memory_mb = self.memory_mb
82
+
83
+ public = self.public
84
+
85
+ spawn_count = self.spawn_count
86
+
87
+ template_id = self.template_id
88
+
89
+ updated_at = self.updated_at.isoformat()
90
+
91
+ field_dict: dict[str, Any] = {}
92
+ field_dict.update(self.additional_properties)
93
+ field_dict.update(
94
+ {
95
+ "aliases": aliases,
96
+ "buildCount": build_count,
97
+ "buildID": build_id,
98
+ "cpuCount": cpu_count,
99
+ "createdAt": created_at,
100
+ "createdBy": created_by,
101
+ "diskSizeMB": disk_size_mb,
102
+ "envdVersion": envd_version,
103
+ "lastSpawnedAt": last_spawned_at,
104
+ "memoryMB": memory_mb,
105
+ "public": public,
106
+ "spawnCount": spawn_count,
107
+ "templateID": template_id,
108
+ "updatedAt": updated_at,
109
+ }
110
+ )
111
+
112
+ return field_dict
113
+
114
+ @classmethod
115
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
116
+ from ..models.team_user import TeamUser
117
+
118
+ d = dict(src_dict)
119
+ aliases = cast(list[str], d.pop("aliases"))
120
+
121
+ build_count = d.pop("buildCount")
122
+
123
+ build_id = d.pop("buildID")
124
+
125
+ cpu_count = d.pop("cpuCount")
126
+
127
+ created_at = isoparse(d.pop("createdAt"))
128
+
129
+ def _parse_created_by(data: object) -> Union["TeamUser", None]:
130
+ if data is None:
131
+ return data
132
+ try:
133
+ if not isinstance(data, dict):
134
+ raise TypeError()
135
+ created_by_type_1 = TeamUser.from_dict(data)
136
+
137
+ return created_by_type_1
138
+ except: # noqa: E722
139
+ pass
140
+ return cast(Union["TeamUser", None], data)
141
+
142
+ created_by = _parse_created_by(d.pop("createdBy"))
143
+
144
+ disk_size_mb = d.pop("diskSizeMB")
145
+
146
+ envd_version = d.pop("envdVersion")
147
+
148
+ def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]:
149
+ if data is None:
150
+ return data
151
+ try:
152
+ if not isinstance(data, str):
153
+ raise TypeError()
154
+ last_spawned_at_type_0 = isoparse(data)
155
+
156
+ return last_spawned_at_type_0
157
+ except: # noqa: E722
158
+ pass
159
+ return cast(Union[None, datetime.datetime], data)
160
+
161
+ last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt"))
162
+
163
+ memory_mb = d.pop("memoryMB")
164
+
165
+ public = d.pop("public")
166
+
167
+ spawn_count = d.pop("spawnCount")
168
+
169
+ template_id = d.pop("templateID")
170
+
171
+ updated_at = isoparse(d.pop("updatedAt"))
172
+
173
+ template_legacy = cls(
174
+ aliases=aliases,
175
+ build_count=build_count,
176
+ build_id=build_id,
177
+ cpu_count=cpu_count,
178
+ created_at=created_at,
179
+ created_by=created_by,
180
+ disk_size_mb=disk_size_mb,
181
+ envd_version=envd_version,
182
+ last_spawned_at=last_spawned_at,
183
+ memory_mb=memory_mb,
184
+ public=public,
185
+ spawn_count=spawn_count,
186
+ template_id=template_id,
187
+ updated_at=updated_at,
188
+ )
189
+
190
+ template_legacy.additional_properties = d
191
+ return template_legacy
192
+
193
+ @property
194
+ def additional_keys(self) -> list[str]:
195
+ return list(self.additional_properties.keys())
196
+
197
+ def __getitem__(self, key: str) -> Any:
198
+ return self.additional_properties[key]
199
+
200
+ def __setitem__(self, key: str, value: Any) -> None:
201
+ self.additional_properties[key] = value
202
+
203
+ def __delitem__(self, key: str) -> None:
204
+ del self.additional_properties[key]
205
+
206
+ def __contains__(self, key: str) -> bool:
207
+ return key in self.additional_properties