loopix-sdk 2.30.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 (238) hide show
  1. loopix/__init__.py +260 -0
  2. loopix/api/__init__.py +287 -0
  3. loopix/api/client/__init__.py +8 -0
  4. loopix/api/client/api/__init__.py +1 -0
  5. loopix/api/client/api/sandboxes/__init__.py +1 -0
  6. loopix/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
  7. loopix/api/client/api/sandboxes/get_sandboxes.py +176 -0
  8. loopix/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
  9. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
  10. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
  11. loopix/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
  12. loopix/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
  13. loopix/api/client/api/sandboxes/get_v_2_sandboxes_sandbox_id_logs.py +254 -0
  14. loopix/api/client/api/sandboxes/post_sandboxes.py +172 -0
  15. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
  16. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +187 -0
  17. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
  18. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
  19. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_snapshots.py +195 -0
  20. loopix/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
  21. loopix/api/client/api/sandboxes/put_sandboxes_sandbox_id_network.py +199 -0
  22. loopix/api/client/api/snapshots/__init__.py +1 -0
  23. loopix/api/client/api/snapshots/get_snapshots.py +202 -0
  24. loopix/api/client/api/tags/__init__.py +1 -0
  25. loopix/api/client/api/tags/delete_templates_tags.py +174 -0
  26. loopix/api/client/api/tags/get_templates_template_id_tags.py +172 -0
  27. loopix/api/client/api/tags/post_templates_tags.py +176 -0
  28. loopix/api/client/api/templates/__init__.py +1 -0
  29. loopix/api/client/api/templates/delete_templates_template_id.py +157 -0
  30. loopix/api/client/api/templates/get_templates.py +172 -0
  31. loopix/api/client/api/templates/get_templates_aliases_alias.py +167 -0
  32. loopix/api/client/api/templates/get_templates_template_id.py +195 -0
  33. loopix/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +272 -0
  34. loopix/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +232 -0
  35. loopix/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
  36. loopix/api/client/api/templates/patch_templates_template_id.py +183 -0
  37. loopix/api/client/api/templates/patch_v_2_templates_template_id.py +185 -0
  38. loopix/api/client/api/templates/post_templates.py +172 -0
  39. loopix/api/client/api/templates/post_templates_template_id.py +181 -0
  40. loopix/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
  41. loopix/api/client/api/templates/post_v2_templates.py +172 -0
  42. loopix/api/client/api/templates/post_v3_templates.py +176 -0
  43. loopix/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
  44. loopix/api/client/api/volumes/__init__.py +1 -0
  45. loopix/api/client/api/volumes/delete_volumes_volume_id.py +161 -0
  46. loopix/api/client/api/volumes/get_volumes.py +140 -0
  47. loopix/api/client/api/volumes/get_volumes_volume_id.py +163 -0
  48. loopix/api/client/api/volumes/post_volumes.py +172 -0
  49. loopix/api/client/client.py +286 -0
  50. loopix/api/client/errors.py +16 -0
  51. loopix/api/client/models/__init__.py +185 -0
  52. loopix/api/client/models/admin_build_cancel_result.py +67 -0
  53. loopix/api/client/models/admin_sandbox_kill_result.py +67 -0
  54. loopix/api/client/models/assign_template_tags_request.py +67 -0
  55. loopix/api/client/models/assigned_template_tags.py +68 -0
  56. loopix/api/client/models/aws_registry.py +85 -0
  57. loopix/api/client/models/aws_registry_type.py +8 -0
  58. loopix/api/client/models/build_log_entry.py +89 -0
  59. loopix/api/client/models/build_status_reason.py +95 -0
  60. loopix/api/client/models/connect_sandbox.py +59 -0
  61. loopix/api/client/models/created_access_token.py +100 -0
  62. loopix/api/client/models/created_team_api_key.py +166 -0
  63. loopix/api/client/models/delete_template_tags_request.py +67 -0
  64. loopix/api/client/models/disk_metrics.py +91 -0
  65. loopix/api/client/models/error.py +67 -0
  66. loopix/api/client/models/gcp_registry.py +69 -0
  67. loopix/api/client/models/gcp_registry_type.py +8 -0
  68. loopix/api/client/models/general_registry.py +77 -0
  69. loopix/api/client/models/general_registry_type.py +8 -0
  70. loopix/api/client/models/identifier_masking_details.py +83 -0
  71. loopix/api/client/models/listed_sandbox.py +179 -0
  72. loopix/api/client/models/log_level.py +11 -0
  73. loopix/api/client/models/logs_direction.py +9 -0
  74. loopix/api/client/models/logs_source.py +9 -0
  75. loopix/api/client/models/machine_info.py +83 -0
  76. loopix/api/client/models/max_team_metric.py +78 -0
  77. loopix/api/client/models/mcp_type_0.py +44 -0
  78. loopix/api/client/models/new_access_token.py +59 -0
  79. loopix/api/client/models/new_sandbox.py +224 -0
  80. loopix/api/client/models/new_team_api_key.py +59 -0
  81. loopix/api/client/models/new_volume.py +59 -0
  82. loopix/api/client/models/node.py +160 -0
  83. loopix/api/client/models/node_detail.py +160 -0
  84. loopix/api/client/models/node_metrics.py +122 -0
  85. loopix/api/client/models/node_status.py +12 -0
  86. loopix/api/client/models/node_status_change.py +82 -0
  87. loopix/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
  88. loopix/api/client/models/post_sandboxes_sandbox_id_snapshots_body.py +60 -0
  89. loopix/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
  90. loopix/api/client/models/resumed_sandbox.py +68 -0
  91. loopix/api/client/models/sandbox.py +145 -0
  92. loopix/api/client/models/sandbox_auto_resume_config.py +60 -0
  93. loopix/api/client/models/sandbox_detail.py +267 -0
  94. loopix/api/client/models/sandbox_lifecycle.py +70 -0
  95. loopix/api/client/models/sandbox_log.py +70 -0
  96. loopix/api/client/models/sandbox_log_entry.py +93 -0
  97. loopix/api/client/models/sandbox_log_entry_fields.py +44 -0
  98. loopix/api/client/models/sandbox_logs.py +91 -0
  99. loopix/api/client/models/sandbox_logs_v2_response.py +73 -0
  100. loopix/api/client/models/sandbox_metric.py +126 -0
  101. loopix/api/client/models/sandbox_network_config.py +118 -0
  102. loopix/api/client/models/sandbox_network_config_rules.py +72 -0
  103. loopix/api/client/models/sandbox_network_rule.py +74 -0
  104. loopix/api/client/models/sandbox_network_transform.py +79 -0
  105. loopix/api/client/models/sandbox_network_transform_headers.py +47 -0
  106. loopix/api/client/models/sandbox_network_update_config.py +114 -0
  107. loopix/api/client/models/sandbox_network_update_config_rules.py +71 -0
  108. loopix/api/client/models/sandbox_on_timeout.py +9 -0
  109. loopix/api/client/models/sandbox_pause_request.py +62 -0
  110. loopix/api/client/models/sandbox_state.py +9 -0
  111. loopix/api/client/models/sandbox_volume_mount.py +67 -0
  112. loopix/api/client/models/sandboxes_with_metrics.py +59 -0
  113. loopix/api/client/models/snapshot_info.py +70 -0
  114. loopix/api/client/models/team.py +83 -0
  115. loopix/api/client/models/team_api_key.py +158 -0
  116. loopix/api/client/models/team_metric.py +86 -0
  117. loopix/api/client/models/team_user.py +75 -0
  118. loopix/api/client/models/template.py +225 -0
  119. loopix/api/client/models/template_alias_response.py +67 -0
  120. loopix/api/client/models/template_build.py +139 -0
  121. loopix/api/client/models/template_build_file_upload.py +70 -0
  122. loopix/api/client/models/template_build_info.py +126 -0
  123. loopix/api/client/models/template_build_logs_response.py +73 -0
  124. loopix/api/client/models/template_build_request.py +115 -0
  125. loopix/api/client/models/template_build_request_v2.py +88 -0
  126. loopix/api/client/models/template_build_request_v3.py +107 -0
  127. loopix/api/client/models/template_build_start_v2.py +184 -0
  128. loopix/api/client/models/template_build_status.py +11 -0
  129. loopix/api/client/models/template_legacy.py +207 -0
  130. loopix/api/client/models/template_request_response_v3.py +99 -0
  131. loopix/api/client/models/template_step.py +91 -0
  132. loopix/api/client/models/template_tag.py +78 -0
  133. loopix/api/client/models/template_update_request.py +59 -0
  134. loopix/api/client/models/template_update_response.py +59 -0
  135. loopix/api/client/models/template_with_builds.py +156 -0
  136. loopix/api/client/models/update_team_api_key.py +59 -0
  137. loopix/api/client/models/volume.py +67 -0
  138. loopix/api/client/models/volume_and_token.py +75 -0
  139. loopix/api/client/models/volume_token.py +59 -0
  140. loopix/api/client/py.typed +1 -0
  141. loopix/api/client/types.py +54 -0
  142. loopix/api/client_async/__init__.py +74 -0
  143. loopix/api/client_sync/__init__.py +73 -0
  144. loopix/api/metadata.py +14 -0
  145. loopix/connection_config.py +309 -0
  146. loopix/envd/api.py +170 -0
  147. loopix/envd/filesystem/filesystem_connect.py +193 -0
  148. loopix/envd/filesystem/filesystem_pb2.py +80 -0
  149. loopix/envd/filesystem/filesystem_pb2.pyi +272 -0
  150. loopix/envd/process/process_connect.py +174 -0
  151. loopix/envd/process/process_pb2.py +96 -0
  152. loopix/envd/process/process_pb2.pyi +316 -0
  153. loopix/envd/rpc.py +139 -0
  154. loopix/envd/versions.py +11 -0
  155. loopix/exceptions.py +133 -0
  156. loopix/io_utils.py +57 -0
  157. loopix/paginator.py +52 -0
  158. loopix/py.typed +0 -0
  159. loopix/sandbox/_git/__init__.py +85 -0
  160. loopix/sandbox/_git/args.py +363 -0
  161. loopix/sandbox/_git/auth.py +132 -0
  162. loopix/sandbox/_git/config.py +32 -0
  163. loopix/sandbox/_git/parse.py +222 -0
  164. loopix/sandbox/_git/types.py +149 -0
  165. loopix/sandbox/commands/command_handle.py +69 -0
  166. loopix/sandbox/commands/main.py +39 -0
  167. loopix/sandbox/filesystem/filesystem.py +337 -0
  168. loopix/sandbox/filesystem/watch_handle.py +70 -0
  169. loopix/sandbox/main.py +227 -0
  170. loopix/sandbox/mcp.py +1949 -0
  171. loopix/sandbox/network.py +8 -0
  172. loopix/sandbox/sandbox_api.py +624 -0
  173. loopix/sandbox/signature.py +47 -0
  174. loopix/sandbox/utils.py +34 -0
  175. loopix/sandbox_async/commands/command.py +396 -0
  176. loopix/sandbox_async/commands/command_handle.py +298 -0
  177. loopix/sandbox_async/commands/pty.py +257 -0
  178. loopix/sandbox_async/filesystem/filesystem.py +720 -0
  179. loopix/sandbox_async/filesystem/watch_handle.py +97 -0
  180. loopix/sandbox_async/git.py +1100 -0
  181. loopix/sandbox_async/main.py +987 -0
  182. loopix/sandbox_async/paginator.py +140 -0
  183. loopix/sandbox_async/sandbox_api.py +504 -0
  184. loopix/sandbox_async/utils.py +7 -0
  185. loopix/sandbox_domains.py +5 -0
  186. loopix/sandbox_sync/commands/command.py +420 -0
  187. loopix/sandbox_sync/commands/command_handle.py +239 -0
  188. loopix/sandbox_sync/commands/pty.py +279 -0
  189. loopix/sandbox_sync/filesystem/filesystem.py +710 -0
  190. loopix/sandbox_sync/filesystem/watch_handle.py +102 -0
  191. loopix/sandbox_sync/git.py +1077 -0
  192. loopix/sandbox_sync/main.py +975 -0
  193. loopix/sandbox_sync/paginator.py +140 -0
  194. loopix/sandbox_sync/sandbox_api.py +491 -0
  195. loopix/template/consts.py +45 -0
  196. loopix/template/dockerfile_parser.py +286 -0
  197. loopix/template/logger.py +232 -0
  198. loopix/template/main.py +1368 -0
  199. loopix/template/readycmd.py +144 -0
  200. loopix/template/types.py +194 -0
  201. loopix/template/utils.py +426 -0
  202. loopix/template_async/build_api.py +419 -0
  203. loopix/template_async/main.py +528 -0
  204. loopix/template_sync/build_api.py +409 -0
  205. loopix/template_sync/main.py +529 -0
  206. loopix/volume/client/__init__.py +8 -0
  207. loopix/volume/client/api/__init__.py +1 -0
  208. loopix/volume/client/api/volumes/__init__.py +1 -0
  209. loopix/volume/client/api/volumes/delete_volumecontent_volume_id_path.py +174 -0
  210. loopix/volume/client/api/volumes/get_volumecontent_volume_id_dir.py +204 -0
  211. loopix/volume/client/api/volumes/get_volumecontent_volume_id_file.py +179 -0
  212. loopix/volume/client/api/volumes/get_volumecontent_volume_id_path.py +176 -0
  213. loopix/volume/client/api/volumes/patch_volumecontent_volume_id_path.py +203 -0
  214. loopix/volume/client/api/volumes/post_volumecontent_volume_id_dir.py +239 -0
  215. loopix/volume/client/api/volumes/put_volumecontent_volume_id_file.py +259 -0
  216. loopix/volume/client/client.py +286 -0
  217. loopix/volume/client/errors.py +16 -0
  218. loopix/volume/client/models/__init__.py +13 -0
  219. loopix/volume/client/models/error.py +67 -0
  220. loopix/volume/client/models/patch_volumecontent_volume_id_path_body.py +77 -0
  221. loopix/volume/client/models/volume_entry_stat.py +145 -0
  222. loopix/volume/client/models/volume_entry_stat_type.py +11 -0
  223. loopix/volume/client/py.typed +1 -0
  224. loopix/volume/client/types.py +54 -0
  225. loopix/volume/client_async/__init__.py +88 -0
  226. loopix/volume/client_sync/__init__.py +80 -0
  227. loopix/volume/connection_config.py +145 -0
  228. loopix/volume/types.py +62 -0
  229. loopix/volume/utils.py +52 -0
  230. loopix/volume/volume_async.py +639 -0
  231. loopix/volume/volume_sync.py +639 -0
  232. loopix_connect/__init__.py +1 -0
  233. loopix_connect/client.py +534 -0
  234. loopix_connect/py.typed +0 -0
  235. loopix_sdk-2.30.0.dist-info/METADATA +98 -0
  236. loopix_sdk-2.30.0.dist-info/RECORD +238 -0
  237. loopix_sdk-2.30.0.dist-info/WHEEL +4 -0
  238. loopix_sdk-2.30.0.dist-info/licenses/LICENSE +9 -0
