label-studio-sdk 2.0.0__py3-none-any.whl → 2.0.2__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.
- label_studio_sdk/__init__.py +24 -0
- label_studio_sdk/actions/client.py +13 -13
- label_studio_sdk/actions/types/actions_list_response_item.py +3 -3
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +2 -2
- label_studio_sdk/annotations/client.py +441 -441
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/billing/__init__.py +2 -0
- label_studio_sdk/billing/client.py +112 -0
- label_studio_sdk/comments/client.py +176 -176
- label_studio_sdk/export_storage/azure/client.py +274 -274
- label_studio_sdk/export_storage/gcs/client.py +263 -263
- label_studio_sdk/export_storage/local/client.py +206 -206
- label_studio_sdk/export_storage/redis/client.py +287 -287
- label_studio_sdk/export_storage/s3/client.py +347 -347
- label_studio_sdk/export_storage/s3s/client.py +678 -678
- label_studio_sdk/import_storage/azure/client.py +357 -357
- label_studio_sdk/import_storage/gcs/client.py +357 -357
- label_studio_sdk/import_storage/local/client.py +206 -206
- label_studio_sdk/import_storage/redis/client.py +309 -309
- label_studio_sdk/import_storage/s3/client.py +452 -452
- label_studio_sdk/import_storage/s3s/client.py +735 -735
- label_studio_sdk/jwt_settings/client.py +10 -10
- label_studio_sdk/ml/client.py +118 -118
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +1 -1
- label_studio_sdk/model_providers/client.py +181 -181
- label_studio_sdk/organizations/members/client.py +348 -2
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +30 -1
- label_studio_sdk/projects/assignments/__init__.py +33 -0
- label_studio_sdk/projects/assignments/client.py +764 -0
- label_studio_sdk/projects/assignments/types/__init__.py +35 -0
- label_studio_sdk/projects/assignments/types/assignments_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters.py +33 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_conjunction.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item.py +44 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_value.py +7 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items.py +9 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_excluded.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_included.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_response.py +22 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +441 -425
- label_studio_sdk/projects/exports/client.py +55 -55
- label_studio_sdk/projects/exports/types/exports_convert_response.py +1 -1
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +5 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +12 -12
- label_studio_sdk/prompts/client.py +211 -211
- label_studio_sdk/prompts/runs/client.py +33 -33
- label_studio_sdk/prompts/versions/client.py +72 -72
- label_studio_sdk/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +22 -0
- label_studio_sdk/types/all_roles_project_list.py +98 -98
- label_studio_sdk/types/annotation.py +35 -35
- label_studio_sdk/types/annotation_request.py +27 -27
- label_studio_sdk/types/azure_blob_export_storage.py +29 -29
- label_studio_sdk/types/azure_blob_import_storage.py +33 -33
- label_studio_sdk/types/batch_failed_predictions.py +1 -1
- label_studio_sdk/types/billing_checks.py +39 -0
- label_studio_sdk/types/billing_flags.py +44 -0
- label_studio_sdk/types/billing_info_response.py +22 -0
- label_studio_sdk/types/blueprint_list.py +7 -8
- label_studio_sdk/types/child_filter.py +11 -10
- label_studio_sdk/types/comment.py +15 -15
- label_studio_sdk/types/comment_request.py +7 -8
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +17 -18
- label_studio_sdk/types/converted_format.py +1 -1
- label_studio_sdk/types/converted_format_request.py +1 -1
- label_studio_sdk/types/count_limit.py +22 -0
- label_studio_sdk/types/export.py +8 -8
- label_studio_sdk/types/file_upload.py +3 -2
- label_studio_sdk/types/filter.py +10 -9
- label_studio_sdk/types/filter_group.py +4 -3
- label_studio_sdk/types/gcs_export_storage.py +23 -23
- label_studio_sdk/types/gcs_import_storage.py +27 -27
- label_studio_sdk/types/import_api_request.py +26 -26
- label_studio_sdk/types/inference_run_cost_estimate.py +10 -10
- label_studio_sdk/types/local_files_export_storage.py +23 -23
- label_studio_sdk/types/local_files_import_storage.py +26 -26
- label_studio_sdk/types/lse_annotation_filter_options.py +10 -10
- label_studio_sdk/types/lse_annotation_filter_options_request.py +10 -10
- label_studio_sdk/types/lse_export_create.py +12 -12
- label_studio_sdk/types/lse_fields.py +14 -14
- label_studio_sdk/types/lse_organization.py +17 -17
- label_studio_sdk/types/lse_organization_member_list.py +32 -0
- label_studio_sdk/types/lse_project_create.py +72 -72
- label_studio_sdk/types/lse_project_update.py +89 -89
- label_studio_sdk/types/lse_s3export_storage.py +46 -46
- label_studio_sdk/types/lse_s3export_storage_request.py +43 -43
- label_studio_sdk/types/lse_s3import_storage.py +53 -53
- label_studio_sdk/types/lse_s3import_storage_request.py +49 -49
- label_studio_sdk/types/lse_task.py +49 -49
- label_studio_sdk/types/lse_task_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_filter_options.py +14 -14
- label_studio_sdk/types/lse_task_filter_options_request.py +14 -14
- label_studio_sdk/types/lse_task_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +12 -12
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +49 -49
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +5 -5
- label_studio_sdk/types/lse_user.py +13 -13
- label_studio_sdk/types/lse_user_api.py +11 -11
- label_studio_sdk/types/lse_user_organization_member_list.py +48 -0
- label_studio_sdk/types/lseapi_token_create.py +1 -1
- label_studio_sdk/types/lseapi_token_list.py +1 -1
- label_studio_sdk/types/lsejwt_settings.py +5 -5
- label_studio_sdk/types/ml_backend.py +27 -28
- label_studio_sdk/types/model_interface.py +12 -12
- label_studio_sdk/types/model_interface_request.py +7 -8
- label_studio_sdk/types/model_interface_serializer_get.py +13 -13
- label_studio_sdk/types/model_provider_connection.py +34 -34
- label_studio_sdk/types/model_provider_connection_request.py +15 -14
- label_studio_sdk/types/model_run.py +12 -12
- label_studio_sdk/types/organization_billing.py +1 -1
- label_studio_sdk/types/organization_id.py +2 -2
- label_studio_sdk/types/organization_invite.py +1 -1
- label_studio_sdk/types/organization_member.py +8 -9
- label_studio_sdk/types/organization_membership.py +2 -1
- label_studio_sdk/types/paginated_lse_organization_member_list_list.py +23 -0
- label_studio_sdk/types/pause.py +23 -23
- label_studio_sdk/types/prediction.py +21 -21
- label_studio_sdk/types/prediction_request.py +16 -16
- label_studio_sdk/types/project.py +72 -72
- label_studio_sdk/types/project_import.py +21 -21
- label_studio_sdk/types/prompts_status_enum.py +16 -0
- label_studio_sdk/types/redis_export_storage.py +34 -34
- label_studio_sdk/types/redis_import_storage.py +37 -37
- label_studio_sdk/types/refined_prompt_response.py +11 -11
- label_studio_sdk/types/review_settings.py +29 -30
- label_studio_sdk/types/review_settings_request.py +29 -30
- label_studio_sdk/types/role9e7enum.py +5 -0
- label_studio_sdk/types/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- label_studio_sdk/types/selected_items_request.py +1 -1
- label_studio_sdk/types/serialization_options.py +10 -10
- label_studio_sdk/types/serialization_options_request.py +10 -10
- label_studio_sdk/types/task_assignment.py +43 -0
- label_studio_sdk/types/third_party_model_version.py +11 -11
- label_studio_sdk/types/third_party_model_version_request.py +6 -7
- label_studio_sdk/types/type_enum.py +5 -0
- label_studio_sdk/types/user_simple.py +3 -3
- label_studio_sdk/types/user_simple_request.py +1 -1
- label_studio_sdk/types/version_response.py +19 -20
- label_studio_sdk/types/view.py +8 -8
- label_studio_sdk/types/webhook.py +16 -16
- label_studio_sdk/types/webhook_serializer_for_update.py +16 -16
- label_studio_sdk/types/workspace.py +10 -11
- label_studio_sdk/users/client.py +160 -160
- label_studio_sdk/views/client.py +164 -164
- label_studio_sdk/webhooks/client.py +183 -183
- label_studio_sdk/webhooks/types/webhooks_info_response.py +32 -32
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +1 -1
- label_studio_sdk/workspaces/client.py +40 -40
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/METADATA +73 -25
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/RECORD +175 -146
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/WHEEL +0 -0
|
@@ -79,18 +79,18 @@ class S3Client:
|
|
|
79
79
|
def create(
|
|
80
80
|
self,
|
|
81
81
|
*,
|
|
82
|
-
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
83
|
-
title: typing.Optional[str] = OMIT,
|
|
84
|
-
description: typing.Optional[str] = OMIT,
|
|
85
|
-
project: typing.Optional[int] = OMIT,
|
|
86
|
-
bucket: typing.Optional[str] = OMIT,
|
|
87
|
-
prefix: typing.Optional[str] = OMIT,
|
|
88
82
|
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
89
83
|
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
90
84
|
aws_session_token: typing.Optional[str] = OMIT,
|
|
91
85
|
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
86
|
+
bucket: typing.Optional[str] = OMIT,
|
|
87
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
88
|
+
description: typing.Optional[str] = OMIT,
|
|
89
|
+
prefix: typing.Optional[str] = OMIT,
|
|
90
|
+
project: typing.Optional[int] = OMIT,
|
|
92
91
|
region_name: typing.Optional[str] = OMIT,
|
|
93
92
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
93
|
+
title: typing.Optional[str] = OMIT,
|
|
94
94
|
request_options: typing.Optional[RequestOptions] = None,
|
|
95
95
|
) -> S3ExportStorage:
|
|
96
96
|
"""
|
|
@@ -98,24 +98,6 @@ class S3Client:
|
|
|
98
98
|
|
|
99
99
|
Parameters
|
|
100
100
|
----------
|
|
101
|
-
can_delete_objects : typing.Optional[bool]
|
|
102
|
-
Deletion from storage enabled.
|
|
103
|
-
|
|
104
|
-
title : typing.Optional[str]
|
|
105
|
-
Storage title
|
|
106
|
-
|
|
107
|
-
description : typing.Optional[str]
|
|
108
|
-
Storage description
|
|
109
|
-
|
|
110
|
-
project : typing.Optional[int]
|
|
111
|
-
Project ID
|
|
112
|
-
|
|
113
|
-
bucket : typing.Optional[str]
|
|
114
|
-
S3 bucket name
|
|
115
|
-
|
|
116
|
-
prefix : typing.Optional[str]
|
|
117
|
-
S3 bucket prefix
|
|
118
|
-
|
|
119
101
|
aws_access_key_id : typing.Optional[str]
|
|
120
102
|
AWS_ACCESS_KEY_ID
|
|
121
103
|
|
|
@@ -128,12 +110,30 @@ class S3Client:
|
|
|
128
110
|
aws_sse_kms_key_id : typing.Optional[str]
|
|
129
111
|
AWS SSE KMS Key ID
|
|
130
112
|
|
|
113
|
+
bucket : typing.Optional[str]
|
|
114
|
+
S3 bucket name
|
|
115
|
+
|
|
116
|
+
can_delete_objects : typing.Optional[bool]
|
|
117
|
+
Deletion from storage enabled.
|
|
118
|
+
|
|
119
|
+
description : typing.Optional[str]
|
|
120
|
+
Storage description
|
|
121
|
+
|
|
122
|
+
prefix : typing.Optional[str]
|
|
123
|
+
S3 bucket prefix
|
|
124
|
+
|
|
125
|
+
project : typing.Optional[int]
|
|
126
|
+
Project ID
|
|
127
|
+
|
|
131
128
|
region_name : typing.Optional[str]
|
|
132
129
|
AWS Region
|
|
133
130
|
|
|
134
131
|
s3endpoint : typing.Optional[str]
|
|
135
132
|
S3 Endpoint
|
|
136
133
|
|
|
134
|
+
title : typing.Optional[str]
|
|
135
|
+
Storage title
|
|
136
|
+
|
|
137
137
|
request_options : typing.Optional[RequestOptions]
|
|
138
138
|
Request-specific configuration.
|
|
139
139
|
|
|
@@ -155,18 +155,18 @@ class S3Client:
|
|
|
155
155
|
"api/storages/export/s3",
|
|
156
156
|
method="POST",
|
|
157
157
|
json={
|
|
158
|
-
"can_delete_objects": can_delete_objects,
|
|
159
|
-
"title": title,
|
|
160
|
-
"description": description,
|
|
161
|
-
"project": project,
|
|
162
|
-
"bucket": bucket,
|
|
163
|
-
"prefix": prefix,
|
|
164
158
|
"aws_access_key_id": aws_access_key_id,
|
|
165
159
|
"aws_secret_access_key": aws_secret_access_key,
|
|
166
160
|
"aws_session_token": aws_session_token,
|
|
167
161
|
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
162
|
+
"bucket": bucket,
|
|
163
|
+
"can_delete_objects": can_delete_objects,
|
|
164
|
+
"description": description,
|
|
165
|
+
"prefix": prefix,
|
|
166
|
+
"project": project,
|
|
168
167
|
"region_name": region_name,
|
|
169
168
|
"s3_endpoint": s3endpoint,
|
|
169
|
+
"title": title,
|
|
170
170
|
},
|
|
171
171
|
headers={
|
|
172
172
|
"content-type": "application/json",
|
|
@@ -188,6 +188,116 @@ class S3Client:
|
|
|
188
188
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
189
189
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
190
190
|
|
|
191
|
+
def validate(
|
|
192
|
+
self,
|
|
193
|
+
*,
|
|
194
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
195
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
196
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
197
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
198
|
+
bucket: typing.Optional[str] = OMIT,
|
|
199
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
200
|
+
description: typing.Optional[str] = OMIT,
|
|
201
|
+
id: typing.Optional[int] = OMIT,
|
|
202
|
+
prefix: typing.Optional[str] = OMIT,
|
|
203
|
+
project: typing.Optional[int] = OMIT,
|
|
204
|
+
region_name: typing.Optional[str] = OMIT,
|
|
205
|
+
s3endpoint: typing.Optional[str] = OMIT,
|
|
206
|
+
title: typing.Optional[str] = OMIT,
|
|
207
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
208
|
+
) -> None:
|
|
209
|
+
"""
|
|
210
|
+
Validate a specific S3 export storage connection.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
aws_access_key_id : typing.Optional[str]
|
|
215
|
+
AWS_ACCESS_KEY_ID
|
|
216
|
+
|
|
217
|
+
aws_secret_access_key : typing.Optional[str]
|
|
218
|
+
AWS_SECRET_ACCESS_KEY
|
|
219
|
+
|
|
220
|
+
aws_session_token : typing.Optional[str]
|
|
221
|
+
AWS_SESSION_TOKEN
|
|
222
|
+
|
|
223
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
224
|
+
AWS SSE KMS Key ID
|
|
225
|
+
|
|
226
|
+
bucket : typing.Optional[str]
|
|
227
|
+
S3 bucket name
|
|
228
|
+
|
|
229
|
+
can_delete_objects : typing.Optional[bool]
|
|
230
|
+
Deletion from storage enabled.
|
|
231
|
+
|
|
232
|
+
description : typing.Optional[str]
|
|
233
|
+
Storage description
|
|
234
|
+
|
|
235
|
+
id : typing.Optional[int]
|
|
236
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
237
|
+
|
|
238
|
+
prefix : typing.Optional[str]
|
|
239
|
+
S3 bucket prefix
|
|
240
|
+
|
|
241
|
+
project : typing.Optional[int]
|
|
242
|
+
Project ID
|
|
243
|
+
|
|
244
|
+
region_name : typing.Optional[str]
|
|
245
|
+
AWS Region
|
|
246
|
+
|
|
247
|
+
s3endpoint : typing.Optional[str]
|
|
248
|
+
S3 Endpoint
|
|
249
|
+
|
|
250
|
+
title : typing.Optional[str]
|
|
251
|
+
Storage title
|
|
252
|
+
|
|
253
|
+
request_options : typing.Optional[RequestOptions]
|
|
254
|
+
Request-specific configuration.
|
|
255
|
+
|
|
256
|
+
Returns
|
|
257
|
+
-------
|
|
258
|
+
None
|
|
259
|
+
|
|
260
|
+
Examples
|
|
261
|
+
--------
|
|
262
|
+
from label_studio_sdk import LabelStudio
|
|
263
|
+
|
|
264
|
+
client = LabelStudio(
|
|
265
|
+
api_key="YOUR_API_KEY",
|
|
266
|
+
)
|
|
267
|
+
client.export_storage.s3.validate()
|
|
268
|
+
"""
|
|
269
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
270
|
+
"api/storages/export/s3/validate",
|
|
271
|
+
method="POST",
|
|
272
|
+
json={
|
|
273
|
+
"aws_access_key_id": aws_access_key_id,
|
|
274
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
275
|
+
"aws_session_token": aws_session_token,
|
|
276
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
277
|
+
"bucket": bucket,
|
|
278
|
+
"can_delete_objects": can_delete_objects,
|
|
279
|
+
"description": description,
|
|
280
|
+
"id": id,
|
|
281
|
+
"prefix": prefix,
|
|
282
|
+
"project": project,
|
|
283
|
+
"region_name": region_name,
|
|
284
|
+
"s3_endpoint": s3endpoint,
|
|
285
|
+
"title": title,
|
|
286
|
+
},
|
|
287
|
+
headers={
|
|
288
|
+
"content-type": "application/json",
|
|
289
|
+
},
|
|
290
|
+
request_options=request_options,
|
|
291
|
+
omit=OMIT,
|
|
292
|
+
)
|
|
293
|
+
try:
|
|
294
|
+
if 200 <= _response.status_code < 300:
|
|
295
|
+
return
|
|
296
|
+
_response_json = _response.json()
|
|
297
|
+
except JSONDecodeError:
|
|
298
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
299
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
300
|
+
|
|
191
301
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
|
|
192
302
|
"""
|
|
193
303
|
Get a specific S3 export storage connection.
|
|
@@ -277,18 +387,18 @@ class S3Client:
|
|
|
277
387
|
self,
|
|
278
388
|
id: int,
|
|
279
389
|
*,
|
|
280
|
-
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
281
|
-
title: typing.Optional[str] = OMIT,
|
|
282
|
-
description: typing.Optional[str] = OMIT,
|
|
283
|
-
project: typing.Optional[int] = OMIT,
|
|
284
|
-
bucket: typing.Optional[str] = OMIT,
|
|
285
|
-
prefix: typing.Optional[str] = OMIT,
|
|
286
390
|
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
287
391
|
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
288
392
|
aws_session_token: typing.Optional[str] = OMIT,
|
|
289
393
|
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
394
|
+
bucket: typing.Optional[str] = OMIT,
|
|
395
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
396
|
+
description: typing.Optional[str] = OMIT,
|
|
397
|
+
prefix: typing.Optional[str] = OMIT,
|
|
398
|
+
project: typing.Optional[int] = OMIT,
|
|
290
399
|
region_name: typing.Optional[str] = OMIT,
|
|
291
400
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
401
|
+
title: typing.Optional[str] = OMIT,
|
|
292
402
|
request_options: typing.Optional[RequestOptions] = None,
|
|
293
403
|
) -> S3ExportStorage:
|
|
294
404
|
"""
|
|
@@ -298,24 +408,6 @@ class S3Client:
|
|
|
298
408
|
----------
|
|
299
409
|
id : int
|
|
300
410
|
|
|
301
|
-
can_delete_objects : typing.Optional[bool]
|
|
302
|
-
Deletion from storage enabled.
|
|
303
|
-
|
|
304
|
-
title : typing.Optional[str]
|
|
305
|
-
Storage title
|
|
306
|
-
|
|
307
|
-
description : typing.Optional[str]
|
|
308
|
-
Storage description
|
|
309
|
-
|
|
310
|
-
project : typing.Optional[int]
|
|
311
|
-
Project ID
|
|
312
|
-
|
|
313
|
-
bucket : typing.Optional[str]
|
|
314
|
-
S3 bucket name
|
|
315
|
-
|
|
316
|
-
prefix : typing.Optional[str]
|
|
317
|
-
S3 bucket prefix
|
|
318
|
-
|
|
319
411
|
aws_access_key_id : typing.Optional[str]
|
|
320
412
|
AWS_ACCESS_KEY_ID
|
|
321
413
|
|
|
@@ -328,12 +420,30 @@ class S3Client:
|
|
|
328
420
|
aws_sse_kms_key_id : typing.Optional[str]
|
|
329
421
|
AWS SSE KMS Key ID
|
|
330
422
|
|
|
423
|
+
bucket : typing.Optional[str]
|
|
424
|
+
S3 bucket name
|
|
425
|
+
|
|
426
|
+
can_delete_objects : typing.Optional[bool]
|
|
427
|
+
Deletion from storage enabled.
|
|
428
|
+
|
|
429
|
+
description : typing.Optional[str]
|
|
430
|
+
Storage description
|
|
431
|
+
|
|
432
|
+
prefix : typing.Optional[str]
|
|
433
|
+
S3 bucket prefix
|
|
434
|
+
|
|
435
|
+
project : typing.Optional[int]
|
|
436
|
+
Project ID
|
|
437
|
+
|
|
331
438
|
region_name : typing.Optional[str]
|
|
332
439
|
AWS Region
|
|
333
440
|
|
|
334
441
|
s3endpoint : typing.Optional[str]
|
|
335
442
|
S3 Endpoint
|
|
336
443
|
|
|
444
|
+
title : typing.Optional[str]
|
|
445
|
+
Storage title
|
|
446
|
+
|
|
337
447
|
request_options : typing.Optional[RequestOptions]
|
|
338
448
|
Request-specific configuration.
|
|
339
449
|
|
|
@@ -357,18 +467,18 @@ class S3Client:
|
|
|
357
467
|
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
358
468
|
method="PATCH",
|
|
359
469
|
json={
|
|
360
|
-
"can_delete_objects": can_delete_objects,
|
|
361
|
-
"title": title,
|
|
362
|
-
"description": description,
|
|
363
|
-
"project": project,
|
|
364
|
-
"bucket": bucket,
|
|
365
|
-
"prefix": prefix,
|
|
366
470
|
"aws_access_key_id": aws_access_key_id,
|
|
367
471
|
"aws_secret_access_key": aws_secret_access_key,
|
|
368
472
|
"aws_session_token": aws_session_token,
|
|
369
473
|
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
474
|
+
"bucket": bucket,
|
|
475
|
+
"can_delete_objects": can_delete_objects,
|
|
476
|
+
"description": description,
|
|
477
|
+
"prefix": prefix,
|
|
478
|
+
"project": project,
|
|
370
479
|
"region_name": region_name,
|
|
371
480
|
"s3_endpoint": s3endpoint,
|
|
481
|
+
"title": title,
|
|
372
482
|
},
|
|
373
483
|
headers={
|
|
374
484
|
"content-type": "application/json",
|
|
@@ -436,145 +546,141 @@ class S3Client:
|
|
|
436
546
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
437
547
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
438
548
|
|
|
439
|
-
|
|
549
|
+
|
|
550
|
+
class AsyncS3Client:
|
|
551
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
552
|
+
self._client_wrapper = client_wrapper
|
|
553
|
+
|
|
554
|
+
async def list(
|
|
440
555
|
self,
|
|
441
556
|
*,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
title: typing.Optional[str] = OMIT,
|
|
445
|
-
description: typing.Optional[str] = OMIT,
|
|
446
|
-
project: typing.Optional[int] = OMIT,
|
|
447
|
-
bucket: typing.Optional[str] = OMIT,
|
|
448
|
-
prefix: typing.Optional[str] = OMIT,
|
|
449
|
-
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
450
|
-
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
451
|
-
aws_session_token: typing.Optional[str] = OMIT,
|
|
452
|
-
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
453
|
-
region_name: typing.Optional[str] = OMIT,
|
|
454
|
-
s3endpoint: typing.Optional[str] = OMIT,
|
|
557
|
+
ordering: typing.Optional[str] = None,
|
|
558
|
+
project: typing.Optional[int] = None,
|
|
455
559
|
request_options: typing.Optional[RequestOptions] = None,
|
|
456
|
-
) ->
|
|
560
|
+
) -> typing.List[S3ExportStorage]:
|
|
457
561
|
"""
|
|
458
|
-
|
|
562
|
+
Get a list of all S3 export storage connections.
|
|
459
563
|
|
|
460
564
|
Parameters
|
|
461
565
|
----------
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
can_delete_objects : typing.Optional[bool]
|
|
466
|
-
Deletion from storage enabled.
|
|
467
|
-
|
|
468
|
-
title : typing.Optional[str]
|
|
469
|
-
Storage title
|
|
470
|
-
|
|
471
|
-
description : typing.Optional[str]
|
|
472
|
-
Storage description
|
|
566
|
+
ordering : typing.Optional[str]
|
|
567
|
+
Which field to use when ordering the results.
|
|
473
568
|
|
|
474
569
|
project : typing.Optional[int]
|
|
475
570
|
Project ID
|
|
476
571
|
|
|
477
|
-
bucket : typing.Optional[str]
|
|
478
|
-
S3 bucket name
|
|
479
|
-
|
|
480
|
-
prefix : typing.Optional[str]
|
|
481
|
-
S3 bucket prefix
|
|
482
|
-
|
|
483
|
-
aws_access_key_id : typing.Optional[str]
|
|
484
|
-
AWS_ACCESS_KEY_ID
|
|
485
|
-
|
|
486
|
-
aws_secret_access_key : typing.Optional[str]
|
|
487
|
-
AWS_SECRET_ACCESS_KEY
|
|
488
|
-
|
|
489
|
-
aws_session_token : typing.Optional[str]
|
|
490
|
-
AWS_SESSION_TOKEN
|
|
491
|
-
|
|
492
|
-
aws_sse_kms_key_id : typing.Optional[str]
|
|
493
|
-
AWS SSE KMS Key ID
|
|
494
|
-
|
|
495
|
-
region_name : typing.Optional[str]
|
|
496
|
-
AWS Region
|
|
497
|
-
|
|
498
|
-
s3endpoint : typing.Optional[str]
|
|
499
|
-
S3 Endpoint
|
|
500
|
-
|
|
501
572
|
request_options : typing.Optional[RequestOptions]
|
|
502
573
|
Request-specific configuration.
|
|
503
574
|
|
|
504
575
|
Returns
|
|
505
576
|
-------
|
|
506
|
-
|
|
577
|
+
typing.List[S3ExportStorage]
|
|
578
|
+
|
|
507
579
|
|
|
508
580
|
Examples
|
|
509
581
|
--------
|
|
510
|
-
|
|
582
|
+
import asyncio
|
|
511
583
|
|
|
512
|
-
|
|
584
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
585
|
+
|
|
586
|
+
client = AsyncLabelStudio(
|
|
513
587
|
api_key="YOUR_API_KEY",
|
|
514
588
|
)
|
|
515
|
-
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
async def main() -> None:
|
|
592
|
+
await client.export_storage.s3.list()
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
asyncio.run(main())
|
|
516
596
|
"""
|
|
517
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
518
|
-
"api/storages/export/s3
|
|
519
|
-
method="
|
|
520
|
-
|
|
521
|
-
"
|
|
522
|
-
"can_delete_objects": can_delete_objects,
|
|
523
|
-
"title": title,
|
|
524
|
-
"description": description,
|
|
597
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
598
|
+
"api/storages/export/s3",
|
|
599
|
+
method="GET",
|
|
600
|
+
params={
|
|
601
|
+
"ordering": ordering,
|
|
525
602
|
"project": project,
|
|
526
|
-
"bucket": bucket,
|
|
527
|
-
"prefix": prefix,
|
|
528
|
-
"aws_access_key_id": aws_access_key_id,
|
|
529
|
-
"aws_secret_access_key": aws_secret_access_key,
|
|
530
|
-
"aws_session_token": aws_session_token,
|
|
531
|
-
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
532
|
-
"region_name": region_name,
|
|
533
|
-
"s3_endpoint": s3endpoint,
|
|
534
|
-
},
|
|
535
|
-
headers={
|
|
536
|
-
"content-type": "application/json",
|
|
537
603
|
},
|
|
538
604
|
request_options=request_options,
|
|
539
|
-
omit=OMIT,
|
|
540
605
|
)
|
|
541
606
|
try:
|
|
542
607
|
if 200 <= _response.status_code < 300:
|
|
543
|
-
return
|
|
608
|
+
return typing.cast(
|
|
609
|
+
typing.List[S3ExportStorage],
|
|
610
|
+
construct_type(
|
|
611
|
+
type_=typing.List[S3ExportStorage], # type: ignore
|
|
612
|
+
object_=_response.json(),
|
|
613
|
+
),
|
|
614
|
+
)
|
|
544
615
|
_response_json = _response.json()
|
|
545
616
|
except JSONDecodeError:
|
|
546
617
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
547
618
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
548
619
|
|
|
549
|
-
|
|
550
|
-
class AsyncS3Client:
|
|
551
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
552
|
-
self._client_wrapper = client_wrapper
|
|
553
|
-
|
|
554
|
-
async def list(
|
|
620
|
+
async def create(
|
|
555
621
|
self,
|
|
556
622
|
*,
|
|
557
|
-
|
|
558
|
-
|
|
623
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
624
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
625
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
626
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
627
|
+
bucket: typing.Optional[str] = OMIT,
|
|
628
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
629
|
+
description: typing.Optional[str] = OMIT,
|
|
630
|
+
prefix: typing.Optional[str] = OMIT,
|
|
631
|
+
project: typing.Optional[int] = OMIT,
|
|
632
|
+
region_name: typing.Optional[str] = OMIT,
|
|
633
|
+
s3endpoint: typing.Optional[str] = OMIT,
|
|
634
|
+
title: typing.Optional[str] = OMIT,
|
|
559
635
|
request_options: typing.Optional[RequestOptions] = None,
|
|
560
|
-
) ->
|
|
636
|
+
) -> S3ExportStorage:
|
|
561
637
|
"""
|
|
562
|
-
|
|
638
|
+
Create a new S3 export storage connection to store annotations.
|
|
563
639
|
|
|
564
640
|
Parameters
|
|
565
641
|
----------
|
|
566
|
-
|
|
567
|
-
|
|
642
|
+
aws_access_key_id : typing.Optional[str]
|
|
643
|
+
AWS_ACCESS_KEY_ID
|
|
644
|
+
|
|
645
|
+
aws_secret_access_key : typing.Optional[str]
|
|
646
|
+
AWS_SECRET_ACCESS_KEY
|
|
647
|
+
|
|
648
|
+
aws_session_token : typing.Optional[str]
|
|
649
|
+
AWS_SESSION_TOKEN
|
|
650
|
+
|
|
651
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
652
|
+
AWS SSE KMS Key ID
|
|
653
|
+
|
|
654
|
+
bucket : typing.Optional[str]
|
|
655
|
+
S3 bucket name
|
|
656
|
+
|
|
657
|
+
can_delete_objects : typing.Optional[bool]
|
|
658
|
+
Deletion from storage enabled.
|
|
659
|
+
|
|
660
|
+
description : typing.Optional[str]
|
|
661
|
+
Storage description
|
|
662
|
+
|
|
663
|
+
prefix : typing.Optional[str]
|
|
664
|
+
S3 bucket prefix
|
|
568
665
|
|
|
569
666
|
project : typing.Optional[int]
|
|
570
667
|
Project ID
|
|
571
668
|
|
|
669
|
+
region_name : typing.Optional[str]
|
|
670
|
+
AWS Region
|
|
671
|
+
|
|
672
|
+
s3endpoint : typing.Optional[str]
|
|
673
|
+
S3 Endpoint
|
|
674
|
+
|
|
675
|
+
title : typing.Optional[str]
|
|
676
|
+
Storage title
|
|
677
|
+
|
|
572
678
|
request_options : typing.Optional[RequestOptions]
|
|
573
679
|
Request-specific configuration.
|
|
574
680
|
|
|
575
681
|
Returns
|
|
576
682
|
-------
|
|
577
|
-
|
|
683
|
+
S3ExportStorage
|
|
578
684
|
|
|
579
685
|
|
|
580
686
|
Examples
|
|
@@ -589,26 +695,40 @@ class AsyncS3Client:
|
|
|
589
695
|
|
|
590
696
|
|
|
591
697
|
async def main() -> None:
|
|
592
|
-
await client.export_storage.s3.
|
|
698
|
+
await client.export_storage.s3.create()
|
|
593
699
|
|
|
594
700
|
|
|
595
701
|
asyncio.run(main())
|
|
596
702
|
"""
|
|
597
703
|
_response = await self._client_wrapper.httpx_client.request(
|
|
598
704
|
"api/storages/export/s3",
|
|
599
|
-
method="
|
|
600
|
-
|
|
601
|
-
"
|
|
705
|
+
method="POST",
|
|
706
|
+
json={
|
|
707
|
+
"aws_access_key_id": aws_access_key_id,
|
|
708
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
709
|
+
"aws_session_token": aws_session_token,
|
|
710
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
711
|
+
"bucket": bucket,
|
|
712
|
+
"can_delete_objects": can_delete_objects,
|
|
713
|
+
"description": description,
|
|
714
|
+
"prefix": prefix,
|
|
602
715
|
"project": project,
|
|
716
|
+
"region_name": region_name,
|
|
717
|
+
"s3_endpoint": s3endpoint,
|
|
718
|
+
"title": title,
|
|
719
|
+
},
|
|
720
|
+
headers={
|
|
721
|
+
"content-type": "application/json",
|
|
603
722
|
},
|
|
604
723
|
request_options=request_options,
|
|
724
|
+
omit=OMIT,
|
|
605
725
|
)
|
|
606
726
|
try:
|
|
607
727
|
if 200 <= _response.status_code < 300:
|
|
608
728
|
return typing.cast(
|
|
609
|
-
|
|
729
|
+
S3ExportStorage,
|
|
610
730
|
construct_type(
|
|
611
|
-
type_=
|
|
731
|
+
type_=S3ExportStorage, # type: ignore
|
|
612
732
|
object_=_response.json(),
|
|
613
733
|
),
|
|
614
734
|
)
|
|
@@ -617,46 +737,29 @@ class AsyncS3Client:
|
|
|
617
737
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
618
738
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
619
739
|
|
|
620
|
-
async def
|
|
740
|
+
async def validate(
|
|
621
741
|
self,
|
|
622
742
|
*,
|
|
623
|
-
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
624
|
-
title: typing.Optional[str] = OMIT,
|
|
625
|
-
description: typing.Optional[str] = OMIT,
|
|
626
|
-
project: typing.Optional[int] = OMIT,
|
|
627
|
-
bucket: typing.Optional[str] = OMIT,
|
|
628
|
-
prefix: typing.Optional[str] = OMIT,
|
|
629
743
|
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
630
744
|
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
631
745
|
aws_session_token: typing.Optional[str] = OMIT,
|
|
632
746
|
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
747
|
+
bucket: typing.Optional[str] = OMIT,
|
|
748
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
749
|
+
description: typing.Optional[str] = OMIT,
|
|
750
|
+
id: typing.Optional[int] = OMIT,
|
|
751
|
+
prefix: typing.Optional[str] = OMIT,
|
|
752
|
+
project: typing.Optional[int] = OMIT,
|
|
633
753
|
region_name: typing.Optional[str] = OMIT,
|
|
634
754
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
755
|
+
title: typing.Optional[str] = OMIT,
|
|
635
756
|
request_options: typing.Optional[RequestOptions] = None,
|
|
636
|
-
) ->
|
|
757
|
+
) -> None:
|
|
637
758
|
"""
|
|
638
|
-
|
|
759
|
+
Validate a specific S3 export storage connection.
|
|
639
760
|
|
|
640
761
|
Parameters
|
|
641
762
|
----------
|
|
642
|
-
can_delete_objects : typing.Optional[bool]
|
|
643
|
-
Deletion from storage enabled.
|
|
644
|
-
|
|
645
|
-
title : typing.Optional[str]
|
|
646
|
-
Storage title
|
|
647
|
-
|
|
648
|
-
description : typing.Optional[str]
|
|
649
|
-
Storage description
|
|
650
|
-
|
|
651
|
-
project : typing.Optional[int]
|
|
652
|
-
Project ID
|
|
653
|
-
|
|
654
|
-
bucket : typing.Optional[str]
|
|
655
|
-
S3 bucket name
|
|
656
|
-
|
|
657
|
-
prefix : typing.Optional[str]
|
|
658
|
-
S3 bucket prefix
|
|
659
|
-
|
|
660
763
|
aws_access_key_id : typing.Optional[str]
|
|
661
764
|
AWS_ACCESS_KEY_ID
|
|
662
765
|
|
|
@@ -669,19 +772,39 @@ class AsyncS3Client:
|
|
|
669
772
|
aws_sse_kms_key_id : typing.Optional[str]
|
|
670
773
|
AWS SSE KMS Key ID
|
|
671
774
|
|
|
775
|
+
bucket : typing.Optional[str]
|
|
776
|
+
S3 bucket name
|
|
777
|
+
|
|
778
|
+
can_delete_objects : typing.Optional[bool]
|
|
779
|
+
Deletion from storage enabled.
|
|
780
|
+
|
|
781
|
+
description : typing.Optional[str]
|
|
782
|
+
Storage description
|
|
783
|
+
|
|
784
|
+
id : typing.Optional[int]
|
|
785
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
786
|
+
|
|
787
|
+
prefix : typing.Optional[str]
|
|
788
|
+
S3 bucket prefix
|
|
789
|
+
|
|
790
|
+
project : typing.Optional[int]
|
|
791
|
+
Project ID
|
|
792
|
+
|
|
672
793
|
region_name : typing.Optional[str]
|
|
673
794
|
AWS Region
|
|
674
795
|
|
|
675
796
|
s3endpoint : typing.Optional[str]
|
|
676
797
|
S3 Endpoint
|
|
677
798
|
|
|
799
|
+
title : typing.Optional[str]
|
|
800
|
+
Storage title
|
|
801
|
+
|
|
678
802
|
request_options : typing.Optional[RequestOptions]
|
|
679
803
|
Request-specific configuration.
|
|
680
804
|
|
|
681
805
|
Returns
|
|
682
806
|
-------
|
|
683
|
-
|
|
684
|
-
|
|
807
|
+
None
|
|
685
808
|
|
|
686
809
|
Examples
|
|
687
810
|
--------
|
|
@@ -695,27 +818,28 @@ class AsyncS3Client:
|
|
|
695
818
|
|
|
696
819
|
|
|
697
820
|
async def main() -> None:
|
|
698
|
-
await client.export_storage.s3.
|
|
821
|
+
await client.export_storage.s3.validate()
|
|
699
822
|
|
|
700
823
|
|
|
701
824
|
asyncio.run(main())
|
|
702
825
|
"""
|
|
703
826
|
_response = await self._client_wrapper.httpx_client.request(
|
|
704
|
-
"api/storages/export/s3",
|
|
827
|
+
"api/storages/export/s3/validate",
|
|
705
828
|
method="POST",
|
|
706
829
|
json={
|
|
707
|
-
"can_delete_objects": can_delete_objects,
|
|
708
|
-
"title": title,
|
|
709
|
-
"description": description,
|
|
710
|
-
"project": project,
|
|
711
|
-
"bucket": bucket,
|
|
712
|
-
"prefix": prefix,
|
|
713
830
|
"aws_access_key_id": aws_access_key_id,
|
|
714
831
|
"aws_secret_access_key": aws_secret_access_key,
|
|
715
832
|
"aws_session_token": aws_session_token,
|
|
716
833
|
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
834
|
+
"bucket": bucket,
|
|
835
|
+
"can_delete_objects": can_delete_objects,
|
|
836
|
+
"description": description,
|
|
837
|
+
"id": id,
|
|
838
|
+
"prefix": prefix,
|
|
839
|
+
"project": project,
|
|
717
840
|
"region_name": region_name,
|
|
718
841
|
"s3_endpoint": s3endpoint,
|
|
842
|
+
"title": title,
|
|
719
843
|
},
|
|
720
844
|
headers={
|
|
721
845
|
"content-type": "application/json",
|
|
@@ -725,13 +849,7 @@ class AsyncS3Client:
|
|
|
725
849
|
)
|
|
726
850
|
try:
|
|
727
851
|
if 200 <= _response.status_code < 300:
|
|
728
|
-
return
|
|
729
|
-
S3ExportStorage,
|
|
730
|
-
construct_type(
|
|
731
|
-
type_=S3ExportStorage, # type: ignore
|
|
732
|
-
object_=_response.json(),
|
|
733
|
-
),
|
|
734
|
-
)
|
|
852
|
+
return
|
|
735
853
|
_response_json = _response.json()
|
|
736
854
|
except JSONDecodeError:
|
|
737
855
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -842,18 +960,18 @@ class AsyncS3Client:
|
|
|
842
960
|
self,
|
|
843
961
|
id: int,
|
|
844
962
|
*,
|
|
845
|
-
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
846
|
-
title: typing.Optional[str] = OMIT,
|
|
847
|
-
description: typing.Optional[str] = OMIT,
|
|
848
|
-
project: typing.Optional[int] = OMIT,
|
|
849
|
-
bucket: typing.Optional[str] = OMIT,
|
|
850
|
-
prefix: typing.Optional[str] = OMIT,
|
|
851
963
|
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
852
964
|
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
853
965
|
aws_session_token: typing.Optional[str] = OMIT,
|
|
854
966
|
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
967
|
+
bucket: typing.Optional[str] = OMIT,
|
|
968
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
969
|
+
description: typing.Optional[str] = OMIT,
|
|
970
|
+
prefix: typing.Optional[str] = OMIT,
|
|
971
|
+
project: typing.Optional[int] = OMIT,
|
|
855
972
|
region_name: typing.Optional[str] = OMIT,
|
|
856
973
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
974
|
+
title: typing.Optional[str] = OMIT,
|
|
857
975
|
request_options: typing.Optional[RequestOptions] = None,
|
|
858
976
|
) -> S3ExportStorage:
|
|
859
977
|
"""
|
|
@@ -863,24 +981,6 @@ class AsyncS3Client:
|
|
|
863
981
|
----------
|
|
864
982
|
id : int
|
|
865
983
|
|
|
866
|
-
can_delete_objects : typing.Optional[bool]
|
|
867
|
-
Deletion from storage enabled.
|
|
868
|
-
|
|
869
|
-
title : typing.Optional[str]
|
|
870
|
-
Storage title
|
|
871
|
-
|
|
872
|
-
description : typing.Optional[str]
|
|
873
|
-
Storage description
|
|
874
|
-
|
|
875
|
-
project : typing.Optional[int]
|
|
876
|
-
Project ID
|
|
877
|
-
|
|
878
|
-
bucket : typing.Optional[str]
|
|
879
|
-
S3 bucket name
|
|
880
|
-
|
|
881
|
-
prefix : typing.Optional[str]
|
|
882
|
-
S3 bucket prefix
|
|
883
|
-
|
|
884
984
|
aws_access_key_id : typing.Optional[str]
|
|
885
985
|
AWS_ACCESS_KEY_ID
|
|
886
986
|
|
|
@@ -893,12 +993,30 @@ class AsyncS3Client:
|
|
|
893
993
|
aws_sse_kms_key_id : typing.Optional[str]
|
|
894
994
|
AWS SSE KMS Key ID
|
|
895
995
|
|
|
996
|
+
bucket : typing.Optional[str]
|
|
997
|
+
S3 bucket name
|
|
998
|
+
|
|
999
|
+
can_delete_objects : typing.Optional[bool]
|
|
1000
|
+
Deletion from storage enabled.
|
|
1001
|
+
|
|
1002
|
+
description : typing.Optional[str]
|
|
1003
|
+
Storage description
|
|
1004
|
+
|
|
1005
|
+
prefix : typing.Optional[str]
|
|
1006
|
+
S3 bucket prefix
|
|
1007
|
+
|
|
1008
|
+
project : typing.Optional[int]
|
|
1009
|
+
Project ID
|
|
1010
|
+
|
|
896
1011
|
region_name : typing.Optional[str]
|
|
897
1012
|
AWS Region
|
|
898
1013
|
|
|
899
1014
|
s3endpoint : typing.Optional[str]
|
|
900
1015
|
S3 Endpoint
|
|
901
1016
|
|
|
1017
|
+
title : typing.Optional[str]
|
|
1018
|
+
Storage title
|
|
1019
|
+
|
|
902
1020
|
request_options : typing.Optional[RequestOptions]
|
|
903
1021
|
Request-specific configuration.
|
|
904
1022
|
|
|
@@ -930,18 +1048,18 @@ class AsyncS3Client:
|
|
|
930
1048
|
f"api/storages/export/s3/{jsonable_encoder(id)}",
|
|
931
1049
|
method="PATCH",
|
|
932
1050
|
json={
|
|
933
|
-
"can_delete_objects": can_delete_objects,
|
|
934
|
-
"title": title,
|
|
935
|
-
"description": description,
|
|
936
|
-
"project": project,
|
|
937
|
-
"bucket": bucket,
|
|
938
|
-
"prefix": prefix,
|
|
939
1051
|
"aws_access_key_id": aws_access_key_id,
|
|
940
1052
|
"aws_secret_access_key": aws_secret_access_key,
|
|
941
1053
|
"aws_session_token": aws_session_token,
|
|
942
1054
|
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
1055
|
+
"bucket": bucket,
|
|
1056
|
+
"can_delete_objects": can_delete_objects,
|
|
1057
|
+
"description": description,
|
|
1058
|
+
"prefix": prefix,
|
|
1059
|
+
"project": project,
|
|
943
1060
|
"region_name": region_name,
|
|
944
1061
|
"s3_endpoint": s3endpoint,
|
|
1062
|
+
"title": title,
|
|
945
1063
|
},
|
|
946
1064
|
headers={
|
|
947
1065
|
"content-type": "application/json",
|
|
@@ -1016,121 +1134,3 @@ class AsyncS3Client:
|
|
|
1016
1134
|
except JSONDecodeError:
|
|
1017
1135
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1018
1136
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1019
|
-
|
|
1020
|
-
async def validate(
|
|
1021
|
-
self,
|
|
1022
|
-
*,
|
|
1023
|
-
id: typing.Optional[int] = OMIT,
|
|
1024
|
-
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
1025
|
-
title: typing.Optional[str] = OMIT,
|
|
1026
|
-
description: typing.Optional[str] = OMIT,
|
|
1027
|
-
project: typing.Optional[int] = OMIT,
|
|
1028
|
-
bucket: typing.Optional[str] = OMIT,
|
|
1029
|
-
prefix: typing.Optional[str] = OMIT,
|
|
1030
|
-
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
1031
|
-
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
1032
|
-
aws_session_token: typing.Optional[str] = OMIT,
|
|
1033
|
-
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
1034
|
-
region_name: typing.Optional[str] = OMIT,
|
|
1035
|
-
s3endpoint: typing.Optional[str] = OMIT,
|
|
1036
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1037
|
-
) -> None:
|
|
1038
|
-
"""
|
|
1039
|
-
Validate a specific S3 export storage connection.
|
|
1040
|
-
|
|
1041
|
-
Parameters
|
|
1042
|
-
----------
|
|
1043
|
-
id : typing.Optional[int]
|
|
1044
|
-
Storage ID. If set, storage with specified ID will be updated
|
|
1045
|
-
|
|
1046
|
-
can_delete_objects : typing.Optional[bool]
|
|
1047
|
-
Deletion from storage enabled.
|
|
1048
|
-
|
|
1049
|
-
title : typing.Optional[str]
|
|
1050
|
-
Storage title
|
|
1051
|
-
|
|
1052
|
-
description : typing.Optional[str]
|
|
1053
|
-
Storage description
|
|
1054
|
-
|
|
1055
|
-
project : typing.Optional[int]
|
|
1056
|
-
Project ID
|
|
1057
|
-
|
|
1058
|
-
bucket : typing.Optional[str]
|
|
1059
|
-
S3 bucket name
|
|
1060
|
-
|
|
1061
|
-
prefix : typing.Optional[str]
|
|
1062
|
-
S3 bucket prefix
|
|
1063
|
-
|
|
1064
|
-
aws_access_key_id : typing.Optional[str]
|
|
1065
|
-
AWS_ACCESS_KEY_ID
|
|
1066
|
-
|
|
1067
|
-
aws_secret_access_key : typing.Optional[str]
|
|
1068
|
-
AWS_SECRET_ACCESS_KEY
|
|
1069
|
-
|
|
1070
|
-
aws_session_token : typing.Optional[str]
|
|
1071
|
-
AWS_SESSION_TOKEN
|
|
1072
|
-
|
|
1073
|
-
aws_sse_kms_key_id : typing.Optional[str]
|
|
1074
|
-
AWS SSE KMS Key ID
|
|
1075
|
-
|
|
1076
|
-
region_name : typing.Optional[str]
|
|
1077
|
-
AWS Region
|
|
1078
|
-
|
|
1079
|
-
s3endpoint : typing.Optional[str]
|
|
1080
|
-
S3 Endpoint
|
|
1081
|
-
|
|
1082
|
-
request_options : typing.Optional[RequestOptions]
|
|
1083
|
-
Request-specific configuration.
|
|
1084
|
-
|
|
1085
|
-
Returns
|
|
1086
|
-
-------
|
|
1087
|
-
None
|
|
1088
|
-
|
|
1089
|
-
Examples
|
|
1090
|
-
--------
|
|
1091
|
-
import asyncio
|
|
1092
|
-
|
|
1093
|
-
from label_studio_sdk import AsyncLabelStudio
|
|
1094
|
-
|
|
1095
|
-
client = AsyncLabelStudio(
|
|
1096
|
-
api_key="YOUR_API_KEY",
|
|
1097
|
-
)
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
async def main() -> None:
|
|
1101
|
-
await client.export_storage.s3.validate()
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
asyncio.run(main())
|
|
1105
|
-
"""
|
|
1106
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1107
|
-
"api/storages/export/s3/validate",
|
|
1108
|
-
method="POST",
|
|
1109
|
-
json={
|
|
1110
|
-
"id": id,
|
|
1111
|
-
"can_delete_objects": can_delete_objects,
|
|
1112
|
-
"title": title,
|
|
1113
|
-
"description": description,
|
|
1114
|
-
"project": project,
|
|
1115
|
-
"bucket": bucket,
|
|
1116
|
-
"prefix": prefix,
|
|
1117
|
-
"aws_access_key_id": aws_access_key_id,
|
|
1118
|
-
"aws_secret_access_key": aws_secret_access_key,
|
|
1119
|
-
"aws_session_token": aws_session_token,
|
|
1120
|
-
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
1121
|
-
"region_name": region_name,
|
|
1122
|
-
"s3_endpoint": s3endpoint,
|
|
1123
|
-
},
|
|
1124
|
-
headers={
|
|
1125
|
-
"content-type": "application/json",
|
|
1126
|
-
},
|
|
1127
|
-
request_options=request_options,
|
|
1128
|
-
omit=OMIT,
|
|
1129
|
-
)
|
|
1130
|
-
try:
|
|
1131
|
-
if 200 <= _response.status_code < 300:
|
|
1132
|
-
return
|
|
1133
|
-
_response_json = _response.json()
|
|
1134
|
-
except JSONDecodeError:
|
|
1135
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1136
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|