scalebox-sdk 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 (157) hide show
  1. scalebox/__init__.py +80 -0
  2. scalebox/api/__init__.py +128 -0
  3. scalebox/api/client/__init__.py +8 -0
  4. scalebox/api/client/api/__init__.py +1 -0
  5. scalebox/api/client/api/sandboxes/__init__.py +0 -0
  6. scalebox/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. scalebox/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. scalebox/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. scalebox/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. scalebox/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. scalebox/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +214 -0
  12. scalebox/api/client/api/sandboxes/get_v2_sandboxes.py +229 -0
  13. scalebox/api/client/api/sandboxes/post_sandboxes.py +174 -0
  14. scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
  15. scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +182 -0
  16. scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +190 -0
  17. scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +194 -0
  18. scalebox/api/client/client.py +288 -0
  19. scalebox/api/client/errors.py +16 -0
  20. scalebox/api/client/models/__init__.py +81 -0
  21. scalebox/api/client/models/build_log_entry.py +79 -0
  22. scalebox/api/client/models/created_access_token.py +100 -0
  23. scalebox/api/client/models/created_team_api_key.py +166 -0
  24. scalebox/api/client/models/error.py +67 -0
  25. scalebox/api/client/models/identifier_masking_details.py +83 -0
  26. scalebox/api/client/models/listed_sandbox.py +138 -0
  27. scalebox/api/client/models/log_level.py +11 -0
  28. scalebox/api/client/models/new_access_token.py +59 -0
  29. scalebox/api/client/models/new_sandbox.py +125 -0
  30. scalebox/api/client/models/new_team_api_key.py +59 -0
  31. scalebox/api/client/models/node.py +154 -0
  32. scalebox/api/client/models/node_detail.py +152 -0
  33. scalebox/api/client/models/node_status.py +11 -0
  34. scalebox/api/client/models/node_status_change.py +61 -0
  35. scalebox/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  36. scalebox/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  37. scalebox/api/client/models/resumed_sandbox.py +68 -0
  38. scalebox/api/client/models/sandbox.py +125 -0
  39. scalebox/api/client/models/sandbox_detail.py +178 -0
  40. scalebox/api/client/models/sandbox_log.py +70 -0
  41. scalebox/api/client/models/sandbox_logs.py +73 -0
  42. scalebox/api/client/models/sandbox_metric.py +110 -0
  43. scalebox/api/client/models/sandbox_state.py +9 -0
  44. scalebox/api/client/models/sandboxes_with_metrics.py +59 -0
  45. scalebox/api/client/models/team.py +83 -0
  46. scalebox/api/client/models/team_api_key.py +158 -0
  47. scalebox/api/client/models/team_user.py +68 -0
  48. scalebox/api/client/models/template.py +179 -0
  49. scalebox/api/client/models/template_build.py +117 -0
  50. scalebox/api/client/models/template_build_file_upload.py +70 -0
  51. scalebox/api/client/models/template_build_request.py +115 -0
  52. scalebox/api/client/models/template_build_request_v2.py +88 -0
  53. scalebox/api/client/models/template_build_start_v2.py +114 -0
  54. scalebox/api/client/models/template_build_status.py +11 -0
  55. scalebox/api/client/models/template_step.py +91 -0
  56. scalebox/api/client/models/template_update_request.py +59 -0
  57. scalebox/api/client/models/update_team_api_key.py +59 -0
  58. scalebox/api/client/py.typed +1 -0
  59. scalebox/api/client/types.py +46 -0
  60. scalebox/api/metadata.py +19 -0
  61. scalebox/cli.py +125 -0
  62. scalebox/client/__init__.py +0 -0
  63. scalebox/client/aclient.py +57 -0
  64. scalebox/client/api.proto +460 -0
  65. scalebox/client/buf.gen.yaml +8 -0
  66. scalebox/client/client.py +102 -0
  67. scalebox/client/requirements.txt +5 -0
  68. scalebox/code_interpreter/__init__.py +12 -0
  69. scalebox/code_interpreter/charts.py +230 -0
  70. scalebox/code_interpreter/code_interpreter_async.py +369 -0
  71. scalebox/code_interpreter/code_interpreter_sync.py +317 -0
  72. scalebox/code_interpreter/constants.py +3 -0
  73. scalebox/code_interpreter/exceptions.py +13 -0
  74. scalebox/code_interpreter/models.py +485 -0
  75. scalebox/connection_config.py +92 -0
  76. scalebox/csx_connect/__init__.py +1 -0
  77. scalebox/csx_connect/client.py +485 -0
  78. scalebox/csx_desktop/__init__.py +0 -0
  79. scalebox/csx_desktop/main.py +651 -0
  80. scalebox/exceptions.py +83 -0
  81. scalebox/generated/__init__.py +0 -0
  82. scalebox/generated/api.py +61 -0
  83. scalebox/generated/api_pb2.py +203 -0
  84. scalebox/generated/api_pb2.pyi +956 -0
  85. scalebox/generated/api_pb2_connect.py +1456 -0
  86. scalebox/generated/rpc.py +50 -0
  87. scalebox/generated/versions.py +3 -0
  88. scalebox/requirements.txt +36 -0
  89. scalebox/sandbox/__init__.py +0 -0
  90. scalebox/sandbox/commands/__init__.py +0 -0
  91. scalebox/sandbox/commands/command_handle.py +69 -0
  92. scalebox/sandbox/commands/main.py +39 -0
  93. scalebox/sandbox/filesystem/__init__.py +0 -0
  94. scalebox/sandbox/filesystem/filesystem.py +95 -0
  95. scalebox/sandbox/filesystem/watch_handle.py +60 -0
  96. scalebox/sandbox/main.py +139 -0
  97. scalebox/sandbox/sandbox_api.py +91 -0
  98. scalebox/sandbox/signature.py +40 -0
  99. scalebox/sandbox/utils.py +34 -0
  100. scalebox/sandbox_async/__init__.py +1 -0
  101. scalebox/sandbox_async/commands/command.py +307 -0
  102. scalebox/sandbox_async/commands/command_handle.py +187 -0
  103. scalebox/sandbox_async/commands/pty.py +187 -0
  104. scalebox/sandbox_async/filesystem/filesystem.py +557 -0
  105. scalebox/sandbox_async/filesystem/watch_handle.py +61 -0
  106. scalebox/sandbox_async/main.py +646 -0
  107. scalebox/sandbox_async/sandbox_api.py +365 -0
  108. scalebox/sandbox_async/utils.py +7 -0
  109. scalebox/sandbox_sync/__init__.py +2 -0
  110. scalebox/sandbox_sync/commands/__init__.py +0 -0
  111. scalebox/sandbox_sync/commands/command.py +300 -0
  112. scalebox/sandbox_sync/commands/command_handle.py +150 -0
  113. scalebox/sandbox_sync/commands/pty.py +181 -0
  114. scalebox/sandbox_sync/filesystem/__init__.py +0 -0
  115. scalebox/sandbox_sync/filesystem/filesystem.py +543 -0
  116. scalebox/sandbox_sync/filesystem/watch_handle.py +66 -0
  117. scalebox/sandbox_sync/main.py +790 -0
  118. scalebox/sandbox_sync/sandbox_api.py +356 -0
  119. scalebox/test/CODE_INTERPRETER_TESTS_READY.md +323 -0
  120. scalebox/test/README.md +329 -0
  121. scalebox/test/__init__.py +0 -0
  122. scalebox/test/aclient.py +72 -0
  123. scalebox/test/code_interpreter_centext.py +21 -0
  124. scalebox/test/code_interpreter_centext_sync.py +21 -0
  125. scalebox/test/code_interpreter_test.py +34 -0
  126. scalebox/test/code_interpreter_test_sync.py +34 -0
  127. scalebox/test/run_all_validation_tests.py +334 -0
  128. scalebox/test/run_code_interpreter_tests.sh +67 -0
  129. scalebox/test/run_tests.sh +230 -0
  130. scalebox/test/test_basic.py +78 -0
  131. scalebox/test/test_code_interpreter_async_comprehensive.py +2653 -0
  132. scalebox/test/test_code_interpreter_e2basync_comprehensive.py +2655 -0
  133. scalebox/test/test_code_interpreter_e2bsync_comprehensive.py +3416 -0
  134. scalebox/test/test_code_interpreter_sync_comprehensive.py +3412 -0
  135. scalebox/test/test_e2b_first.py +11 -0
  136. scalebox/test/test_sandbox_async_comprehensive.py +738 -0
  137. scalebox/test/test_sandbox_stress_and_edge_cases.py +778 -0
  138. scalebox/test/test_sandbox_sync_comprehensive.py +770 -0
  139. scalebox/test/test_sandbox_usage_examples.py +987 -0
  140. scalebox/test/testacreate.py +24 -0
  141. scalebox/test/testagetinfo.py +18 -0
  142. scalebox/test/testcodeinterpreter_async.py +508 -0
  143. scalebox/test/testcodeinterpreter_sync.py +239 -0
  144. scalebox/test/testcomputeuse.py +243 -0
  145. scalebox/test/testnovnc.py +12 -0
  146. scalebox/test/testsandbox_async.py +118 -0
  147. scalebox/test/testsandbox_sync.py +38 -0
  148. scalebox/utils/__init__.py +0 -0
  149. scalebox/utils/httpcoreclient.py +297 -0
  150. scalebox/utils/httpxclient.py +403 -0
  151. scalebox/version.py +16 -0
  152. scalebox_sdk-0.1.0.dist-info/METADATA +292 -0
  153. scalebox_sdk-0.1.0.dist-info/RECORD +157 -0
  154. scalebox_sdk-0.1.0.dist-info/WHEEL +5 -0
  155. scalebox_sdk-0.1.0.dist-info/entry_points.txt +2 -0
  156. scalebox_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
  157. scalebox_sdk-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,100 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Any, TypeVar
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
+ if TYPE_CHECKING:
11
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
12
+
13
+
14
+ T = TypeVar("T", bound="CreatedAccessToken")
15
+
16
+
17
+ @_attrs_define
18
+ class CreatedAccessToken:
19
+ """
20
+ Attributes:
21
+ created_at (datetime.datetime): Timestamp of access token creation
22
+ id (UUID): Identifier of the access token
23
+ mask (IdentifierMaskingDetails):
24
+ name (str): Name of the access token
25
+ token (str): The fully created access token
26
+ """
27
+
28
+ created_at: datetime.datetime
29
+ id: UUID
30
+ mask: "IdentifierMaskingDetails"
31
+ name: str
32
+ token: str
33
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34
+
35
+ def to_dict(self) -> dict[str, Any]:
36
+ created_at = self.created_at.isoformat()
37
+
38
+ id = str(self.id)
39
+
40
+ mask = self.mask.to_dict()
41
+
42
+ name = self.name
43
+
44
+ token = self.token
45
+
46
+ field_dict: dict[str, Any] = {}
47
+ field_dict.update(self.additional_properties)
48
+ field_dict.update(
49
+ {
50
+ "createdAt": created_at,
51
+ "id": id,
52
+ "mask": mask,
53
+ "name": name,
54
+ "token": token,
55
+ }
56
+ )
57
+
58
+ return field_dict
59
+
60
+ @classmethod
61
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
63
+
64
+ d = dict(src_dict)
65
+ created_at = isoparse(d.pop("createdAt"))
66
+
67
+ id = UUID(d.pop("id"))
68
+
69
+ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))
70
+
71
+ name = d.pop("name")
72
+
73
+ token = d.pop("token")
74
+
75
+ created_access_token = cls(
76
+ created_at=created_at,
77
+ id=id,
78
+ mask=mask,
79
+ name=name,
80
+ token=token,
81
+ )
82
+
83
+ created_access_token.additional_properties = d
84
+ return created_access_token
85
+
86
+ @property
87
+ def additional_keys(self) -> list[str]:
88
+ return list(self.additional_properties.keys())
89
+
90
+ def __getitem__(self, key: str) -> Any:
91
+ return self.additional_properties[key]
92
+
93
+ def __setitem__(self, key: str, value: Any) -> None:
94
+ self.additional_properties[key] = value
95
+
96
+ def __delitem__(self, key: str) -> None:
97
+ del self.additional_properties[key]
98
+
99
+ def __contains__(self, key: str) -> bool:
100
+ return key in self.additional_properties
@@ -0,0 +1,166 @@
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="CreatedTeamAPIKey")
18
+
19
+
20
+ @_attrs_define
21
+ class CreatedTeamAPIKey:
22
+ """
23
+ Attributes:
24
+ created_at (datetime.datetime): Timestamp of API key creation
25
+ id (UUID): Identifier of the API key
26
+ key (str): Raw value of the API key
27
+ mask (IdentifierMaskingDetails):
28
+ name (str): Name of the API key
29
+ created_by (Union['TeamUser', None, Unset]):
30
+ last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used
31
+ """
32
+
33
+ created_at: datetime.datetime
34
+ id: UUID
35
+ key: str
36
+ mask: "IdentifierMaskingDetails"
37
+ name: str
38
+ created_by: Union["TeamUser", None, Unset] = UNSET
39
+ last_used: Union[None, Unset, datetime.datetime] = UNSET
40
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ from ..models.team_user import TeamUser
44
+
45
+ created_at = self.created_at.isoformat()
46
+
47
+ id = str(self.id)
48
+
49
+ key = self.key
50
+
51
+ mask = self.mask.to_dict()
52
+
53
+ name = self.name
54
+
55
+ created_by: Union[None, Unset, dict[str, Any]]
56
+ if isinstance(self.created_by, Unset):
57
+ created_by = UNSET
58
+ elif isinstance(self.created_by, TeamUser):
59
+ created_by = self.created_by.to_dict()
60
+ else:
61
+ created_by = self.created_by
62
+
63
+ last_used: Union[None, Unset, str]
64
+ if isinstance(self.last_used, Unset):
65
+ last_used = UNSET
66
+ elif isinstance(self.last_used, datetime.datetime):
67
+ last_used = self.last_used.isoformat()
68
+ else:
69
+ last_used = self.last_used
70
+
71
+ field_dict: dict[str, Any] = {}
72
+ field_dict.update(self.additional_properties)
73
+ field_dict.update(
74
+ {
75
+ "createdAt": created_at,
76
+ "id": id,
77
+ "key": key,
78
+ "mask": mask,
79
+ "name": name,
80
+ }
81
+ )
82
+ if created_by is not UNSET:
83
+ field_dict["createdBy"] = created_by
84
+ if last_used is not UNSET:
85
+ field_dict["lastUsed"] = last_used
86
+
87
+ return field_dict
88
+
89
+ @classmethod
90
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
91
+ from ..models.identifier_masking_details import IdentifierMaskingDetails
92
+ from ..models.team_user import TeamUser
93
+
94
+ d = dict(src_dict)
95
+ created_at = isoparse(d.pop("createdAt"))
96
+
97
+ id = UUID(d.pop("id"))
98
+
99
+ key = d.pop("key")
100
+
101
+ mask = IdentifierMaskingDetails.from_dict(d.pop("mask"))
102
+
103
+ name = d.pop("name")
104
+
105
+ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]:
106
+ if data is None:
107
+ return data
108
+ if isinstance(data, Unset):
109
+ return data
110
+ try:
111
+ if not isinstance(data, dict):
112
+ raise TypeError()
113
+ created_by_type_1 = TeamUser.from_dict(data)
114
+
115
+ return created_by_type_1
116
+ except: # noqa: E722
117
+ pass
118
+ return cast(Union["TeamUser", None, Unset], data)
119
+
120
+ created_by = _parse_created_by(d.pop("createdBy", UNSET))
121
+
122
+ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]:
123
+ if data is None:
124
+ return data
125
+ if isinstance(data, Unset):
126
+ return data
127
+ try:
128
+ if not isinstance(data, str):
129
+ raise TypeError()
130
+ last_used_type_0 = isoparse(data)
131
+
132
+ return last_used_type_0
133
+ except: # noqa: E722
134
+ pass
135
+ return cast(Union[None, Unset, datetime.datetime], data)
136
+
137
+ last_used = _parse_last_used(d.pop("lastUsed", UNSET))
138
+
139
+ created_team_api_key = cls(
140
+ created_at=created_at,
141
+ id=id,
142
+ key=key,
143
+ mask=mask,
144
+ name=name,
145
+ created_by=created_by,
146
+ last_used=last_used,
147
+ )
148
+
149
+ created_team_api_key.additional_properties = d
150
+ return created_team_api_key
151
+
152
+ @property
153
+ def additional_keys(self) -> list[str]:
154
+ return list(self.additional_properties.keys())
155
+
156
+ def __getitem__(self, key: str) -> Any:
157
+ return self.additional_properties[key]
158
+
159
+ def __setitem__(self, key: str, value: Any) -> None:
160
+ self.additional_properties[key] = value
161
+
162
+ def __delitem__(self, key: str) -> None:
163
+ del self.additional_properties[key]
164
+
165
+ def __contains__(self, key: str) -> bool:
166
+ 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="Error")
8
+
9
+
10
+ @_attrs_define
11
+ class Error:
12
+ """
13
+ Attributes:
14
+ code (int): Error code
15
+ message (str): Error
16
+ """
17
+
18
+ code: int
19
+ message: str
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ code = self.code
24
+
25
+ message = self.message
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "code": code,
32
+ "message": message,
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
+ code = d.pop("code")
42
+
43
+ message = d.pop("message")
44
+
45
+ error = cls(
46
+ code=code,
47
+ message=message,
48
+ )
49
+
50
+ error.additional_properties = d
51
+ return error
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
@@ -0,0 +1,83 @@
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="IdentifierMaskingDetails")
8
+
9
+
10
+ @_attrs_define
11
+ class IdentifierMaskingDetails:
12
+ """
13
+ Attributes:
14
+ masked_value_prefix (str): Prefix used in masked version of the token or key
15
+ masked_value_suffix (str): Suffix used in masked version of the token or key
16
+ prefix (str): Prefix that identifies the token or key type
17
+ value_length (int): Length of the token or key
18
+ """
19
+
20
+ masked_value_prefix: str
21
+ masked_value_suffix: str
22
+ prefix: str
23
+ value_length: int
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ masked_value_prefix = self.masked_value_prefix
28
+
29
+ masked_value_suffix = self.masked_value_suffix
30
+
31
+ prefix = self.prefix
32
+
33
+ value_length = self.value_length
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "maskedValuePrefix": masked_value_prefix,
40
+ "maskedValueSuffix": masked_value_suffix,
41
+ "prefix": prefix,
42
+ "valueLength": value_length,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ masked_value_prefix = d.pop("maskedValuePrefix")
52
+
53
+ masked_value_suffix = d.pop("maskedValueSuffix")
54
+
55
+ prefix = d.pop("prefix")
56
+
57
+ value_length = d.pop("valueLength")
58
+
59
+ identifier_masking_details = cls(
60
+ masked_value_prefix=masked_value_prefix,
61
+ masked_value_suffix=masked_value_suffix,
62
+ prefix=prefix,
63
+ value_length=value_length,
64
+ )
65
+
66
+ identifier_masking_details.additional_properties = d
67
+ return identifier_masking_details
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties
@@ -0,0 +1,138 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import Any, TypeVar, Union
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="ListedSandbox")
13
+
14
+
15
+ @_attrs_define
16
+ class ListedSandbox:
17
+ """
18
+ Attributes:
19
+ client_id (str): Identifier of the client
20
+ cpu_count (int): CPU cores for the sandbox
21
+ end_at (datetime.datetime): Time when the sandbox will expire
22
+ memory_mb (int): Memory for the sandbox in MB
23
+ sandbox_id (str): Identifier of the sandbox
24
+ started_at (datetime.datetime): Time when the sandbox was started
25
+ state (SandboxState): State of the sandbox
26
+ template_id (str): Identifier of the template from which is the sandbox created
27
+ alias (Union[Unset, str]): Alias of the template
28
+ metadata (Union[Unset, Any]):
29
+ """
30
+
31
+ client_id: str
32
+ cpu_count: int
33
+ end_at: datetime.datetime
34
+ memory_mb: int
35
+ sandbox_id: str
36
+ started_at: datetime.datetime
37
+ state: SandboxState
38
+ template_id: str
39
+ alias: Union[Unset, str] = UNSET
40
+ metadata: Union[Unset, Any] = UNSET
41
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ client_id = self.client_id
45
+
46
+ cpu_count = self.cpu_count
47
+
48
+ end_at = self.end_at.isoformat()
49
+
50
+ memory_mb = self.memory_mb
51
+
52
+ sandbox_id = self.sandbox_id
53
+
54
+ started_at = self.started_at.isoformat()
55
+
56
+ state = self.state.value
57
+
58
+ template_id = self.template_id
59
+
60
+ alias = self.alias
61
+
62
+ metadata = self.metadata
63
+
64
+ field_dict: dict[str, Any] = {}
65
+ field_dict.update(self.additional_properties)
66
+ field_dict.update(
67
+ {
68
+ "clientID": client_id,
69
+ "cpuCount": cpu_count,
70
+ "endAt": end_at,
71
+ "memoryMB": memory_mb,
72
+ "sandboxID": sandbox_id,
73
+ "startedAt": started_at,
74
+ "state": state,
75
+ "templateID": template_id,
76
+ }
77
+ )
78
+ if alias is not UNSET:
79
+ field_dict["alias"] = alias
80
+ if metadata is not UNSET:
81
+ field_dict["metadata"] = metadata
82
+
83
+ return field_dict
84
+
85
+ @classmethod
86
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
87
+ d = dict(src_dict)
88
+ client_id = d.pop("clientID")
89
+
90
+ cpu_count = d.pop("cpuCount")
91
+
92
+ end_at = isoparse(d.pop("endAt"))
93
+
94
+ memory_mb = d.pop("memoryMB")
95
+
96
+ sandbox_id = d.pop("sandboxID")
97
+
98
+ started_at = isoparse(d.pop("startedAt"))
99
+
100
+ state = SandboxState(d.pop("state"))
101
+
102
+ template_id = d.pop("templateID")
103
+
104
+ alias = d.pop("alias", UNSET)
105
+
106
+ metadata = d.pop("metadata", UNSET)
107
+
108
+ listed_sandbox = cls(
109
+ client_id=client_id,
110
+ cpu_count=cpu_count,
111
+ end_at=end_at,
112
+ memory_mb=memory_mb,
113
+ sandbox_id=sandbox_id,
114
+ started_at=started_at,
115
+ state=state,
116
+ template_id=template_id,
117
+ alias=alias,
118
+ metadata=metadata,
119
+ )
120
+
121
+ listed_sandbox.additional_properties = d
122
+ return listed_sandbox
123
+
124
+ @property
125
+ def additional_keys(self) -> list[str]:
126
+ return list(self.additional_properties.keys())
127
+
128
+ def __getitem__(self, key: str) -> Any:
129
+ return self.additional_properties[key]
130
+
131
+ def __setitem__(self, key: str, value: Any) -> None:
132
+ self.additional_properties[key] = value
133
+
134
+ def __delitem__(self, key: str) -> None:
135
+ del self.additional_properties[key]
136
+
137
+ def __contains__(self, key: str) -> bool:
138
+ return key in self.additional_properties
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class LogLevel(str, Enum):
5
+ DEBUG = "debug"
6
+ ERROR = "error"
7
+ INFO = "info"
8
+ WARN = "warn"
9
+
10
+ def __str__(self) -> str:
11
+ return str(self.value)
@@ -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="NewAccessToken")
8
+
9
+
10
+ @_attrs_define
11
+ class NewAccessToken:
12
+ """
13
+ Attributes:
14
+ name (str): Name of the access token
15
+ """
16
+
17
+ name: str
18
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
+
20
+ def to_dict(self) -> dict[str, Any]:
21
+ name = self.name
22
+
23
+ field_dict: dict[str, Any] = {}
24
+ field_dict.update(self.additional_properties)
25
+ field_dict.update(
26
+ {
27
+ "name": name,
28
+ }
29
+ )
30
+
31
+ return field_dict
32
+
33
+ @classmethod
34
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
+ d = dict(src_dict)
36
+ name = d.pop("name")
37
+
38
+ new_access_token = cls(
39
+ name=name,
40
+ )
41
+
42
+ new_access_token.additional_properties = d
43
+ return new_access_token
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