@@ -0,0 +1,203 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.patch_volumecontent_volume_id_path_body import (
9
+ PatchVolumecontentVolumeIDPathBody,
10
+ )
11
+ from ...models.volume_entry_stat import VolumeEntryStat
12
+ from ...types import UNSET, Response
13
+
14
+
15
+ def _get_kwargs(
16
+ volume_id: str,
17
+ *,
18
+ body: PatchVolumecontentVolumeIDPathBody,
19
+ path: str,
20
+ ) -> dict[str, Any]:
21
+ headers: dict[str, Any] = {}
22
+
23
+ params: dict[str, Any] = {}
24
+
25
+ params["path"] = path
26
+
27
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
28
+
29
+ _kwargs: dict[str, Any] = {
30
+ "method": "patch",
31
+ "url": f"/volumecontent/{volume_id}/path",
32
+ "params": params,
33
+ }
34
+
35
+ _kwargs["json"] = body.to_dict()
36
+
37
+ headers["Content-Type"] = "application/json"
38
+
39
+ _kwargs["headers"] = headers
40
+ return _kwargs
41
+
42
+
43
+ def _parse_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Optional[Union[Any, VolumeEntryStat]]:
46
+ if response.status_code == 200:
47
+ response_200 = VolumeEntryStat.from_dict(response.json())
48
+
49
+ return response_200
50
+ if response.status_code == 400:
51
+ response_400 = cast(Any, None)
52
+ return response_400
53
+ if response.status_code == 404:
54
+ response_404 = cast(Any, None)
55
+ return response_404
56
+ if response.status_code == 500:
57
+ response_500 = cast(Any, None)
58
+ return response_500
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
67
+ ) -> Response[Union[Any, VolumeEntryStat]]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ volume_id: str,
78
+ *,
79
+ client: Union[AuthenticatedClient, Client],
80
+ body: PatchVolumecontentVolumeIDPathBody,
81
+ path: str,
82
+ ) -> Response[Union[Any, VolumeEntryStat]]:
83
+ """Update path metadata
84
+
85
+ Args:
86
+ volume_id (str):
87
+ path (str):
88
+ body (PatchVolumecontentVolumeIDPathBody):
89
+
90
+ Raises:
91
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
93
+
94
+ Returns:
95
+ Response[Union[Any, VolumeEntryStat]]
96
+ """
97
+
98
+ kwargs = _get_kwargs(
99
+ volume_id=volume_id,
100
+ body=body,
101
+ path=path,
102
+ )
103
+
104
+ response = client.get_httpx_client().request(
105
+ **kwargs,
106
+ )
107
+
108
+ return _build_response(client=client, response=response)
109
+
110
+
111
+ def sync(
112
+ volume_id: str,
113
+ *,
114
+ client: Union[AuthenticatedClient, Client],
115
+ body: PatchVolumecontentVolumeIDPathBody,
116
+ path: str,
117
+ ) -> Optional[Union[Any, VolumeEntryStat]]:
118
+ """Update path metadata
119
+
120
+ Args:
121
+ volume_id (str):
122
+ path (str):
123
+ body (PatchVolumecontentVolumeIDPathBody):
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Union[Any, VolumeEntryStat]
131
+ """
132
+
133
+ return sync_detailed(
134
+ volume_id=volume_id,
135
+ client=client,
136
+ body=body,
137
+ path=path,
138
+ ).parsed
139
+
140
+
141
+ async def asyncio_detailed(
142
+ volume_id: str,
143
+ *,
144
+ client: Union[AuthenticatedClient, Client],
145
+ body: PatchVolumecontentVolumeIDPathBody,
146
+ path: str,
147
+ ) -> Response[Union[Any, VolumeEntryStat]]:
148
+ """Update path metadata
149
+
150
+ Args:
151
+ volume_id (str):
152
+ path (str):
153
+ body (PatchVolumecontentVolumeIDPathBody):
154
+
155
+ Raises:
156
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
158
+
159
+ Returns:
160
+ Response[Union[Any, VolumeEntryStat]]
161
+ """
162
+
163
+ kwargs = _get_kwargs(
164
+ volume_id=volume_id,
165
+ body=body,
166
+ path=path,
167
+ )
168
+
169
+ response = await client.get_async_httpx_client().request(**kwargs)
170
+
171
+ return _build_response(client=client, response=response)
172
+
173
+
174
+ async def asyncio(
175
+ volume_id: str,
176
+ *,
177
+ client: Union[AuthenticatedClient, Client],
178
+ body: PatchVolumecontentVolumeIDPathBody,
179
+ path: str,
180
+ ) -> Optional[Union[Any, VolumeEntryStat]]:
181
+ """Update path metadata
182
+
183
+ Args:
184
+ volume_id (str):
185
+ path (str):
186
+ body (PatchVolumecontentVolumeIDPathBody):
187
+
188
+ Raises:
189
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
190
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
191
+
192
+ Returns:
193
+ Union[Any, VolumeEntryStat]
194
+ """
195
+
196
+ return (
197
+ await asyncio_detailed(
198
+ volume_id=volume_id,
199
+ client=client,
200
+ body=body,
201
+ path=path,
202
+ )
203
+ ).parsed
@@ -0,0 +1,239 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...models.volume_entry_stat import VolumeEntryStat
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ volume_id: str,
15
+ *,
16
+ path: str,
17
+ uid: Union[Unset, int] = UNSET,
18
+ gid: Union[Unset, int] = UNSET,
19
+ mode: Union[Unset, int] = UNSET,
20
+ force: Union[Unset, bool] = UNSET,
21
+ ) -> dict[str, Any]:
22
+ params: dict[str, Any] = {}
23
+
24
+ params["path"] = path
25
+
26
+ params["uid"] = uid
27
+
28
+ params["gid"] = gid
29
+
30
+ params["mode"] = mode
31
+
32
+ params["force"] = force
33
+
34
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
35
+
36
+ _kwargs: dict[str, Any] = {
37
+ "method": "post",
38
+ "url": f"/volumecontent/{volume_id}/dir",
39
+ "params": params,
40
+ }
41
+
42
+ return _kwargs
43
+
44
+
45
+ def _parse_response(
46
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
47
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
48
+ if response.status_code == 201:
49
+ response_201 = VolumeEntryStat.from_dict(response.json())
50
+
51
+ return response_201
52
+ if response.status_code == 404:
53
+ response_404 = cast(Any, None)
54
+ return response_404
55
+ if response.status_code == 500:
56
+ response_500 = Error.from_dict(response.json())
57
+
58
+ return response_500
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
67
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ volume_id: str,
78
+ *,
79
+ client: Union[AuthenticatedClient, Client],
80
+ path: str,
81
+ uid: Union[Unset, int] = UNSET,
82
+ gid: Union[Unset, int] = UNSET,
83
+ mode: Union[Unset, int] = UNSET,
84
+ force: Union[Unset, bool] = UNSET,
85
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
86
+ """Create a directory
87
+
88
+ Args:
89
+ volume_id (str):
90
+ path (str):
91
+ uid (Union[Unset, int]):
92
+ gid (Union[Unset, int]):
93
+ mode (Union[Unset, int]):
94
+ force (Union[Unset, bool]):
95
+
96
+ Raises:
97
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
98
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
99
+
100
+ Returns:
101
+ Response[Union[Any, Error, VolumeEntryStat]]
102
+ """
103
+
104
+ kwargs = _get_kwargs(
105
+ volume_id=volume_id,
106
+ path=path,
107
+ uid=uid,
108
+ gid=gid,
109
+ mode=mode,
110
+ force=force,
111
+ )
112
+
113
+ response = client.get_httpx_client().request(
114
+ **kwargs,
115
+ )
116
+
117
+ return _build_response(client=client, response=response)
118
+
119
+
120
+ def sync(
121
+ volume_id: str,
122
+ *,
123
+ client: Union[AuthenticatedClient, Client],
124
+ path: str,
125
+ uid: Union[Unset, int] = UNSET,
126
+ gid: Union[Unset, int] = UNSET,
127
+ mode: Union[Unset, int] = UNSET,
128
+ force: Union[Unset, bool] = UNSET,
129
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
130
+ """Create a directory
131
+
132
+ Args:
133
+ volume_id (str):
134
+ path (str):
135
+ uid (Union[Unset, int]):
136
+ gid (Union[Unset, int]):
137
+ mode (Union[Unset, int]):
138
+ force (Union[Unset, bool]):
139
+
140
+ Raises:
141
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
143
+
144
+ Returns:
145
+ Union[Any, Error, VolumeEntryStat]
146
+ """
147
+
148
+ return sync_detailed(
149
+ volume_id=volume_id,
150
+ client=client,
151
+ path=path,
152
+ uid=uid,
153
+ gid=gid,
154
+ mode=mode,
155
+ force=force,
156
+ ).parsed
157
+
158
+
159
+ async def asyncio_detailed(
160
+ volume_id: str,
161
+ *,
162
+ client: Union[AuthenticatedClient, Client],
163
+ path: str,
164
+ uid: Union[Unset, int] = UNSET,
165
+ gid: Union[Unset, int] = UNSET,
166
+ mode: Union[Unset, int] = UNSET,
167
+ force: Union[Unset, bool] = UNSET,
168
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
169
+ """Create a directory
170
+
171
+ Args:
172
+ volume_id (str):
173
+ path (str):
174
+ uid (Union[Unset, int]):
175
+ gid (Union[Unset, int]):
176
+ mode (Union[Unset, int]):
177
+ force (Union[Unset, bool]):
178
+
179
+ Raises:
180
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
181
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
182
+
183
+ Returns:
184
+ Response[Union[Any, Error, VolumeEntryStat]]
185
+ """
186
+
187
+ kwargs = _get_kwargs(
188
+ volume_id=volume_id,
189
+ path=path,
190
+ uid=uid,
191
+ gid=gid,
192
+ mode=mode,
193
+ force=force,
194
+ )
195
+
196
+ response = await client.get_async_httpx_client().request(**kwargs)
197
+
198
+ return _build_response(client=client, response=response)
199
+
200
+
201
+ async def asyncio(
202
+ volume_id: str,
203
+ *,
204
+ client: Union[AuthenticatedClient, Client],
205
+ path: str,
206
+ uid: Union[Unset, int] = UNSET,
207
+ gid: Union[Unset, int] = UNSET,
208
+ mode: Union[Unset, int] = UNSET,
209
+ force: Union[Unset, bool] = UNSET,
210
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
211
+ """Create a directory
212
+
213
+ Args:
214
+ volume_id (str):
215
+ path (str):
216
+ uid (Union[Unset, int]):
217
+ gid (Union[Unset, int]):
218
+ mode (Union[Unset, int]):
219
+ force (Union[Unset, bool]):
220
+
221
+ Raises:
222
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
223
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
224
+
225
+ Returns:
226
+ Union[Any, Error, VolumeEntryStat]
227
+ """
228
+
229
+ return (
230
+ await asyncio_detailed(
231
+ volume_id=volume_id,
232
+ client=client,
233
+ path=path,
234
+ uid=uid,
235
+ gid=gid,
236
+ mode=mode,
237
+ force=force,
238
+ )
239
+ ).parsed
@@ -0,0 +1,259 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...models.volume_entry_stat import VolumeEntryStat
10
+ from ...types import UNSET, File, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ volume_id: str,
15
+ *,
16
+ body: File,
17
+ path: str,
18
+ uid: Union[Unset, int] = UNSET,
19
+ gid: Union[Unset, int] = UNSET,
20
+ mode: Union[Unset, int] = UNSET,
21
+ force: Union[Unset, bool] = UNSET,
22
+ ) -> dict[str, Any]:
23
+ headers: dict[str, Any] = {}
24
+
25
+ params: dict[str, Any] = {}
26
+
27
+ params["path"] = path
28
+
29
+ params["uid"] = uid
30
+
31
+ params["gid"] = gid
32
+
33
+ params["mode"] = mode
34
+
35
+ params["force"] = force
36
+
37
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
38
+
39
+ _kwargs: dict[str, Any] = {
40
+ "method": "put",
41
+ "url": f"/volumecontent/{volume_id}/file",
42
+ "params": params,
43
+ }
44
+
45
+ _kwargs["content"] = body.payload
46
+
47
+ headers["Content-Type"] = "application/octet-stream"
48
+
49
+ _kwargs["headers"] = headers
50
+ return _kwargs
51
+
52
+
53
+ def _parse_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
56
+ if response.status_code == 201:
57
+ response_201 = VolumeEntryStat.from_dict(response.json())
58
+
59
+ return response_201
60
+ if response.status_code == 404:
61
+ response_404 = cast(Any, None)
62
+ return response_404
63
+ if response.status_code == 500:
64
+ response_500 = Error.from_dict(response.json())
65
+
66
+ return response_500
67
+ if client.raise_on_unexpected_status:
68
+ raise errors.UnexpectedStatus(response.status_code, response.content)
69
+ else:
70
+ return None
71
+
72
+
73
+ def _build_response(
74
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
75
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
76
+ return Response(
77
+ status_code=HTTPStatus(response.status_code),
78
+ content=response.content,
79
+ headers=response.headers,
80
+ parsed=_parse_response(client=client, response=response),
81
+ )
82
+
83
+
84
+ def sync_detailed(
85
+ volume_id: str,
86
+ *,
87
+ client: Union[AuthenticatedClient, Client],
88
+ body: File,
89
+ path: str,
90
+ uid: Union[Unset, int] = UNSET,
91
+ gid: Union[Unset, int] = UNSET,
92
+ mode: Union[Unset, int] = UNSET,
93
+ force: Union[Unset, bool] = UNSET,
94
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
95
+ """Upload file
96
+
97
+ Args:
98
+ volume_id (str):
99
+ path (str):
100
+ uid (Union[Unset, int]):
101
+ gid (Union[Unset, int]):
102
+ mode (Union[Unset, int]):
103
+ force (Union[Unset, bool]):
104
+ body (File):
105
+
106
+ Raises:
107
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
109
+
110
+ Returns:
111
+ Response[Union[Any, Error, VolumeEntryStat]]
112
+ """
113
+
114
+ kwargs = _get_kwargs(
115
+ volume_id=volume_id,
116
+ body=body,
117
+ path=path,
118
+ uid=uid,
119
+ gid=gid,
120
+ mode=mode,
121
+ force=force,
122
+ )
123
+
124
+ response = client.get_httpx_client().request(
125
+ **kwargs,
126
+ )
127
+
128
+ return _build_response(client=client, response=response)
129
+
130
+
131
+ def sync(
132
+ volume_id: str,
133
+ *,
134
+ client: Union[AuthenticatedClient, Client],
135
+ body: File,
136
+ path: str,
137
+ uid: Union[Unset, int] = UNSET,
138
+ gid: Union[Unset, int] = UNSET,
139
+ mode: Union[Unset, int] = UNSET,
140
+ force: Union[Unset, bool] = UNSET,
141
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
142
+ """Upload file
143
+
144
+ Args:
145
+ volume_id (str):
146
+ path (str):
147
+ uid (Union[Unset, int]):
148
+ gid (Union[Unset, int]):
149
+ mode (Union[Unset, int]):
150
+ force (Union[Unset, bool]):
151
+ body (File):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ Union[Any, Error, VolumeEntryStat]
159
+ """
160
+
161
+ return sync_detailed(
162
+ volume_id=volume_id,
163
+ client=client,
164
+ body=body,
165
+ path=path,
166
+ uid=uid,
167
+ gid=gid,
168
+ mode=mode,
169
+ force=force,
170
+ ).parsed
171
+
172
+
173
+ async def asyncio_detailed(
174
+ volume_id: str,
175
+ *,
176
+ client: Union[AuthenticatedClient, Client],
177
+ body: File,
178
+ path: str,
179
+ uid: Union[Unset, int] = UNSET,
180
+ gid: Union[Unset, int] = UNSET,
181
+ mode: Union[Unset, int] = UNSET,
182
+ force: Union[Unset, bool] = UNSET,
183
+ ) -> Response[Union[Any, Error, VolumeEntryStat]]:
184
+ """Upload file
185
+
186
+ Args:
187
+ volume_id (str):
188
+ path (str):
189
+ uid (Union[Unset, int]):
190
+ gid (Union[Unset, int]):
191
+ mode (Union[Unset, int]):
192
+ force (Union[Unset, bool]):
193
+ body (File):
194
+
195
+ Raises:
196
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
197
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
198
+
199
+ Returns:
200
+ Response[Union[Any, Error, VolumeEntryStat]]
201
+ """
202
+
203
+ kwargs = _get_kwargs(
204
+ volume_id=volume_id,
205
+ body=body,
206
+ path=path,
207
+ uid=uid,
208
+ gid=gid,
209
+ mode=mode,
210
+ force=force,
211
+ )
212
+
213
+ response = await client.get_async_httpx_client().request(**kwargs)
214
+
215
+ return _build_response(client=client, response=response)
216
+
217
+
218
+ async def asyncio(
219
+ volume_id: str,
220
+ *,
221
+ client: Union[AuthenticatedClient, Client],
222
+ body: File,
223
+ path: str,
224
+ uid: Union[Unset, int] = UNSET,
225
+ gid: Union[Unset, int] = UNSET,
226
+ mode: Union[Unset, int] = UNSET,
227
+ force: Union[Unset, bool] = UNSET,
228
+ ) -> Optional[Union[Any, Error, VolumeEntryStat]]:
229
+ """Upload file
230
+
231
+ Args:
232
+ volume_id (str):
233
+ path (str):
234
+ uid (Union[Unset, int]):
235
+ gid (Union[Unset, int]):
236
+ mode (Union[Unset, int]):
237
+ force (Union[Unset, bool]):
238
+ body (File):
239
+
240
+ Raises:
241
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
242
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
243
+
244
+ Returns:
245
+ Union[Any, Error, VolumeEntryStat]
246
+ """
247
+
248
+ return (
249
+ await asyncio_detailed(
250
+ volume_id=volume_id,
251
+ client=client,
252
+ body=body,
253
+ path=path,
254
+ uid=uid,
255
+ gid=gid,
256
+ mode=mode,
257
+ force=force,
258
+ )
259
+ ).parsed