label-studio-sdk 0.0.34__py3-none-any.whl → 1.0.1__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.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

Files changed (272) hide show
  1. label_studio_sdk/__init__.py +232 -9
  2. label_studio_sdk/_extensions/label_studio_tools/__init__.py +0 -0
  3. label_studio_sdk/_extensions/label_studio_tools/core/__init__.py +0 -0
  4. label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +163 -0
  5. label_studio_sdk/_extensions/label_studio_tools/core/utils/__init__.py +0 -0
  6. label_studio_sdk/_extensions/label_studio_tools/core/utils/exceptions.py +2 -0
  7. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +228 -0
  8. label_studio_sdk/_extensions/label_studio_tools/core/utils/params.py +45 -0
  9. label_studio_sdk/_extensions/label_studio_tools/etl/__init__.py +1 -0
  10. label_studio_sdk/_extensions/label_studio_tools/etl/beam.py +34 -0
  11. label_studio_sdk/_extensions/label_studio_tools/etl/example.py +17 -0
  12. label_studio_sdk/_extensions/label_studio_tools/etl/registry.py +67 -0
  13. label_studio_sdk/_extensions/label_studio_tools/postprocessing/__init__.py +0 -0
  14. label_studio_sdk/_extensions/label_studio_tools/postprocessing/video.py +97 -0
  15. label_studio_sdk/_extensions/pager_ext.py +49 -0
  16. label_studio_sdk/_legacy/__init__.py +11 -0
  17. label_studio_sdk/_legacy/client.py +471 -0
  18. label_studio_sdk/_legacy/objects.py +74 -0
  19. label_studio_sdk/{project.py → _legacy/project.py} +2 -2
  20. label_studio_sdk/{schema → _legacy/schema}/label_config_schema.json +14 -14
  21. label_studio_sdk/actions/__init__.py +27 -0
  22. label_studio_sdk/actions/client.py +223 -0
  23. label_studio_sdk/actions/types/__init__.py +25 -0
  24. label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
  25. label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
  26. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +49 -0
  27. label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
  28. label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
  29. label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
  30. label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
  31. label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
  32. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
  33. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
  34. label_studio_sdk/annotations/__init__.py +2 -0
  35. label_studio_sdk/annotations/client.py +750 -0
  36. label_studio_sdk/base_client.py +183 -0
  37. label_studio_sdk/client.py +17 -463
  38. label_studio_sdk/converter/__init__.py +7 -0
  39. label_studio_sdk/converter/audio.py +56 -0
  40. label_studio_sdk/converter/brush.py +452 -0
  41. label_studio_sdk/converter/converter.py +1175 -0
  42. label_studio_sdk/converter/exports/__init__.py +0 -0
  43. label_studio_sdk/converter/exports/csv.py +82 -0
  44. label_studio_sdk/converter/exports/csv2.py +103 -0
  45. label_studio_sdk/converter/funsd.py +85 -0
  46. label_studio_sdk/converter/imports/__init__.py +0 -0
  47. label_studio_sdk/converter/imports/coco.py +314 -0
  48. label_studio_sdk/converter/imports/colors.py +198 -0
  49. label_studio_sdk/converter/imports/label_config.py +45 -0
  50. label_studio_sdk/converter/imports/pathtrack.py +269 -0
  51. label_studio_sdk/converter/imports/yolo.py +236 -0
  52. label_studio_sdk/converter/main.py +202 -0
  53. label_studio_sdk/converter/utils.py +473 -0
  54. label_studio_sdk/core/__init__.py +33 -0
  55. label_studio_sdk/core/api_error.py +15 -0
  56. label_studio_sdk/core/client_wrapper.py +55 -0
  57. label_studio_sdk/core/datetime_utils.py +28 -0
  58. label_studio_sdk/core/file.py +38 -0
  59. label_studio_sdk/core/http_client.py +447 -0
  60. label_studio_sdk/core/jsonable_encoder.py +99 -0
  61. label_studio_sdk/core/pagination.py +87 -0
  62. label_studio_sdk/core/pydantic_utilities.py +28 -0
  63. label_studio_sdk/core/query_encoder.py +33 -0
  64. label_studio_sdk/core/remove_none_from_dict.py +11 -0
  65. label_studio_sdk/core/request_options.py +32 -0
  66. label_studio_sdk/environment.py +7 -0
  67. label_studio_sdk/errors/__init__.py +6 -0
  68. label_studio_sdk/errors/bad_request_error.py +8 -0
  69. label_studio_sdk/errors/internal_server_error.py +8 -0
  70. label_studio_sdk/export_storage/__init__.py +28 -0
  71. label_studio_sdk/export_storage/azure/__init__.py +5 -0
  72. label_studio_sdk/export_storage/azure/client.py +888 -0
  73. label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
  74. label_studio_sdk/export_storage/azure/types/azure_create_response.py +67 -0
  75. label_studio_sdk/export_storage/azure/types/azure_update_response.py +67 -0
  76. label_studio_sdk/export_storage/client.py +107 -0
  77. label_studio_sdk/export_storage/gcs/__init__.py +5 -0
  78. label_studio_sdk/export_storage/gcs/client.py +888 -0
  79. label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
  80. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +67 -0
  81. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +67 -0
  82. label_studio_sdk/export_storage/local/__init__.py +5 -0
  83. label_studio_sdk/export_storage/local/client.py +834 -0
  84. label_studio_sdk/export_storage/local/types/__init__.py +6 -0
  85. label_studio_sdk/export_storage/local/types/local_create_response.py +57 -0
  86. label_studio_sdk/export_storage/local/types/local_update_response.py +57 -0
  87. label_studio_sdk/export_storage/redis/__init__.py +5 -0
  88. label_studio_sdk/export_storage/redis/client.py +918 -0
  89. label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
  90. label_studio_sdk/export_storage/redis/types/redis_create_response.py +72 -0
  91. label_studio_sdk/export_storage/redis/types/redis_update_response.py +72 -0
  92. label_studio_sdk/export_storage/s3/__init__.py +5 -0
  93. label_studio_sdk/export_storage/s3/client.py +1008 -0
  94. label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
  95. label_studio_sdk/export_storage/s3/types/s3create_response.py +89 -0
  96. label_studio_sdk/export_storage/s3/types/s3update_response.py +89 -0
  97. label_studio_sdk/export_storage/types/__init__.py +5 -0
  98. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
  99. label_studio_sdk/files/__init__.py +2 -0
  100. label_studio_sdk/files/client.py +556 -0
  101. label_studio_sdk/import_storage/__init__.py +28 -0
  102. label_studio_sdk/import_storage/azure/__init__.py +5 -0
  103. label_studio_sdk/import_storage/azure/client.py +988 -0
  104. label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
  105. label_studio_sdk/import_storage/azure/types/azure_create_response.py +82 -0
  106. label_studio_sdk/import_storage/azure/types/azure_update_response.py +82 -0
  107. label_studio_sdk/import_storage/client.py +107 -0
  108. label_studio_sdk/import_storage/gcs/__init__.py +5 -0
  109. label_studio_sdk/import_storage/gcs/client.py +988 -0
  110. label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
  111. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +82 -0
  112. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +82 -0
  113. label_studio_sdk/import_storage/local/__init__.py +5 -0
  114. label_studio_sdk/import_storage/local/client.py +836 -0
  115. label_studio_sdk/import_storage/local/types/__init__.py +6 -0
  116. label_studio_sdk/import_storage/local/types/local_create_response.py +57 -0
  117. label_studio_sdk/import_storage/local/types/local_update_response.py +57 -0
  118. label_studio_sdk/import_storage/redis/__init__.py +5 -0
  119. label_studio_sdk/import_storage/redis/client.py +924 -0
  120. label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
  121. label_studio_sdk/import_storage/redis/types/redis_create_response.py +72 -0
  122. label_studio_sdk/import_storage/redis/types/redis_update_response.py +72 -0
  123. label_studio_sdk/import_storage/s3/__init__.py +5 -0
  124. label_studio_sdk/import_storage/s3/client.py +1138 -0
  125. label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
  126. label_studio_sdk/import_storage/s3/types/s3create_response.py +109 -0
  127. label_studio_sdk/import_storage/s3/types/s3update_response.py +109 -0
  128. label_studio_sdk/import_storage/types/__init__.py +5 -0
  129. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
  130. label_studio_sdk/label_interface/base.py +10 -0
  131. label_studio_sdk/label_interface/control_tags.py +109 -71
  132. label_studio_sdk/label_interface/data_examples.json +96 -0
  133. label_studio_sdk/label_interface/interface.py +102 -53
  134. label_studio_sdk/label_interface/object_tags.py +8 -13
  135. label_studio_sdk/label_interface/region.py +33 -1
  136. label_studio_sdk/ml/__init__.py +19 -0
  137. label_studio_sdk/ml/client.py +981 -0
  138. label_studio_sdk/ml/types/__init__.py +17 -0
  139. label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
  140. label_studio_sdk/ml/types/ml_create_response.py +78 -0
  141. label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
  142. label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
  143. label_studio_sdk/ml/types/ml_update_response.py +78 -0
  144. label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
  145. label_studio_sdk/predictions/__init__.py +2 -0
  146. label_studio_sdk/predictions/client.py +638 -0
  147. label_studio_sdk/projects/__init__.py +6 -0
  148. label_studio_sdk/projects/client.py +1055 -0
  149. label_studio_sdk/projects/client_ext.py +19 -0
  150. label_studio_sdk/projects/exports/__init__.py +2 -0
  151. label_studio_sdk/projects/exports/client.py +930 -0
  152. label_studio_sdk/projects/types/__init__.py +7 -0
  153. label_studio_sdk/projects/types/projects_create_response.py +96 -0
  154. label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
  155. label_studio_sdk/projects/types/projects_list_response.py +33 -0
  156. label_studio_sdk/py.typed +0 -0
  157. label_studio_sdk/tasks/__init__.py +5 -0
  158. label_studio_sdk/tasks/client.py +835 -0
  159. label_studio_sdk/tasks/client_ext.py +18 -0
  160. label_studio_sdk/tasks/types/__init__.py +6 -0
  161. label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
  162. label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
  163. label_studio_sdk/types/__init__.py +115 -0
  164. label_studio_sdk/types/annotation.py +116 -0
  165. label_studio_sdk/types/annotation_filter_options.py +42 -0
  166. label_studio_sdk/types/annotation_last_action.py +19 -0
  167. label_studio_sdk/types/azure_blob_export_storage.py +112 -0
  168. label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
  169. label_studio_sdk/types/azure_blob_import_storage.py +113 -0
  170. label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
  171. label_studio_sdk/types/base_task.py +113 -0
  172. label_studio_sdk/types/base_user.py +42 -0
  173. label_studio_sdk/types/converted_format.py +36 -0
  174. label_studio_sdk/types/converted_format_status.py +5 -0
  175. label_studio_sdk/types/export.py +48 -0
  176. label_studio_sdk/types/export_convert.py +32 -0
  177. label_studio_sdk/types/export_create.py +54 -0
  178. label_studio_sdk/types/export_create_status.py +5 -0
  179. label_studio_sdk/types/export_status.py +5 -0
  180. label_studio_sdk/types/file_upload.py +30 -0
  181. label_studio_sdk/types/filter.py +53 -0
  182. label_studio_sdk/types/filter_group.py +35 -0
  183. label_studio_sdk/types/gcs_export_storage.py +112 -0
  184. label_studio_sdk/types/gcs_export_storage_status.py +7 -0
  185. label_studio_sdk/types/gcs_import_storage.py +113 -0
  186. label_studio_sdk/types/gcs_import_storage_status.py +7 -0
  187. label_studio_sdk/types/local_files_export_storage.py +97 -0
  188. label_studio_sdk/types/local_files_export_storage_status.py +7 -0
  189. label_studio_sdk/types/local_files_import_storage.py +92 -0
  190. label_studio_sdk/types/local_files_import_storage_status.py +7 -0
  191. label_studio_sdk/types/ml_backend.py +89 -0
  192. label_studio_sdk/types/ml_backend_auth_method.py +5 -0
  193. label_studio_sdk/types/ml_backend_state.py +5 -0
  194. label_studio_sdk/types/prediction.py +78 -0
  195. label_studio_sdk/types/project.py +198 -0
  196. label_studio_sdk/types/project_import.py +63 -0
  197. label_studio_sdk/types/project_import_status.py +5 -0
  198. label_studio_sdk/types/project_label_config.py +32 -0
  199. label_studio_sdk/types/project_sampling.py +7 -0
  200. label_studio_sdk/types/project_skip_queue.py +5 -0
  201. label_studio_sdk/types/redis_export_storage.py +117 -0
  202. label_studio_sdk/types/redis_export_storage_status.py +7 -0
  203. label_studio_sdk/types/redis_import_storage.py +112 -0
  204. label_studio_sdk/types/redis_import_storage_status.py +7 -0
  205. label_studio_sdk/types/s3export_storage.py +134 -0
  206. label_studio_sdk/types/s3export_storage_status.py +7 -0
  207. label_studio_sdk/types/s3import_storage.py +140 -0
  208. label_studio_sdk/types/s3import_storage_status.py +7 -0
  209. label_studio_sdk/types/serialization_option.py +36 -0
  210. label_studio_sdk/types/serialization_options.py +45 -0
  211. label_studio_sdk/types/task.py +157 -0
  212. label_studio_sdk/types/task_filter_options.py +49 -0
  213. label_studio_sdk/types/user_simple.py +37 -0
  214. label_studio_sdk/types/view.py +55 -0
  215. label_studio_sdk/types/webhook.py +67 -0
  216. label_studio_sdk/types/webhook_actions_item.py +21 -0
  217. label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
  218. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
  219. label_studio_sdk/users/__init__.py +5 -0
  220. label_studio_sdk/users/client.py +830 -0
  221. label_studio_sdk/users/types/__init__.py +6 -0
  222. label_studio_sdk/users/types/users_get_token_response.py +36 -0
  223. label_studio_sdk/users/types/users_reset_token_response.py +36 -0
  224. label_studio_sdk/version.py +4 -0
  225. label_studio_sdk/views/__init__.py +35 -0
  226. label_studio_sdk/views/client.py +564 -0
  227. label_studio_sdk/views/types/__init__.py +33 -0
  228. label_studio_sdk/views/types/views_create_request_data.py +43 -0
  229. label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
  230. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
  231. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +49 -0
  232. label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
  233. label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
  234. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +31 -0
  235. label_studio_sdk/views/types/views_update_request_data.py +43 -0
  236. label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
  237. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
  238. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +49 -0
  239. label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
  240. label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
  241. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +31 -0
  242. label_studio_sdk/webhooks/__init__.py +5 -0
  243. label_studio_sdk/webhooks/client.py +636 -0
  244. label_studio_sdk/webhooks/types/__init__.py +5 -0
  245. label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
  246. label_studio_sdk-1.0.1.dist-info/METADATA +163 -0
  247. label_studio_sdk-1.0.1.dist-info/RECORD +256 -0
  248. {label_studio_sdk-0.0.34.dist-info → label_studio_sdk-1.0.1.dist-info}/WHEEL +1 -2
  249. label_studio_sdk/objects.py +0 -35
  250. label_studio_sdk-0.0.34.dist-info/LICENSE +0 -201
  251. label_studio_sdk-0.0.34.dist-info/METADATA +0 -24
  252. label_studio_sdk-0.0.34.dist-info/RECORD +0 -37
  253. label_studio_sdk-0.0.34.dist-info/top_level.txt +0 -2
  254. tests/test_client.py +0 -37
  255. tests/test_export.py +0 -105
  256. tests/test_interface/__init__.py +0 -1
  257. tests/test_interface/configs.py +0 -137
  258. tests/test_interface/mockups.py +0 -22
  259. tests/test_interface/test_compat.py +0 -64
  260. tests/test_interface/test_control_tags.py +0 -55
  261. tests/test_interface/test_data_generation.py +0 -45
  262. tests/test_interface/test_lpi.py +0 -15
  263. tests/test_interface/test_main.py +0 -196
  264. tests/test_interface/test_object_tags.py +0 -36
  265. tests/test_interface/test_region.py +0 -36
  266. tests/test_interface/test_validate_summary.py +0 -35
  267. tests/test_interface/test_validation.py +0 -59
  268. {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
  269. /label_studio_sdk/{exceptions.py → _legacy/exceptions.py} +0 -0
  270. /label_studio_sdk/{users.py → _legacy/users.py} +0 -0
  271. /label_studio_sdk/{utils.py → _legacy/utils.py} +0 -0
  272. /label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +0 -0
@@ -0,0 +1,1008 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ...core.api_error import ApiError
7
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.pydantic_utilities import pydantic_v1
10
+ from ...core.request_options import RequestOptions
11
+ from ...types.s3export_storage import S3ExportStorage
12
+ from .types.s3create_response import S3CreateResponse
13
+ from .types.s3update_response import S3UpdateResponse
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class S3Client:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def list(
24
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
25
+ ) -> typing.List[S3ExportStorage]:
26
+ """
27
+ You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all S3 export (target) storage connections for a specific project.
28
+
29
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
30
+
31
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
32
+
33
+ Parameters
34
+ ----------
35
+ project : typing.Optional[int]
36
+ Project ID
37
+
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ typing.List[S3ExportStorage]
44
+
45
+
46
+ Examples
47
+ --------
48
+ from label_studio_sdk.client import LabelStudio
49
+
50
+ client = LabelStudio(
51
+ api_key="YOUR_API_KEY",
52
+ )
53
+ client.export_storage.s3.list()
54
+ """
55
+ _response = self._client_wrapper.httpx_client.request(
56
+ "api/storages/export/s3", method="GET", params={"project": project}, request_options=request_options
57
+ )
58
+ if 200 <= _response.status_code < 300:
59
+ return pydantic_v1.parse_obj_as(typing.List[S3ExportStorage], _response.json()) # type: ignore
60
+ try:
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(status_code=_response.status_code, body=_response.text)
64
+ raise ApiError(status_code=_response.status_code, body=_response_json)
65
+
66
+ def create(
67
+ self,
68
+ *,
69
+ can_delete_objects: typing.Optional[bool] = OMIT,
70
+ title: typing.Optional[str] = OMIT,
71
+ description: typing.Optional[str] = OMIT,
72
+ project: typing.Optional[int] = OMIT,
73
+ bucket: typing.Optional[str] = OMIT,
74
+ prefix: typing.Optional[str] = OMIT,
75
+ aws_access_key_id: typing.Optional[str] = OMIT,
76
+ aws_secret_access_key: typing.Optional[str] = OMIT,
77
+ aws_session_token: typing.Optional[str] = OMIT,
78
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
79
+ region_name: typing.Optional[str] = OMIT,
80
+ s3endpoint: typing.Optional[str] = OMIT,
81
+ request_options: typing.Optional[RequestOptions] = None,
82
+ ) -> S3CreateResponse:
83
+ """
84
+ Create a new target storage connection to S3 storage.
85
+
86
+ For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
87
+
88
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be exported until you [sync your connection](sync).</Tip>
89
+
90
+ Parameters
91
+ ----------
92
+ can_delete_objects : typing.Optional[bool]
93
+ Deletion from storage enabled.
94
+
95
+ title : typing.Optional[str]
96
+ Storage title
97
+
98
+ description : typing.Optional[str]
99
+ Storage description
100
+
101
+ project : typing.Optional[int]
102
+ Project ID
103
+
104
+ bucket : typing.Optional[str]
105
+ S3 bucket name
106
+
107
+ prefix : typing.Optional[str]
108
+ S3 bucket prefix
109
+
110
+ aws_access_key_id : typing.Optional[str]
111
+ AWS_ACCESS_KEY_ID
112
+
113
+ aws_secret_access_key : typing.Optional[str]
114
+ AWS_SECRET_ACCESS_KEY
115
+
116
+ aws_session_token : typing.Optional[str]
117
+ AWS_SESSION_TOKEN
118
+
119
+ aws_sse_kms_key_id : typing.Optional[str]
120
+ AWS SSE KMS Key ID
121
+
122
+ region_name : typing.Optional[str]
123
+ AWS Region
124
+
125
+ s3endpoint : typing.Optional[str]
126
+ S3 Endpoint
127
+
128
+ request_options : typing.Optional[RequestOptions]
129
+ Request-specific configuration.
130
+
131
+ Returns
132
+ -------
133
+ S3CreateResponse
134
+
135
+
136
+ Examples
137
+ --------
138
+ from label_studio_sdk.client import LabelStudio
139
+
140
+ client = LabelStudio(
141
+ api_key="YOUR_API_KEY",
142
+ )
143
+ client.export_storage.s3.create()
144
+ """
145
+ _response = self._client_wrapper.httpx_client.request(
146
+ "api/storages/export/s3",
147
+ method="POST",
148
+ json={
149
+ "can_delete_objects": can_delete_objects,
150
+ "title": title,
151
+ "description": description,
152
+ "project": project,
153
+ "bucket": bucket,
154
+ "prefix": prefix,
155
+ "aws_access_key_id": aws_access_key_id,
156
+ "aws_secret_access_key": aws_secret_access_key,
157
+ "aws_session_token": aws_session_token,
158
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
159
+ "region_name": region_name,
160
+ "s3_endpoint": s3endpoint,
161
+ },
162
+ request_options=request_options,
163
+ omit=OMIT,
164
+ )
165
+ if 200 <= _response.status_code < 300:
166
+ return pydantic_v1.parse_obj_as(S3CreateResponse, _response.json()) # type: ignore
167
+ try:
168
+ _response_json = _response.json()
169
+ except JSONDecodeError:
170
+ raise ApiError(status_code=_response.status_code, body=_response.text)
171
+ raise ApiError(status_code=_response.status_code, body=_response_json)
172
+
173
+ def validate(
174
+ self,
175
+ *,
176
+ id: typing.Optional[int] = OMIT,
177
+ can_delete_objects: typing.Optional[bool] = OMIT,
178
+ title: typing.Optional[str] = OMIT,
179
+ description: typing.Optional[str] = OMIT,
180
+ project: typing.Optional[int] = OMIT,
181
+ bucket: typing.Optional[str] = OMIT,
182
+ prefix: typing.Optional[str] = OMIT,
183
+ aws_access_key_id: typing.Optional[str] = OMIT,
184
+ aws_secret_access_key: typing.Optional[str] = OMIT,
185
+ aws_session_token: typing.Optional[str] = OMIT,
186
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
187
+ region_name: typing.Optional[str] = OMIT,
188
+ s3endpoint: typing.Optional[str] = OMIT,
189
+ request_options: typing.Optional[RequestOptions] = None,
190
+ ) -> None:
191
+ """
192
+ Validate a specific S3 export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
193
+
194
+ Parameters
195
+ ----------
196
+ id : typing.Optional[int]
197
+ Storage ID. If set, storage with specified ID will be updated
198
+
199
+ can_delete_objects : typing.Optional[bool]
200
+ Deletion from storage enabled.
201
+
202
+ title : typing.Optional[str]
203
+ Storage title
204
+
205
+ description : typing.Optional[str]
206
+ Storage description
207
+
208
+ project : typing.Optional[int]
209
+ Project ID
210
+
211
+ bucket : typing.Optional[str]
212
+ S3 bucket name
213
+
214
+ prefix : typing.Optional[str]
215
+ S3 bucket prefix
216
+
217
+ aws_access_key_id : typing.Optional[str]
218
+ AWS_ACCESS_KEY_ID
219
+
220
+ aws_secret_access_key : typing.Optional[str]
221
+ AWS_SECRET_ACCESS_KEY
222
+
223
+ aws_session_token : typing.Optional[str]
224
+ AWS_SESSION_TOKEN
225
+
226
+ aws_sse_kms_key_id : typing.Optional[str]
227
+ AWS SSE KMS Key ID
228
+
229
+ region_name : typing.Optional[str]
230
+ AWS Region
231
+
232
+ s3endpoint : typing.Optional[str]
233
+ S3 Endpoint
234
+
235
+ request_options : typing.Optional[RequestOptions]
236
+ Request-specific configuration.
237
+
238
+ Returns
239
+ -------
240
+ None
241
+
242
+ Examples
243
+ --------
244
+ from label_studio_sdk.client import LabelStudio
245
+
246
+ client = LabelStudio(
247
+ api_key="YOUR_API_KEY",
248
+ )
249
+ client.export_storage.s3.validate()
250
+ """
251
+ _response = self._client_wrapper.httpx_client.request(
252
+ "api/storages/export/s3/validate",
253
+ method="POST",
254
+ json={
255
+ "id": id,
256
+ "can_delete_objects": can_delete_objects,
257
+ "title": title,
258
+ "description": description,
259
+ "project": project,
260
+ "bucket": bucket,
261
+ "prefix": prefix,
262
+ "aws_access_key_id": aws_access_key_id,
263
+ "aws_secret_access_key": aws_secret_access_key,
264
+ "aws_session_token": aws_session_token,
265
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
266
+ "region_name": region_name,
267
+ "s3_endpoint": s3endpoint,
268
+ },
269
+ request_options=request_options,
270
+ omit=OMIT,
271
+ )
272
+ if 200 <= _response.status_code < 300:
273
+ return
274
+ try:
275
+ _response_json = _response.json()
276
+ except JSONDecodeError:
277
+ raise ApiError(status_code=_response.status_code, body=_response.text)
278
+ raise ApiError(status_code=_response.status_code, body=_response_json)
279
+
280
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
281
+ """
282
+ Get a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
283
+
284
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
285
+
286
+ Parameters
287
+ ----------
288
+ id : int
289
+ A unique integer value identifying this s3 export storage.
290
+
291
+ request_options : typing.Optional[RequestOptions]
292
+ Request-specific configuration.
293
+
294
+ Returns
295
+ -------
296
+ S3ExportStorage
297
+
298
+
299
+ Examples
300
+ --------
301
+ from label_studio_sdk.client import LabelStudio
302
+
303
+ client = LabelStudio(
304
+ api_key="YOUR_API_KEY",
305
+ )
306
+ client.export_storage.s3.get(
307
+ id=1,
308
+ )
309
+ """
310
+ _response = self._client_wrapper.httpx_client.request(
311
+ f"api/storages/export/s3/{jsonable_encoder(id)}", method="GET", request_options=request_options
312
+ )
313
+ if 200 <= _response.status_code < 300:
314
+ return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
315
+ try:
316
+ _response_json = _response.json()
317
+ except JSONDecodeError:
318
+ raise ApiError(status_code=_response.status_code, body=_response.text)
319
+ raise ApiError(status_code=_response.status_code, body=_response_json)
320
+
321
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
322
+ """
323
+ Delete a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
324
+
325
+ Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
326
+
327
+ Parameters
328
+ ----------
329
+ id : int
330
+ A unique integer value identifying this s3 export storage.
331
+
332
+ request_options : typing.Optional[RequestOptions]
333
+ Request-specific configuration.
334
+
335
+ Returns
336
+ -------
337
+ None
338
+
339
+ Examples
340
+ --------
341
+ from label_studio_sdk.client import LabelStudio
342
+
343
+ client = LabelStudio(
344
+ api_key="YOUR_API_KEY",
345
+ )
346
+ client.export_storage.s3.delete(
347
+ id=1,
348
+ )
349
+ """
350
+ _response = self._client_wrapper.httpx_client.request(
351
+ f"api/storages/export/s3/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
352
+ )
353
+ if 200 <= _response.status_code < 300:
354
+ return
355
+ try:
356
+ _response_json = _response.json()
357
+ except JSONDecodeError:
358
+ raise ApiError(status_code=_response.status_code, body=_response.text)
359
+ raise ApiError(status_code=_response.status_code, body=_response_json)
360
+
361
+ def update(
362
+ self,
363
+ id: int,
364
+ *,
365
+ can_delete_objects: typing.Optional[bool] = OMIT,
366
+ title: typing.Optional[str] = OMIT,
367
+ description: typing.Optional[str] = OMIT,
368
+ project: typing.Optional[int] = OMIT,
369
+ bucket: typing.Optional[str] = OMIT,
370
+ prefix: typing.Optional[str] = OMIT,
371
+ aws_access_key_id: typing.Optional[str] = OMIT,
372
+ aws_secret_access_key: typing.Optional[str] = OMIT,
373
+ aws_session_token: typing.Optional[str] = OMIT,
374
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
375
+ region_name: typing.Optional[str] = OMIT,
376
+ s3endpoint: typing.Optional[str] = OMIT,
377
+ request_options: typing.Optional[RequestOptions] = None,
378
+ ) -> S3UpdateResponse:
379
+ """
380
+ Update a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
381
+
382
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
383
+
384
+ Parameters
385
+ ----------
386
+ id : int
387
+ A unique integer value identifying this s3 export storage.
388
+
389
+ can_delete_objects : typing.Optional[bool]
390
+ Deletion from storage enabled.
391
+
392
+ title : typing.Optional[str]
393
+ Storage title
394
+
395
+ description : typing.Optional[str]
396
+ Storage description
397
+
398
+ project : typing.Optional[int]
399
+ Project ID
400
+
401
+ bucket : typing.Optional[str]
402
+ S3 bucket name
403
+
404
+ prefix : typing.Optional[str]
405
+ S3 bucket prefix
406
+
407
+ aws_access_key_id : typing.Optional[str]
408
+ AWS_ACCESS_KEY_ID
409
+
410
+ aws_secret_access_key : typing.Optional[str]
411
+ AWS_SECRET_ACCESS_KEY
412
+
413
+ aws_session_token : typing.Optional[str]
414
+ AWS_SESSION_TOKEN
415
+
416
+ aws_sse_kms_key_id : typing.Optional[str]
417
+ AWS SSE KMS Key ID
418
+
419
+ region_name : typing.Optional[str]
420
+ AWS Region
421
+
422
+ s3endpoint : typing.Optional[str]
423
+ S3 Endpoint
424
+
425
+ request_options : typing.Optional[RequestOptions]
426
+ Request-specific configuration.
427
+
428
+ Returns
429
+ -------
430
+ S3UpdateResponse
431
+
432
+
433
+ Examples
434
+ --------
435
+ from label_studio_sdk.client import LabelStudio
436
+
437
+ client = LabelStudio(
438
+ api_key="YOUR_API_KEY",
439
+ )
440
+ client.export_storage.s3.update(
441
+ id=1,
442
+ )
443
+ """
444
+ _response = self._client_wrapper.httpx_client.request(
445
+ f"api/storages/export/s3/{jsonable_encoder(id)}",
446
+ method="PATCH",
447
+ json={
448
+ "can_delete_objects": can_delete_objects,
449
+ "title": title,
450
+ "description": description,
451
+ "project": project,
452
+ "bucket": bucket,
453
+ "prefix": prefix,
454
+ "aws_access_key_id": aws_access_key_id,
455
+ "aws_secret_access_key": aws_secret_access_key,
456
+ "aws_session_token": aws_session_token,
457
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
458
+ "region_name": region_name,
459
+ "s3_endpoint": s3endpoint,
460
+ },
461
+ request_options=request_options,
462
+ omit=OMIT,
463
+ )
464
+ if 200 <= _response.status_code < 300:
465
+ return pydantic_v1.parse_obj_as(S3UpdateResponse, _response.json()) # type: ignore
466
+ try:
467
+ _response_json = _response.json()
468
+ except JSONDecodeError:
469
+ raise ApiError(status_code=_response.status_code, body=_response.text)
470
+ raise ApiError(status_code=_response.status_code, body=_response_json)
471
+
472
+ def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
473
+ """
474
+ Sync tasks to an S3 export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
475
+
476
+ Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
477
+
478
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
479
+
480
+ Parameters
481
+ ----------
482
+ id : str
483
+
484
+ request_options : typing.Optional[RequestOptions]
485
+ Request-specific configuration.
486
+
487
+ Returns
488
+ -------
489
+ S3ExportStorage
490
+
491
+
492
+ Examples
493
+ --------
494
+ from label_studio_sdk.client import LabelStudio
495
+
496
+ client = LabelStudio(
497
+ api_key="YOUR_API_KEY",
498
+ )
499
+ client.export_storage.s3.sync(
500
+ id="id",
501
+ )
502
+ """
503
+ _response = self._client_wrapper.httpx_client.request(
504
+ f"api/storages/export/s3/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
505
+ )
506
+ if 200 <= _response.status_code < 300:
507
+ return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
508
+ try:
509
+ _response_json = _response.json()
510
+ except JSONDecodeError:
511
+ raise ApiError(status_code=_response.status_code, body=_response.text)
512
+ raise ApiError(status_code=_response.status_code, body=_response_json)
513
+
514
+
515
+ class AsyncS3Client:
516
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
517
+ self._client_wrapper = client_wrapper
518
+
519
+ async def list(
520
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
521
+ ) -> typing.List[S3ExportStorage]:
522
+ """
523
+ You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all S3 export (target) storage connections for a specific project.
524
+
525
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
526
+
527
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
528
+
529
+ Parameters
530
+ ----------
531
+ project : typing.Optional[int]
532
+ Project ID
533
+
534
+ request_options : typing.Optional[RequestOptions]
535
+ Request-specific configuration.
536
+
537
+ Returns
538
+ -------
539
+ typing.List[S3ExportStorage]
540
+
541
+
542
+ Examples
543
+ --------
544
+ from label_studio_sdk.client import AsyncLabelStudio
545
+
546
+ client = AsyncLabelStudio(
547
+ api_key="YOUR_API_KEY",
548
+ )
549
+ await client.export_storage.s3.list()
550
+ """
551
+ _response = await self._client_wrapper.httpx_client.request(
552
+ "api/storages/export/s3", method="GET", params={"project": project}, request_options=request_options
553
+ )
554
+ if 200 <= _response.status_code < 300:
555
+ return pydantic_v1.parse_obj_as(typing.List[S3ExportStorage], _response.json()) # type: ignore
556
+ try:
557
+ _response_json = _response.json()
558
+ except JSONDecodeError:
559
+ raise ApiError(status_code=_response.status_code, body=_response.text)
560
+ raise ApiError(status_code=_response.status_code, body=_response_json)
561
+
562
+ async def create(
563
+ self,
564
+ *,
565
+ can_delete_objects: typing.Optional[bool] = OMIT,
566
+ title: typing.Optional[str] = OMIT,
567
+ description: typing.Optional[str] = OMIT,
568
+ project: typing.Optional[int] = OMIT,
569
+ bucket: typing.Optional[str] = OMIT,
570
+ prefix: typing.Optional[str] = OMIT,
571
+ aws_access_key_id: typing.Optional[str] = OMIT,
572
+ aws_secret_access_key: typing.Optional[str] = OMIT,
573
+ aws_session_token: typing.Optional[str] = OMIT,
574
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
575
+ region_name: typing.Optional[str] = OMIT,
576
+ s3endpoint: typing.Optional[str] = OMIT,
577
+ request_options: typing.Optional[RequestOptions] = None,
578
+ ) -> S3CreateResponse:
579
+ """
580
+ Create a new target storage connection to S3 storage.
581
+
582
+ For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
583
+
584
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be exported until you [sync your connection](sync).</Tip>
585
+
586
+ Parameters
587
+ ----------
588
+ can_delete_objects : typing.Optional[bool]
589
+ Deletion from storage enabled.
590
+
591
+ title : typing.Optional[str]
592
+ Storage title
593
+
594
+ description : typing.Optional[str]
595
+ Storage description
596
+
597
+ project : typing.Optional[int]
598
+ Project ID
599
+
600
+ bucket : typing.Optional[str]
601
+ S3 bucket name
602
+
603
+ prefix : typing.Optional[str]
604
+ S3 bucket prefix
605
+
606
+ aws_access_key_id : typing.Optional[str]
607
+ AWS_ACCESS_KEY_ID
608
+
609
+ aws_secret_access_key : typing.Optional[str]
610
+ AWS_SECRET_ACCESS_KEY
611
+
612
+ aws_session_token : typing.Optional[str]
613
+ AWS_SESSION_TOKEN
614
+
615
+ aws_sse_kms_key_id : typing.Optional[str]
616
+ AWS SSE KMS Key ID
617
+
618
+ region_name : typing.Optional[str]
619
+ AWS Region
620
+
621
+ s3endpoint : typing.Optional[str]
622
+ S3 Endpoint
623
+
624
+ request_options : typing.Optional[RequestOptions]
625
+ Request-specific configuration.
626
+
627
+ Returns
628
+ -------
629
+ S3CreateResponse
630
+
631
+
632
+ Examples
633
+ --------
634
+ from label_studio_sdk.client import AsyncLabelStudio
635
+
636
+ client = AsyncLabelStudio(
637
+ api_key="YOUR_API_KEY",
638
+ )
639
+ await client.export_storage.s3.create()
640
+ """
641
+ _response = await self._client_wrapper.httpx_client.request(
642
+ "api/storages/export/s3",
643
+ method="POST",
644
+ json={
645
+ "can_delete_objects": can_delete_objects,
646
+ "title": title,
647
+ "description": description,
648
+ "project": project,
649
+ "bucket": bucket,
650
+ "prefix": prefix,
651
+ "aws_access_key_id": aws_access_key_id,
652
+ "aws_secret_access_key": aws_secret_access_key,
653
+ "aws_session_token": aws_session_token,
654
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
655
+ "region_name": region_name,
656
+ "s3_endpoint": s3endpoint,
657
+ },
658
+ request_options=request_options,
659
+ omit=OMIT,
660
+ )
661
+ if 200 <= _response.status_code < 300:
662
+ return pydantic_v1.parse_obj_as(S3CreateResponse, _response.json()) # type: ignore
663
+ try:
664
+ _response_json = _response.json()
665
+ except JSONDecodeError:
666
+ raise ApiError(status_code=_response.status_code, body=_response.text)
667
+ raise ApiError(status_code=_response.status_code, body=_response_json)
668
+
669
+ async def validate(
670
+ self,
671
+ *,
672
+ id: typing.Optional[int] = OMIT,
673
+ can_delete_objects: typing.Optional[bool] = OMIT,
674
+ title: typing.Optional[str] = OMIT,
675
+ description: typing.Optional[str] = OMIT,
676
+ project: typing.Optional[int] = OMIT,
677
+ bucket: typing.Optional[str] = OMIT,
678
+ prefix: typing.Optional[str] = OMIT,
679
+ aws_access_key_id: typing.Optional[str] = OMIT,
680
+ aws_secret_access_key: typing.Optional[str] = OMIT,
681
+ aws_session_token: typing.Optional[str] = OMIT,
682
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
683
+ region_name: typing.Optional[str] = OMIT,
684
+ s3endpoint: typing.Optional[str] = OMIT,
685
+ request_options: typing.Optional[RequestOptions] = None,
686
+ ) -> None:
687
+ """
688
+ Validate a specific S3 export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
689
+
690
+ Parameters
691
+ ----------
692
+ id : typing.Optional[int]
693
+ Storage ID. If set, storage with specified ID will be updated
694
+
695
+ can_delete_objects : typing.Optional[bool]
696
+ Deletion from storage enabled.
697
+
698
+ title : typing.Optional[str]
699
+ Storage title
700
+
701
+ description : typing.Optional[str]
702
+ Storage description
703
+
704
+ project : typing.Optional[int]
705
+ Project ID
706
+
707
+ bucket : typing.Optional[str]
708
+ S3 bucket name
709
+
710
+ prefix : typing.Optional[str]
711
+ S3 bucket prefix
712
+
713
+ aws_access_key_id : typing.Optional[str]
714
+ AWS_ACCESS_KEY_ID
715
+
716
+ aws_secret_access_key : typing.Optional[str]
717
+ AWS_SECRET_ACCESS_KEY
718
+
719
+ aws_session_token : typing.Optional[str]
720
+ AWS_SESSION_TOKEN
721
+
722
+ aws_sse_kms_key_id : typing.Optional[str]
723
+ AWS SSE KMS Key ID
724
+
725
+ region_name : typing.Optional[str]
726
+ AWS Region
727
+
728
+ s3endpoint : typing.Optional[str]
729
+ S3 Endpoint
730
+
731
+ request_options : typing.Optional[RequestOptions]
732
+ Request-specific configuration.
733
+
734
+ Returns
735
+ -------
736
+ None
737
+
738
+ Examples
739
+ --------
740
+ from label_studio_sdk.client import AsyncLabelStudio
741
+
742
+ client = AsyncLabelStudio(
743
+ api_key="YOUR_API_KEY",
744
+ )
745
+ await client.export_storage.s3.validate()
746
+ """
747
+ _response = await self._client_wrapper.httpx_client.request(
748
+ "api/storages/export/s3/validate",
749
+ method="POST",
750
+ json={
751
+ "id": id,
752
+ "can_delete_objects": can_delete_objects,
753
+ "title": title,
754
+ "description": description,
755
+ "project": project,
756
+ "bucket": bucket,
757
+ "prefix": prefix,
758
+ "aws_access_key_id": aws_access_key_id,
759
+ "aws_secret_access_key": aws_secret_access_key,
760
+ "aws_session_token": aws_session_token,
761
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
762
+ "region_name": region_name,
763
+ "s3_endpoint": s3endpoint,
764
+ },
765
+ request_options=request_options,
766
+ omit=OMIT,
767
+ )
768
+ if 200 <= _response.status_code < 300:
769
+ return
770
+ try:
771
+ _response_json = _response.json()
772
+ except JSONDecodeError:
773
+ raise ApiError(status_code=_response.status_code, body=_response.text)
774
+ raise ApiError(status_code=_response.status_code, body=_response_json)
775
+
776
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
777
+ """
778
+ Get a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
779
+
780
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
781
+
782
+ Parameters
783
+ ----------
784
+ id : int
785
+ A unique integer value identifying this s3 export storage.
786
+
787
+ request_options : typing.Optional[RequestOptions]
788
+ Request-specific configuration.
789
+
790
+ Returns
791
+ -------
792
+ S3ExportStorage
793
+
794
+
795
+ Examples
796
+ --------
797
+ from label_studio_sdk.client import AsyncLabelStudio
798
+
799
+ client = AsyncLabelStudio(
800
+ api_key="YOUR_API_KEY",
801
+ )
802
+ await client.export_storage.s3.get(
803
+ id=1,
804
+ )
805
+ """
806
+ _response = await self._client_wrapper.httpx_client.request(
807
+ f"api/storages/export/s3/{jsonable_encoder(id)}", method="GET", request_options=request_options
808
+ )
809
+ if 200 <= _response.status_code < 300:
810
+ return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
811
+ try:
812
+ _response_json = _response.json()
813
+ except JSONDecodeError:
814
+ raise ApiError(status_code=_response.status_code, body=_response.text)
815
+ raise ApiError(status_code=_response.status_code, body=_response_json)
816
+
817
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
818
+ """
819
+ Delete a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
820
+
821
+ Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
822
+
823
+ Parameters
824
+ ----------
825
+ id : int
826
+ A unique integer value identifying this s3 export storage.
827
+
828
+ request_options : typing.Optional[RequestOptions]
829
+ Request-specific configuration.
830
+
831
+ Returns
832
+ -------
833
+ None
834
+
835
+ Examples
836
+ --------
837
+ from label_studio_sdk.client import AsyncLabelStudio
838
+
839
+ client = AsyncLabelStudio(
840
+ api_key="YOUR_API_KEY",
841
+ )
842
+ await client.export_storage.s3.delete(
843
+ id=1,
844
+ )
845
+ """
846
+ _response = await self._client_wrapper.httpx_client.request(
847
+ f"api/storages/export/s3/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
848
+ )
849
+ if 200 <= _response.status_code < 300:
850
+ return
851
+ try:
852
+ _response_json = _response.json()
853
+ except JSONDecodeError:
854
+ raise ApiError(status_code=_response.status_code, body=_response.text)
855
+ raise ApiError(status_code=_response.status_code, body=_response_json)
856
+
857
+ async def update(
858
+ self,
859
+ id: int,
860
+ *,
861
+ can_delete_objects: typing.Optional[bool] = OMIT,
862
+ title: typing.Optional[str] = OMIT,
863
+ description: typing.Optional[str] = OMIT,
864
+ project: typing.Optional[int] = OMIT,
865
+ bucket: typing.Optional[str] = OMIT,
866
+ prefix: typing.Optional[str] = OMIT,
867
+ aws_access_key_id: typing.Optional[str] = OMIT,
868
+ aws_secret_access_key: typing.Optional[str] = OMIT,
869
+ aws_session_token: typing.Optional[str] = OMIT,
870
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
871
+ region_name: typing.Optional[str] = OMIT,
872
+ s3endpoint: typing.Optional[str] = OMIT,
873
+ request_options: typing.Optional[RequestOptions] = None,
874
+ ) -> S3UpdateResponse:
875
+ """
876
+ Update a specific S3 export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
877
+
878
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
879
+
880
+ Parameters
881
+ ----------
882
+ id : int
883
+ A unique integer value identifying this s3 export storage.
884
+
885
+ can_delete_objects : typing.Optional[bool]
886
+ Deletion from storage enabled.
887
+
888
+ title : typing.Optional[str]
889
+ Storage title
890
+
891
+ description : typing.Optional[str]
892
+ Storage description
893
+
894
+ project : typing.Optional[int]
895
+ Project ID
896
+
897
+ bucket : typing.Optional[str]
898
+ S3 bucket name
899
+
900
+ prefix : typing.Optional[str]
901
+ S3 bucket prefix
902
+
903
+ aws_access_key_id : typing.Optional[str]
904
+ AWS_ACCESS_KEY_ID
905
+
906
+ aws_secret_access_key : typing.Optional[str]
907
+ AWS_SECRET_ACCESS_KEY
908
+
909
+ aws_session_token : typing.Optional[str]
910
+ AWS_SESSION_TOKEN
911
+
912
+ aws_sse_kms_key_id : typing.Optional[str]
913
+ AWS SSE KMS Key ID
914
+
915
+ region_name : typing.Optional[str]
916
+ AWS Region
917
+
918
+ s3endpoint : typing.Optional[str]
919
+ S3 Endpoint
920
+
921
+ request_options : typing.Optional[RequestOptions]
922
+ Request-specific configuration.
923
+
924
+ Returns
925
+ -------
926
+ S3UpdateResponse
927
+
928
+
929
+ Examples
930
+ --------
931
+ from label_studio_sdk.client import AsyncLabelStudio
932
+
933
+ client = AsyncLabelStudio(
934
+ api_key="YOUR_API_KEY",
935
+ )
936
+ await client.export_storage.s3.update(
937
+ id=1,
938
+ )
939
+ """
940
+ _response = await self._client_wrapper.httpx_client.request(
941
+ f"api/storages/export/s3/{jsonable_encoder(id)}",
942
+ method="PATCH",
943
+ json={
944
+ "can_delete_objects": can_delete_objects,
945
+ "title": title,
946
+ "description": description,
947
+ "project": project,
948
+ "bucket": bucket,
949
+ "prefix": prefix,
950
+ "aws_access_key_id": aws_access_key_id,
951
+ "aws_secret_access_key": aws_secret_access_key,
952
+ "aws_session_token": aws_session_token,
953
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
954
+ "region_name": region_name,
955
+ "s3_endpoint": s3endpoint,
956
+ },
957
+ request_options=request_options,
958
+ omit=OMIT,
959
+ )
960
+ if 200 <= _response.status_code < 300:
961
+ return pydantic_v1.parse_obj_as(S3UpdateResponse, _response.json()) # type: ignore
962
+ try:
963
+ _response_json = _response.json()
964
+ except JSONDecodeError:
965
+ raise ApiError(status_code=_response.status_code, body=_response.text)
966
+ raise ApiError(status_code=_response.status_code, body=_response_json)
967
+
968
+ async def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
969
+ """
970
+ Sync tasks to an S3 export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
971
+
972
+ Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
973
+
974
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
975
+
976
+ Parameters
977
+ ----------
978
+ id : str
979
+
980
+ request_options : typing.Optional[RequestOptions]
981
+ Request-specific configuration.
982
+
983
+ Returns
984
+ -------
985
+ S3ExportStorage
986
+
987
+
988
+ Examples
989
+ --------
990
+ from label_studio_sdk.client import AsyncLabelStudio
991
+
992
+ client = AsyncLabelStudio(
993
+ api_key="YOUR_API_KEY",
994
+ )
995
+ await client.export_storage.s3.sync(
996
+ id="id",
997
+ )
998
+ """
999
+ _response = await self._client_wrapper.httpx_client.request(
1000
+ f"api/storages/export/s3/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
1001
+ )
1002
+ if 200 <= _response.status_code < 300:
1003
+ return pydantic_v1.parse_obj_as(S3ExportStorage, _response.json()) # type: ignore
1004
+ try:
1005
+ _response_json = _response.json()
1006
+ except JSONDecodeError:
1007
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1008
+ raise ApiError(status_code=_response.status_code, body=_response_json)