moru 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. moru/__init__.py +174 -0
  2. moru/api/__init__.py +164 -0
  3. moru/api/client/__init__.py +8 -0
  4. moru/api/client/api/__init__.py +1 -0
  5. moru/api/client/api/sandboxes/__init__.py +1 -0
  6. moru/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. moru/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. moru/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
  12. moru/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
  13. moru/api/client/api/sandboxes/post_sandboxes.py +172 -0
  14. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
  15. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
  16. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
  17. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
  18. moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
  19. moru/api/client/api/templates/__init__.py +1 -0
  20. moru/api/client/api/templates/delete_templates_template_id.py +157 -0
  21. moru/api/client/api/templates/get_templates.py +172 -0
  22. moru/api/client/api/templates/get_templates_template_id.py +195 -0
  23. moru/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +217 -0
  24. moru/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
  25. moru/api/client/api/templates/patch_templates_template_id.py +183 -0
  26. moru/api/client/api/templates/post_templates.py +172 -0
  27. moru/api/client/api/templates/post_templates_template_id.py +181 -0
  28. moru/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
  29. moru/api/client/api/templates/post_v2_templates.py +172 -0
  30. moru/api/client/api/templates/post_v3_templates.py +172 -0
  31. moru/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
  32. moru/api/client/client.py +286 -0
  33. moru/api/client/errors.py +16 -0
  34. moru/api/client/models/__init__.py +123 -0
  35. moru/api/client/models/aws_registry.py +85 -0
  36. moru/api/client/models/aws_registry_type.py +8 -0
  37. moru/api/client/models/build_log_entry.py +89 -0
  38. moru/api/client/models/build_status_reason.py +95 -0
  39. moru/api/client/models/connect_sandbox.py +59 -0
  40. moru/api/client/models/created_access_token.py +100 -0
  41. moru/api/client/models/created_team_api_key.py +166 -0
  42. moru/api/client/models/disk_metrics.py +91 -0
  43. moru/api/client/models/error.py +67 -0
  44. moru/api/client/models/gcp_registry.py +69 -0
  45. moru/api/client/models/gcp_registry_type.py +8 -0
  46. moru/api/client/models/general_registry.py +77 -0
  47. moru/api/client/models/general_registry_type.py +8 -0
  48. moru/api/client/models/identifier_masking_details.py +83 -0
  49. moru/api/client/models/listed_sandbox.py +154 -0
  50. moru/api/client/models/log_level.py +11 -0
  51. moru/api/client/models/max_team_metric.py +78 -0
  52. moru/api/client/models/mcp_type_0.py +44 -0
  53. moru/api/client/models/new_access_token.py +59 -0
  54. moru/api/client/models/new_sandbox.py +172 -0
  55. moru/api/client/models/new_team_api_key.py +59 -0
  56. moru/api/client/models/node.py +155 -0
  57. moru/api/client/models/node_detail.py +165 -0
  58. moru/api/client/models/node_metrics.py +122 -0
  59. moru/api/client/models/node_status.py +11 -0
  60. moru/api/client/models/node_status_change.py +79 -0
  61. moru/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  62. moru/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  63. moru/api/client/models/resumed_sandbox.py +68 -0
  64. moru/api/client/models/sandbox.py +145 -0
  65. moru/api/client/models/sandbox_detail.py +183 -0
  66. moru/api/client/models/sandbox_log.py +70 -0
  67. moru/api/client/models/sandbox_log_entry.py +93 -0
  68. moru/api/client/models/sandbox_log_entry_fields.py +44 -0
  69. moru/api/client/models/sandbox_logs.py +91 -0
  70. moru/api/client/models/sandbox_metric.py +118 -0
  71. moru/api/client/models/sandbox_network_config.py +92 -0
  72. moru/api/client/models/sandbox_state.py +9 -0
  73. moru/api/client/models/sandboxes_with_metrics.py +59 -0
  74. moru/api/client/models/team.py +83 -0
  75. moru/api/client/models/team_api_key.py +158 -0
  76. moru/api/client/models/team_metric.py +86 -0
  77. moru/api/client/models/team_user.py +68 -0
  78. moru/api/client/models/template.py +217 -0
  79. moru/api/client/models/template_build.py +139 -0
  80. moru/api/client/models/template_build_file_upload.py +70 -0
  81. moru/api/client/models/template_build_info.py +126 -0
  82. moru/api/client/models/template_build_request.py +115 -0
  83. moru/api/client/models/template_build_request_v2.py +88 -0
  84. moru/api/client/models/template_build_request_v3.py +88 -0
  85. moru/api/client/models/template_build_start_v2.py +184 -0
  86. moru/api/client/models/template_build_status.py +11 -0
  87. moru/api/client/models/template_legacy.py +207 -0
  88. moru/api/client/models/template_request_response_v3.py +83 -0
  89. moru/api/client/models/template_step.py +91 -0
  90. moru/api/client/models/template_update_request.py +59 -0
  91. moru/api/client/models/template_with_builds.py +148 -0
  92. moru/api/client/models/update_team_api_key.py +59 -0
  93. moru/api/client/py.typed +1 -0
  94. moru/api/client/types.py +54 -0
  95. moru/api/client_async/__init__.py +50 -0
  96. moru/api/client_sync/__init__.py +52 -0
  97. moru/api/metadata.py +14 -0
  98. moru/connection_config.py +217 -0
  99. moru/envd/api.py +59 -0
  100. moru/envd/filesystem/filesystem_connect.py +193 -0
  101. moru/envd/filesystem/filesystem_pb2.py +76 -0
  102. moru/envd/filesystem/filesystem_pb2.pyi +233 -0
  103. moru/envd/process/process_connect.py +155 -0
  104. moru/envd/process/process_pb2.py +92 -0
  105. moru/envd/process/process_pb2.pyi +304 -0
  106. moru/envd/rpc.py +61 -0
  107. moru/envd/versions.py +6 -0
  108. moru/exceptions.py +95 -0
  109. moru/sandbox/commands/command_handle.py +69 -0
  110. moru/sandbox/commands/main.py +39 -0
  111. moru/sandbox/filesystem/filesystem.py +94 -0
  112. moru/sandbox/filesystem/watch_handle.py +60 -0
  113. moru/sandbox/main.py +210 -0
  114. moru/sandbox/mcp.py +1120 -0
  115. moru/sandbox/network.py +8 -0
  116. moru/sandbox/sandbox_api.py +210 -0
  117. moru/sandbox/signature.py +45 -0
  118. moru/sandbox/utils.py +34 -0
  119. moru/sandbox_async/commands/command.py +336 -0
  120. moru/sandbox_async/commands/command_handle.py +196 -0
  121. moru/sandbox_async/commands/pty.py +240 -0
  122. moru/sandbox_async/filesystem/filesystem.py +531 -0
  123. moru/sandbox_async/filesystem/watch_handle.py +62 -0
  124. moru/sandbox_async/main.py +734 -0
  125. moru/sandbox_async/paginator.py +69 -0
  126. moru/sandbox_async/sandbox_api.py +325 -0
  127. moru/sandbox_async/utils.py +7 -0
  128. moru/sandbox_sync/commands/command.py +328 -0
  129. moru/sandbox_sync/commands/command_handle.py +150 -0
  130. moru/sandbox_sync/commands/pty.py +230 -0
  131. moru/sandbox_sync/filesystem/filesystem.py +518 -0
  132. moru/sandbox_sync/filesystem/watch_handle.py +69 -0
  133. moru/sandbox_sync/main.py +726 -0
  134. moru/sandbox_sync/paginator.py +69 -0
  135. moru/sandbox_sync/sandbox_api.py +308 -0
  136. moru/template/consts.py +30 -0
  137. moru/template/dockerfile_parser.py +275 -0
  138. moru/template/logger.py +232 -0
  139. moru/template/main.py +1360 -0
  140. moru/template/readycmd.py +138 -0
  141. moru/template/types.py +105 -0
  142. moru/template/utils.py +320 -0
  143. moru/template_async/build_api.py +202 -0
  144. moru/template_async/main.py +366 -0
  145. moru/template_sync/build_api.py +199 -0
  146. moru/template_sync/main.py +371 -0
  147. moru-0.1.0.dist-info/METADATA +63 -0
  148. moru-0.1.0.dist-info/RECORD +152 -0
  149. moru-0.1.0.dist-info/WHEEL +4 -0
  150. moru-0.1.0.dist-info/licenses/LICENSE +9 -0
  151. moru_connect/__init__.py +1 -0
  152. moru_connect/client.py +493 -0
