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