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,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="Team")
8
+
9
+
10
+ @_attrs_define
11
+ class Team:
12
+ """
13
+ Attributes:
14
+ api_key (str): API key for the team
15
+ is_default (bool): Whether the team is the default team
16
+ name (str): Name of the team
17
+ team_id (str): Identifier of the team
18
+ """
19
+
20
+ api_key: str
21
+ is_default: bool
22
+ name: str
23
+ team_id: str
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ api_key = self.api_key
28
+
29
+ is_default = self.is_default
30
+
31
+ name = self.name
32
+
33
+ team_id = self.team_id
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "apiKey": api_key,
40
+ "isDefault": is_default,
41
+ "name": name,
42
+ "teamID": team_id,
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
+ api_key = d.pop("apiKey")
52
+
53
+ is_default = d.pop("isDefault")
54
+
55
+ name = d.pop("name")
56
+
57
+ team_id = d.pop("teamID")
58
+
59
+ team = cls(
60
+ api_key=api_key,
61
+ is_default=is_default,
62
+ name=name,
63
+ team_id=team_id,
64
+ )
65
+
66
+ team.additional_properties = d
67
+ return team
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,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,68 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
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 (str): Email of the user
16
+ id (UUID): Identifier of the user
17
+ """
18
+
19
+ email: 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 = self.email
25
+
26
+ id = str(self.id)
27
+
28
+ field_dict: dict[str, Any] = {}
29
+ field_dict.update(self.additional_properties)
30
+ field_dict.update(
31
+ {
32
+ "email": email,
33
+ "id": id,
34
+ }
35
+ )
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
+ email = d.pop("email")
43
+
44
+ id = UUID(d.pop("id"))
45
+
46
+ team_user = cls(
47
+ email=email,
48
+ id=id,
49
+ )
50
+
51
+ team_user.additional_properties = d
52
+ return team_user
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,179 @@
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 ..types import UNSET, Unset
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
+ build_count (int): Number of times the template was built
23
+ build_id (str): Identifier of the last successful build for given template
24
+ cpu_count (int): CPU cores for the sandbox
25
+ created_at (datetime.datetime): Time when the template was created
26
+ created_by (Union['TeamUser', None]):
27
+ last_spawned_at (datetime.datetime): Time when the template was last used
28
+ memory_mb (int): Memory for the sandbox in MB
29
+ public (bool): Whether the template is public or only accessible by the team
30
+ spawn_count (int): Number of times the template was used
31
+ template_id (str): Identifier of the template
32
+ updated_at (datetime.datetime): Time when the template was last updated
33
+ aliases (Union[Unset, list[str]]): Aliases of the template
34
+ """
35
+
36
+ build_count: int
37
+ build_id: str
38
+ cpu_count: int
39
+ created_at: datetime.datetime
40
+ created_by: Union["TeamUser", None]
41
+ last_spawned_at: datetime.datetime
42
+ memory_mb: int
43
+ public: bool
44
+ spawn_count: int
45
+ template_id: str
46
+ updated_at: datetime.datetime
47
+ aliases: Union[Unset, list[str]] = UNSET
48
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
49
+
50
+ def to_dict(self) -> dict[str, Any]:
51
+ from ..models.team_user import TeamUser
52
+
53
+ build_count = self.build_count
54
+
55
+ build_id = self.build_id
56
+
57
+ cpu_count = self.cpu_count
58
+
59
+ created_at = self.created_at.isoformat()
60
+
61
+ created_by: Union[None, dict[str, Any]]
62
+ if isinstance(self.created_by, TeamUser):
63
+ created_by = self.created_by.to_dict()
64
+ else:
65
+ created_by = self.created_by
66
+
67
+ last_spawned_at = self.last_spawned_at.isoformat()
68
+
69
+ memory_mb = self.memory_mb
70
+
71
+ public = self.public
72
+
73
+ spawn_count = self.spawn_count
74
+
75
+ template_id = self.template_id
76
+
77
+ updated_at = self.updated_at.isoformat()
78
+
79
+ aliases: Union[Unset, list[str]] = UNSET
80
+ if not isinstance(self.aliases, Unset):
81
+ aliases = self.aliases
82
+
83
+ field_dict: dict[str, Any] = {}
84
+ field_dict.update(self.additional_properties)
85
+ field_dict.update(
86
+ {
87
+ "buildCount": build_count,
88
+ "buildID": build_id,
89
+ "cpuCount": cpu_count,
90
+ "createdAt": created_at,
91
+ "createdBy": created_by,
92
+ "lastSpawnedAt": last_spawned_at,
93
+ "memoryMB": memory_mb,
94
+ "public": public,
95
+ "spawnCount": spawn_count,
96
+ "templateID": template_id,
97
+ "updatedAt": updated_at,
98
+ }
99
+ )
100
+ if aliases is not UNSET:
101
+ field_dict["aliases"] = aliases
102
+
103
+ return field_dict
104
+
105
+ @classmethod
106
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
107
+ from ..models.team_user import TeamUser
108
+
109
+ d = dict(src_dict)
110
+ build_count = d.pop("buildCount")
111
+
112
+ build_id = d.pop("buildID")
113
+
114
+ cpu_count = d.pop("cpuCount")
115
+
116
+ created_at = isoparse(d.pop("createdAt"))
117
+
118
+ def _parse_created_by(data: object) -> Union["TeamUser", None]:
119
+ if data is None:
120
+ return data
121
+ try:
122
+ if not isinstance(data, dict):
123
+ raise TypeError()
124
+ created_by_type_1 = TeamUser.from_dict(data)
125
+
126
+ return created_by_type_1
127
+ except: # noqa: E722
128
+ pass
129
+ return cast(Union["TeamUser", None], data)
130
+
131
+ created_by = _parse_created_by(d.pop("createdBy"))
132
+
133
+ last_spawned_at = isoparse(d.pop("lastSpawnedAt"))
134
+
135
+ memory_mb = d.pop("memoryMB")
136
+
137
+ public = d.pop("public")
138
+
139
+ spawn_count = d.pop("spawnCount")
140
+
141
+ template_id = d.pop("templateID")
142
+
143
+ updated_at = isoparse(d.pop("updatedAt"))
144
+
145
+ aliases = cast(list[str], d.pop("aliases", UNSET))
146
+
147
+ template = cls(
148
+ build_count=build_count,
149
+ build_id=build_id,
150
+ cpu_count=cpu_count,
151
+ created_at=created_at,
152
+ created_by=created_by,
153
+ last_spawned_at=last_spawned_at,
154
+ memory_mb=memory_mb,
155
+ public=public,
156
+ spawn_count=spawn_count,
157
+ template_id=template_id,
158
+ updated_at=updated_at,
159
+ aliases=aliases,
160
+ )
161
+
162
+ template.additional_properties = d
163
+ return template
164
+
165
+ @property
166
+ def additional_keys(self) -> list[str]:
167
+ return list(self.additional_properties.keys())
168
+
169
+ def __getitem__(self, key: str) -> Any:
170
+ return self.additional_properties[key]
171
+
172
+ def __setitem__(self, key: str, value: Any) -> None:
173
+ self.additional_properties[key] = value
174
+
175
+ def __delitem__(self, key: str) -> None:
176
+ del self.additional_properties[key]
177
+
178
+ def __contains__(self, key: str) -> bool:
179
+ return key in self.additional_properties
@@ -0,0 +1,117 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..models.template_build_status import TemplateBuildStatus
8
+ from ..types import UNSET, Unset
9
+
10
+ if TYPE_CHECKING:
11
+ from ..models.build_log_entry import BuildLogEntry
12
+
13
+
14
+ T = TypeVar("T", bound="TemplateBuild")
15
+
16
+
17
+ @_attrs_define
18
+ class TemplateBuild:
19
+ """
20
+ Attributes:
21
+ build_id (str): Identifier of the build
22
+ log_entries (list['BuildLogEntry']): Build logs structured
23
+ logs (list[str]): Build logs
24
+ status (TemplateBuildStatus): Status of the template
25
+ template_id (str): Identifier of the template
26
+ reason (Union[Unset, str]): Message with the status reason, currently reporting only for error status
27
+ """
28
+
29
+ build_id: str
30
+ log_entries: list["BuildLogEntry"]
31
+ logs: list[str]
32
+ status: TemplateBuildStatus
33
+ template_id: str
34
+ reason: Union[Unset, str] = UNSET
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ build_id = self.build_id
39
+
40
+ log_entries = []
41
+ for log_entries_item_data in self.log_entries:
42
+ log_entries_item = log_entries_item_data.to_dict()
43
+ log_entries.append(log_entries_item)
44
+
45
+ logs = self.logs
46
+
47
+ status = self.status.value
48
+
49
+ template_id = self.template_id
50
+
51
+ reason = self.reason
52
+
53
+ field_dict: dict[str, Any] = {}
54
+ field_dict.update(self.additional_properties)
55
+ field_dict.update(
56
+ {
57
+ "buildID": build_id,
58
+ "logEntries": log_entries,
59
+ "logs": logs,
60
+ "status": status,
61
+ "templateID": template_id,
62
+ }
63
+ )
64
+ if reason is not UNSET:
65
+ field_dict["reason"] = reason
66
+
67
+ return field_dict
68
+
69
+ @classmethod
70
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
71
+ from ..models.build_log_entry import BuildLogEntry
72
+
73
+ d = dict(src_dict)
74
+ build_id = d.pop("buildID")
75
+
76
+ log_entries = []
77
+ _log_entries = d.pop("logEntries")
78
+ for log_entries_item_data in _log_entries:
79
+ log_entries_item = BuildLogEntry.from_dict(log_entries_item_data)
80
+
81
+ log_entries.append(log_entries_item)
82
+
83
+ logs = cast(list[str], d.pop("logs"))
84
+
85
+ status = TemplateBuildStatus(d.pop("status"))
86
+
87
+ template_id = d.pop("templateID")
88
+
89
+ reason = d.pop("reason", UNSET)
90
+
91
+ template_build = cls(
92
+ build_id=build_id,
93
+ log_entries=log_entries,
94
+ logs=logs,
95
+ status=status,
96
+ template_id=template_id,
97
+ reason=reason,
98
+ )
99
+
100
+ template_build.additional_properties = d
101
+ return template_build
102
+
103
+ @property
104
+ def additional_keys(self) -> list[str]:
105
+ return list(self.additional_properties.keys())
106
+
107
+ def __getitem__(self, key: str) -> Any:
108
+ return self.additional_properties[key]
109
+
110
+ def __setitem__(self, key: str, value: Any) -> None:
111
+ self.additional_properties[key] = value
112
+
113
+ def __delitem__(self, key: str) -> None:
114
+ del self.additional_properties[key]
115
+
116
+ def __contains__(self, key: str) -> bool:
117
+ return key in self.additional_properties
@@ -0,0 +1,70 @@
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="TemplateBuildFileUpload")
10
+
11
+
12
+ @_attrs_define
13
+ class TemplateBuildFileUpload:
14
+ """
15
+ Attributes:
16
+ present (bool): Whether the file is already present in the cache
17
+ url (Union[Unset, str]): Url where the file should be uploaded to
18
+ """
19
+
20
+ present: bool
21
+ url: Union[Unset, str] = UNSET
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ present = self.present
26
+
27
+ url = self.url
28
+
29
+ field_dict: dict[str, Any] = {}
30
+ field_dict.update(self.additional_properties)
31
+ field_dict.update(
32
+ {
33
+ "present": present,
34
+ }
35
+ )
36
+ if url is not UNSET:
37
+ field_dict["url"] = url
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
+ present = d.pop("present")
45
+
46
+ url = d.pop("url", UNSET)
47
+
48
+ template_build_file_upload = cls(
49
+ present=present,
50
+ url=url,
51
+ )
52
+
53
+ template_build_file_upload.additional_properties = d
54
+ return template_build_file_upload
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