@@ -0,0 +1,59 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="PostSandboxesSandboxIDTimeoutBody")
8
+
9
+
10
+ @_attrs_define
11
+ class PostSandboxesSandboxIDTimeoutBody:
12
+ """
13
+ Attributes:
14
+ timeout (int): Timeout in seconds from the current time after which the sandbox should expire
15
+ """
16
+
17
+ timeout: int
18
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
+
20
+ def to_dict(self) -> dict[str, Any]:
21
+ timeout = self.timeout
22
+
23
+ field_dict: dict[str, Any] = {}
24
+ field_dict.update(self.additional_properties)
25
+ field_dict.update(
26
+ {
27
+ "timeout": timeout,
28
+ }
29
+ )
30
+
31
+ return field_dict
32
+
33
+ @classmethod
34
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
+ d = dict(src_dict)
36
+ timeout = d.pop("timeout")
37
+
38
+ post_sandboxes_sandbox_id_timeout_body = cls(
39
+ timeout=timeout,
40
+ )
41
+
42
+ post_sandboxes_sandbox_id_timeout_body.additional_properties = d
43
+ return post_sandboxes_sandbox_id_timeout_body
44
+
45
+ @property
46
+ def additional_keys(self) -> list[str]:
47
+ return list(self.additional_properties.keys())
48
+
49
+ def __getitem__(self, key: str) -> Any:
50
+ return self.additional_properties[key]
51
+
52
+ def __setitem__(self, key: str, value: Any) -> None:
53
+ self.additional_properties[key] = value
54
+
55
+ def __delitem__(self, key: str) -> None:
56
+ del self.additional_properties[key]
57
+
58
+ def __contains__(self, key: str) -> bool:
59
+ return key in self.additional_properties
@@ -0,0 +1,68 @@
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="ResumedSandbox")
10
+
11
+
12
+ @_attrs_define
13
+ class ResumedSandbox:
14
+ """
15
+ Attributes:
16
+ auto_pause (Union[Unset, bool]): Automatically pauses the sandbox after the timeout
17
+ timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15.
18
+ """
19
+
20
+ auto_pause: Union[Unset, bool] = UNSET
21
+ timeout: Union[Unset, int] = 15
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ auto_pause = self.auto_pause
26
+
27
+ timeout = self.timeout
28
+
29
+ field_dict: dict[str, Any] = {}
30
+ field_dict.update(self.additional_properties)
31
+ field_dict.update({})
32
+ if auto_pause is not UNSET:
33
+ field_dict["autoPause"] = auto_pause
34
+ if timeout is not UNSET:
35
+ field_dict["timeout"] = timeout
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
41
+ d = dict(src_dict)
42
+ auto_pause = d.pop("autoPause", UNSET)
43
+
44
+ timeout = d.pop("timeout", UNSET)
45
+
46
+ resumed_sandbox = cls(
47
+ auto_pause=auto_pause,
48
+ timeout=timeout,
49
+ )
50
+
51
+ resumed_sandbox.additional_properties = d
52
+ return resumed_sandbox
53
+
54
+ @property
55
+ def additional_keys(self) -> list[str]:
56
+ return list(self.additional_properties.keys())
57
+
58
+ def __getitem__(self, key: str) -> Any:
59
+ return self.additional_properties[key]
60
+
61
+ def __setitem__(self, key: str, value: Any) -> None:
62
+ self.additional_properties[key] = value
63
+
64
+ def __delitem__(self, key: str) -> None:
65
+ del self.additional_properties[key]
66
+
67
+ def __contains__(self, key: str) -> bool:
68
+ return key in self.additional_properties
@@ -0,0 +1,145 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
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="Sandbox")
10
+
11
+
12
+ @_attrs_define
13
+ class Sandbox:
14
+ """
15
+ Attributes:
16
+ client_id (str): Identifier of the client
17
+ envd_version (str): Version of the envd running in the sandbox
18
+ sandbox_id (str): Identifier of the sandbox
19
+ template_id (str): Identifier of the template from which is the sandbox created
20
+ alias (Union[Unset, str]): Alias of the template
21
+ domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible
22
+ envd_access_token (Union[Unset, str]): Access token used for envd communication
23
+ traffic_access_token (Union[None, Unset, str]): Token required for accessing sandbox via proxy.
24
+ """
25
+
26
+ client_id: str
27
+ envd_version: str
28
+ sandbox_id: str
29
+ template_id: str
30
+ alias: Union[Unset, str] = UNSET
31
+ domain: Union[None, Unset, str] = UNSET
32
+ envd_access_token: Union[Unset, str] = UNSET
33
+ traffic_access_token: Union[None, Unset, str] = UNSET
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ client_id = self.client_id
38
+
39
+ envd_version = self.envd_version
40
+
41
+ sandbox_id = self.sandbox_id
42
+
43
+ template_id = self.template_id
44
+
45
+ alias = self.alias
46
+
47
+ domain: Union[None, Unset, str]
48
+ if isinstance(self.domain, Unset):
49
+ domain = UNSET
50
+ else:
51
+ domain = self.domain
52
+
53
+ envd_access_token = self.envd_access_token
54
+
55
+ traffic_access_token: Union[None, Unset, str]
56
+ if isinstance(self.traffic_access_token, Unset):
57
+ traffic_access_token = UNSET
58
+ else:
59
+ traffic_access_token = self.traffic_access_token
60
+
61
+ field_dict: dict[str, Any] = {}
62
+ field_dict.update(self.additional_properties)
63
+ field_dict.update(
64
+ {
65
+ "clientID": client_id,
66
+ "envdVersion": envd_version,
67
+ "sandboxID": sandbox_id,
68
+ "templateID": template_id,
69
+ }
70
+ )
71
+ if alias is not UNSET:
72
+ field_dict["alias"] = alias
73
+ if domain is not UNSET:
74
+ field_dict["domain"] = domain
75
+ if envd_access_token is not UNSET:
76
+ field_dict["envdAccessToken"] = envd_access_token
77
+ if traffic_access_token is not UNSET:
78
+ field_dict["trafficAccessToken"] = traffic_access_token
79
+
80
+ return field_dict
81
+
82
+ @classmethod
83
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
84
+ d = dict(src_dict)
85
+ client_id = d.pop("clientID")
86
+
87
+ envd_version = d.pop("envdVersion")
88
+
89
+ sandbox_id = d.pop("sandboxID")
90
+
91
+ template_id = d.pop("templateID")
92
+
93
+ alias = d.pop("alias", UNSET)
94
+
95
+ def _parse_domain(data: object) -> Union[None, Unset, str]:
96
+ if data is None:
97
+ return data
98
+ if isinstance(data, Unset):
99
+ return data
100
+ return cast(Union[None, Unset, str], data)
101
+
102
+ domain = _parse_domain(d.pop("domain", UNSET))
103
+
104
+ envd_access_token = d.pop("envdAccessToken", UNSET)
105
+
106
+ def _parse_traffic_access_token(data: object) -> Union[None, Unset, str]:
107
+ if data is None:
108
+ return data
109
+ if isinstance(data, Unset):
110
+ return data
111
+ return cast(Union[None, Unset, str], data)
112
+
113
+ traffic_access_token = _parse_traffic_access_token(
114
+ d.pop("trafficAccessToken", UNSET)
115
+ )
116
+
117
+ sandbox = cls(
118
+ client_id=client_id,
119
+ envd_version=envd_version,
120
+ sandbox_id=sandbox_id,
121
+ template_id=template_id,
122
+ alias=alias,
123
+ domain=domain,
124
+ envd_access_token=envd_access_token,
125
+ traffic_access_token=traffic_access_token,
126
+ )
127
+
128
+ sandbox.additional_properties = d
129
+ return sandbox
130
+
131
+ @property
132
+ def additional_keys(self) -> list[str]:
133
+ return list(self.additional_properties.keys())
134
+
135
+ def __getitem__(self, key: str) -> Any:
136
+ return self.additional_properties[key]
137
+
138
+ def __setitem__(self, key: str, value: Any) -> None:
139
+ self.additional_properties[key] = value
140
+
141
+ def __delitem__(self, key: str) -> None:
142
+ del self.additional_properties[key]
143
+
144
+ def __contains__(self, key: str) -> bool:
145
+ return key in self.additional_properties
@@ -0,0 +1,183 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import 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
+ T = TypeVar("T", bound="SandboxDetail")
13
+
14
+
15
+ @_attrs_define
16
+ class SandboxDetail:
17
+ """
18
+ Attributes:
19
+ client_id (str): Identifier of the client
20
+ cpu_count (int): CPU cores for the sandbox
21
+ disk_size_mb (int): Disk size for the sandbox in MiB
22
+ end_at (datetime.datetime): Time when the sandbox will expire
23
+ envd_version (str): Version of the envd running in the sandbox
24
+ memory_mb (int): Memory for the sandbox in MiB
25
+ sandbox_id (str): Identifier of the sandbox
26
+ started_at (datetime.datetime): Time when the sandbox was started
27
+ state (SandboxState): State of the sandbox
28
+ template_id (str): Identifier of the template from which is the sandbox created
29
+ alias (Union[Unset, str]): Alias of the template
30
+ domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible
31
+ envd_access_token (Union[Unset, str]): Access token used for envd communication
32
+ metadata (Union[Unset, Any]):
33
+ """
34
+
35
+ client_id: str
36
+ cpu_count: int
37
+ disk_size_mb: int
38
+ end_at: datetime.datetime
39
+ envd_version: str
40
+ memory_mb: int
41
+ sandbox_id: str
42
+ started_at: datetime.datetime
43
+ state: SandboxState
44
+ template_id: str
45
+ alias: Union[Unset, str] = UNSET
46
+ domain: Union[None, Unset, str] = UNSET
47
+ envd_access_token: Union[Unset, str] = UNSET
48
+ metadata: Union[Unset, Any] = UNSET
49
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
50
+
51
+ def to_dict(self) -> dict[str, Any]:
52
+ client_id = self.client_id
53
+
54
+ cpu_count = self.cpu_count
55
+
56
+ disk_size_mb = self.disk_size_mb
57
+
58
+ end_at = self.end_at.isoformat()
59
+
60
+ envd_version = self.envd_version
61
+
62
+ memory_mb = self.memory_mb
63
+
64
+ sandbox_id = self.sandbox_id
65
+
66
+ started_at = self.started_at.isoformat()
67
+
68
+ state = self.state.value
69
+
70
+ template_id = self.template_id
71
+
72
+ alias = self.alias
73
+
74
+ domain: Union[None, Unset, str]
75
+ if isinstance(self.domain, Unset):
76
+ domain = UNSET
77
+ else:
78
+ domain = self.domain
79
+
80
+ envd_access_token = self.envd_access_token
81
+
82
+ metadata = self.metadata
83
+
84
+ field_dict: dict[str, Any] = {}
85
+ field_dict.update(self.additional_properties)
86
+ field_dict.update(
87
+ {
88
+ "clientID": client_id,
89
+ "cpuCount": cpu_count,
90
+ "diskSizeMB": disk_size_mb,
91
+ "endAt": end_at,
92
+ "envdVersion": envd_version,
93
+ "memoryMB": memory_mb,
94
+ "sandboxID": sandbox_id,
95
+ "startedAt": started_at,
96
+ "state": state,
97
+ "templateID": template_id,
98
+ }
99
+ )
100
+ if alias is not UNSET:
101
+ field_dict["alias"] = alias
102
+ if domain is not UNSET:
103
+ field_dict["domain"] = domain
104
+ if envd_access_token is not UNSET:
105
+ field_dict["envdAccessToken"] = envd_access_token
106
+ if metadata is not UNSET:
107
+ field_dict["metadata"] = metadata
108
+
109
+ return field_dict
110
+
111
+ @classmethod
112
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
113
+ d = dict(src_dict)
114
+ client_id = d.pop("clientID")
115
+
116
+ cpu_count = d.pop("cpuCount")
117
+
118
+ disk_size_mb = d.pop("diskSizeMB")
119
+
120
+ end_at = isoparse(d.pop("endAt"))
121
+
122
+ envd_version = d.pop("envdVersion")
123
+
124
+ memory_mb = d.pop("memoryMB")
125
+
126
+ sandbox_id = d.pop("sandboxID")
127
+
128
+ started_at = isoparse(d.pop("startedAt"))
129
+
130
+ state = SandboxState(d.pop("state"))
131
+
132
+ template_id = d.pop("templateID")
133
+
134
+ alias = d.pop("alias", UNSET)
135
+
136
+ def _parse_domain(data: object) -> Union[None, Unset, str]:
137
+ if data is None:
138
+ return data
139
+ if isinstance(data, Unset):
140
+ return data
141
+ return cast(Union[None, Unset, str], data)
142
+
143
+ domain = _parse_domain(d.pop("domain", UNSET))
144
+
145
+ envd_access_token = d.pop("envdAccessToken", UNSET)
146
+
147
+ metadata = d.pop("metadata", UNSET)
148
+
149
+ sandbox_detail = cls(
150
+ client_id=client_id,
151
+ cpu_count=cpu_count,
152
+ disk_size_mb=disk_size_mb,
153
+ end_at=end_at,
154
+ envd_version=envd_version,
155
+ memory_mb=memory_mb,
156
+ sandbox_id=sandbox_id,
157
+ started_at=started_at,
158
+ state=state,
159
+ template_id=template_id,
160
+ alias=alias,
161
+ domain=domain,
162
+ envd_access_token=envd_access_token,
163
+ metadata=metadata,
164
+ )
165
+
166
+ sandbox_detail.additional_properties = d
167
+ return sandbox_detail
168
+
169
+ @property
170
+ def additional_keys(self) -> list[str]:
171
+ return list(self.additional_properties.keys())
172
+
173
+ def __getitem__(self, key: str) -> Any:
174
+ return self.additional_properties[key]
175
+
176
+ def __setitem__(self, key: str, value: Any) -> None:
177
+ self.additional_properties[key] = value
178
+
179
+ def __delitem__(self, key: str) -> None:
180
+ del self.additional_properties[key]
181
+
182
+ def __contains__(self, key: str) -> bool:
183
+ 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