label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.6__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 (72) hide show
  1. label_studio_sdk/__init__.py +52 -0
  2. label_studio_sdk/annotation_history/__init__.py +5 -0
  3. label_studio_sdk/annotation_history/client.py +415 -0
  4. label_studio_sdk/annotation_history/types/__init__.py +5 -0
  5. label_studio_sdk/annotation_history/types/annotation_history_delete_response.py +22 -0
  6. label_studio_sdk/annotation_reviews/__init__.py +2 -0
  7. label_studio_sdk/annotation_reviews/client.py +713 -0
  8. label_studio_sdk/base_client.py +16 -0
  9. label_studio_sdk/blueprints/__init__.py +2 -0
  10. label_studio_sdk/blueprints/client.py +272 -0
  11. label_studio_sdk/core/client_wrapper.py +2 -1
  12. label_studio_sdk/export_storage/__init__.py +2 -2
  13. label_studio_sdk/export_storage/azure_spi/__init__.py +2 -0
  14. label_studio_sdk/export_storage/azure_spi/client.py +1354 -0
  15. label_studio_sdk/export_storage/client.py +8 -0
  16. label_studio_sdk/export_storage/gcswif/__init__.py +2 -0
  17. label_studio_sdk/export_storage/gcswif/client.py +1376 -0
  18. label_studio_sdk/import_storage/__init__.py +2 -2
  19. label_studio_sdk/import_storage/azure_spi/__init__.py +2 -0
  20. label_studio_sdk/import_storage/azure_spi/client.py +1378 -0
  21. label_studio_sdk/import_storage/client.py +8 -0
  22. label_studio_sdk/import_storage/gcswif/__init__.py +2 -0
  23. label_studio_sdk/import_storage/gcswif/client.py +1400 -0
  24. label_studio_sdk/jwt_settings/client.py +10 -8
  25. label_studio_sdk/projects/client.py +8 -0
  26. label_studio_sdk/projects/members/__init__.py +2 -2
  27. label_studio_sdk/projects/members/bulk/client.py +46 -2
  28. label_studio_sdk/projects/members/client.py +4 -0
  29. label_studio_sdk/projects/members/paginated/__init__.py +2 -0
  30. label_studio_sdk/projects/members/paginated/client.py +248 -0
  31. label_studio_sdk/session_policy/__init__.py +2 -0
  32. label_studio_sdk/session_policy/client.py +247 -0
  33. label_studio_sdk/tasks/client.py +371 -0
  34. label_studio_sdk/types/__init__.py +42 -0
  35. label_studio_sdk/types/action_enum.py +19 -0
  36. label_studio_sdk/types/all_roles_project_list.py +1 -1
  37. label_studio_sdk/types/annotation.py +7 -0
  38. label_studio_sdk/types/annotation_history.py +81 -0
  39. label_studio_sdk/types/annotation_history_action.py +7 -0
  40. label_studio_sdk/types/annotation_request.py +7 -0
  41. label_studio_sdk/types/annotation_review.py +61 -0
  42. label_studio_sdk/types/annotation_review_request.py +41 -0
  43. label_studio_sdk/types/azure_service_principal_export_storage.py +114 -0
  44. label_studio_sdk/types/azure_service_principal_export_storage_request.py +107 -0
  45. label_studio_sdk/types/azure_service_principal_import_storage.py +115 -0
  46. label_studio_sdk/types/azure_service_principal_import_storage_request.py +108 -0
  47. label_studio_sdk/types/blueprint.py +41 -0
  48. label_studio_sdk/types/gcswif_export_storage.py +119 -0
  49. label_studio_sdk/types/gcswif_export_storage_request.py +112 -0
  50. label_studio_sdk/types/gcswif_import_storage.py +120 -0
  51. label_studio_sdk/types/gcswif_import_storage_request.py +113 -0
  52. label_studio_sdk/types/lse_project_update.py +1 -0
  53. label_studio_sdk/types/lse_task.py +1 -0
  54. label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -0
  55. label_studio_sdk/types/lsejwt_settings.py +1 -5
  56. label_studio_sdk/types/paginated_annotation_history_list.py +23 -0
  57. label_studio_sdk/types/paginated_lse_user_list.py +23 -0
  58. label_studio_sdk/types/paginated_paginated_project_member_list.py +23 -0
  59. label_studio_sdk/types/paginated_project_member.py +50 -0
  60. label_studio_sdk/types/project_member_bulk_assign_roles_request.py +21 -0
  61. label_studio_sdk/types/review_settings.py +5 -0
  62. label_studio_sdk/types/review_settings_request.py +5 -0
  63. label_studio_sdk/types/session_timeout_policy.py +31 -0
  64. label_studio_sdk/types/task_event.py +61 -0
  65. label_studio_sdk/workspaces/members/__init__.py +2 -2
  66. label_studio_sdk/workspaces/members/client.py +4 -0
  67. label_studio_sdk/workspaces/members/paginated/__init__.py +2 -0
  68. label_studio_sdk/workspaces/members/paginated/client.py +212 -0
  69. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/METADATA +2 -2
  70. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/RECORD +72 -29
  71. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/LICENSE +0 -0
  72. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1354 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ...core.client_wrapper import SyncClientWrapper
5
+ from ...core.request_options import RequestOptions
6
+ from ...types.azure_service_principal_export_storage import AzureServicePrincipalExportStorage
7
+ from ...core.unchecked_base_model import construct_type
8
+ from json.decoder import JSONDecodeError
9
+ from ...core.api_error import ApiError
10
+ import datetime as dt
11
+ from ...types.status_c5a_enum import StatusC5AEnum
12
+ from ...core.jsonable_encoder import jsonable_encoder
13
+ from ...core.client_wrapper import AsyncClientWrapper
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class AzureSpiClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def list(
24
+ self,
25
+ *,
26
+ ordering: typing.Optional[str] = None,
27
+ project: typing.Optional[int] = None,
28
+ request_options: typing.Optional[RequestOptions] = None,
29
+ ) -> typing.List[AzureServicePrincipalExportStorage]:
30
+ """
31
+ Get a list of all Azure export storage connections that were set up with Service Principal authentication.
32
+
33
+ Parameters
34
+ ----------
35
+ ordering : typing.Optional[str]
36
+ Which field to use when ordering the results.
37
+
38
+ project : typing.Optional[int]
39
+ Project ID
40
+
41
+ request_options : typing.Optional[RequestOptions]
42
+ Request-specific configuration.
43
+
44
+ Returns
45
+ -------
46
+ typing.List[AzureServicePrincipalExportStorage]
47
+
48
+
49
+ Examples
50
+ --------
51
+ from label_studio_sdk import LabelStudio
52
+
53
+ client = LabelStudio(
54
+ api_key="YOUR_API_KEY",
55
+ )
56
+ client.export_storage.azure_spi.list()
57
+ """
58
+ _response = self._client_wrapper.httpx_client.request(
59
+ "api/storages/export/azure_spi",
60
+ method="GET",
61
+ params={
62
+ "ordering": ordering,
63
+ "project": project,
64
+ },
65
+ request_options=request_options,
66
+ )
67
+ try:
68
+ if 200 <= _response.status_code < 300:
69
+ return typing.cast(
70
+ typing.List[AzureServicePrincipalExportStorage],
71
+ construct_type(
72
+ type_=typing.List[AzureServicePrincipalExportStorage], # type: ignore
73
+ object_=_response.json(),
74
+ ),
75
+ )
76
+ _response_json = _response.json()
77
+ except JSONDecodeError:
78
+ raise ApiError(status_code=_response.status_code, body=_response.text)
79
+ raise ApiError(status_code=_response.status_code, body=_response_json)
80
+
81
+ def create(
82
+ self,
83
+ *,
84
+ project: int,
85
+ account_name: typing.Optional[str] = OMIT,
86
+ can_delete_objects: typing.Optional[bool] = OMIT,
87
+ client_id: typing.Optional[str] = OMIT,
88
+ client_secret: typing.Optional[str] = OMIT,
89
+ container: typing.Optional[str] = OMIT,
90
+ description: typing.Optional[str] = OMIT,
91
+ last_sync: typing.Optional[dt.datetime] = OMIT,
92
+ last_sync_count: typing.Optional[int] = OMIT,
93
+ last_sync_job: typing.Optional[str] = OMIT,
94
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
95
+ prefix: typing.Optional[str] = OMIT,
96
+ regex_filter: typing.Optional[str] = OMIT,
97
+ status: typing.Optional[StatusC5AEnum] = OMIT,
98
+ synchronizable: typing.Optional[bool] = OMIT,
99
+ tenant_id: typing.Optional[str] = OMIT,
100
+ title: typing.Optional[str] = OMIT,
101
+ traceback: typing.Optional[str] = OMIT,
102
+ use_blob_urls: typing.Optional[bool] = OMIT,
103
+ user_delegation_key: typing.Optional[str] = OMIT,
104
+ request_options: typing.Optional[RequestOptions] = None,
105
+ ) -> AzureServicePrincipalExportStorage:
106
+ """
107
+ Create an Azure export storage connection with Service Principal authentication to store annotations.
108
+
109
+ Parameters
110
+ ----------
111
+ project : int
112
+ A unique integer value identifying this project.
113
+
114
+ account_name : typing.Optional[str]
115
+ Azure Blob account name
116
+
117
+ can_delete_objects : typing.Optional[bool]
118
+ Deletion from storage enabled
119
+
120
+ client_id : typing.Optional[str]
121
+ Azure Blob Service Principal Client ID
122
+
123
+ client_secret : typing.Optional[str]
124
+ Azure Blob Service Principal Client Secret
125
+
126
+ container : typing.Optional[str]
127
+ Azure blob container
128
+
129
+ description : typing.Optional[str]
130
+ Cloud storage description
131
+
132
+ last_sync : typing.Optional[dt.datetime]
133
+ Last sync finished time
134
+
135
+ last_sync_count : typing.Optional[int]
136
+ Count of tasks synced last time
137
+
138
+ last_sync_job : typing.Optional[str]
139
+ Last sync job ID
140
+
141
+ meta : typing.Optional[typing.Optional[typing.Any]]
142
+
143
+ prefix : typing.Optional[str]
144
+ Azure blob prefix name
145
+
146
+ regex_filter : typing.Optional[str]
147
+ Cloud storage regex for filtering objects
148
+
149
+ status : typing.Optional[StatusC5AEnum]
150
+
151
+ synchronizable : typing.Optional[bool]
152
+
153
+ tenant_id : typing.Optional[str]
154
+ Azure Tenant ID
155
+
156
+ title : typing.Optional[str]
157
+ Cloud storage title
158
+
159
+ traceback : typing.Optional[str]
160
+ Traceback report for the last failed sync
161
+
162
+ use_blob_urls : typing.Optional[bool]
163
+ Interpret objects as BLOBs and generate URLs
164
+
165
+ user_delegation_key : typing.Optional[str]
166
+ User Delegation Key (Backend)
167
+
168
+ request_options : typing.Optional[RequestOptions]
169
+ Request-specific configuration.
170
+
171
+ Returns
172
+ -------
173
+ AzureServicePrincipalExportStorage
174
+
175
+
176
+ Examples
177
+ --------
178
+ from label_studio_sdk import LabelStudio
179
+
180
+ client = LabelStudio(
181
+ api_key="YOUR_API_KEY",
182
+ )
183
+ client.export_storage.azure_spi.create(
184
+ project=1,
185
+ )
186
+ """
187
+ _response = self._client_wrapper.httpx_client.request(
188
+ "api/storages/export/azure_spi",
189
+ method="POST",
190
+ json={
191
+ "account_name": account_name,
192
+ "can_delete_objects": can_delete_objects,
193
+ "client_id": client_id,
194
+ "client_secret": client_secret,
195
+ "container": container,
196
+ "description": description,
197
+ "last_sync": last_sync,
198
+ "last_sync_count": last_sync_count,
199
+ "last_sync_job": last_sync_job,
200
+ "meta": meta,
201
+ "prefix": prefix,
202
+ "project": project,
203
+ "regex_filter": regex_filter,
204
+ "status": status,
205
+ "synchronizable": synchronizable,
206
+ "tenant_id": tenant_id,
207
+ "title": title,
208
+ "traceback": traceback,
209
+ "use_blob_urls": use_blob_urls,
210
+ "user_delegation_key": user_delegation_key,
211
+ },
212
+ request_options=request_options,
213
+ omit=OMIT,
214
+ )
215
+ try:
216
+ if 200 <= _response.status_code < 300:
217
+ return typing.cast(
218
+ AzureServicePrincipalExportStorage,
219
+ construct_type(
220
+ type_=AzureServicePrincipalExportStorage, # type: ignore
221
+ object_=_response.json(),
222
+ ),
223
+ )
224
+ _response_json = _response.json()
225
+ except JSONDecodeError:
226
+ raise ApiError(status_code=_response.status_code, body=_response.text)
227
+ raise ApiError(status_code=_response.status_code, body=_response_json)
228
+
229
+ def validate(
230
+ self,
231
+ *,
232
+ project: int,
233
+ account_name: typing.Optional[str] = OMIT,
234
+ can_delete_objects: typing.Optional[bool] = OMIT,
235
+ client_id: typing.Optional[str] = OMIT,
236
+ client_secret: typing.Optional[str] = OMIT,
237
+ container: typing.Optional[str] = OMIT,
238
+ description: typing.Optional[str] = OMIT,
239
+ last_sync: typing.Optional[dt.datetime] = OMIT,
240
+ last_sync_count: typing.Optional[int] = OMIT,
241
+ last_sync_job: typing.Optional[str] = OMIT,
242
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
243
+ prefix: typing.Optional[str] = OMIT,
244
+ regex_filter: typing.Optional[str] = OMIT,
245
+ status: typing.Optional[StatusC5AEnum] = OMIT,
246
+ synchronizable: typing.Optional[bool] = OMIT,
247
+ tenant_id: typing.Optional[str] = OMIT,
248
+ title: typing.Optional[str] = OMIT,
249
+ traceback: typing.Optional[str] = OMIT,
250
+ use_blob_urls: typing.Optional[bool] = OMIT,
251
+ user_delegation_key: typing.Optional[str] = OMIT,
252
+ request_options: typing.Optional[RequestOptions] = None,
253
+ ) -> None:
254
+ """
255
+ Validate a specific Azure export storage connection that was set up with Service Principal authentication.
256
+
257
+ Parameters
258
+ ----------
259
+ project : int
260
+ A unique integer value identifying this project.
261
+
262
+ account_name : typing.Optional[str]
263
+ Azure Blob account name
264
+
265
+ can_delete_objects : typing.Optional[bool]
266
+ Deletion from storage enabled
267
+
268
+ client_id : typing.Optional[str]
269
+ Azure Blob Service Principal Client ID
270
+
271
+ client_secret : typing.Optional[str]
272
+ Azure Blob Service Principal Client Secret
273
+
274
+ container : typing.Optional[str]
275
+ Azure blob container
276
+
277
+ description : typing.Optional[str]
278
+ Cloud storage description
279
+
280
+ last_sync : typing.Optional[dt.datetime]
281
+ Last sync finished time
282
+
283
+ last_sync_count : typing.Optional[int]
284
+ Count of tasks synced last time
285
+
286
+ last_sync_job : typing.Optional[str]
287
+ Last sync job ID
288
+
289
+ meta : typing.Optional[typing.Optional[typing.Any]]
290
+
291
+ prefix : typing.Optional[str]
292
+ Azure blob prefix name
293
+
294
+ regex_filter : typing.Optional[str]
295
+ Cloud storage regex for filtering objects
296
+
297
+ status : typing.Optional[StatusC5AEnum]
298
+
299
+ synchronizable : typing.Optional[bool]
300
+
301
+ tenant_id : typing.Optional[str]
302
+ Azure Tenant ID
303
+
304
+ title : typing.Optional[str]
305
+ Cloud storage title
306
+
307
+ traceback : typing.Optional[str]
308
+ Traceback report for the last failed sync
309
+
310
+ use_blob_urls : typing.Optional[bool]
311
+ Interpret objects as BLOBs and generate URLs
312
+
313
+ user_delegation_key : typing.Optional[str]
314
+ User Delegation Key (Backend)
315
+
316
+ request_options : typing.Optional[RequestOptions]
317
+ Request-specific configuration.
318
+
319
+ Returns
320
+ -------
321
+ None
322
+
323
+ Examples
324
+ --------
325
+ from label_studio_sdk import LabelStudio
326
+
327
+ client = LabelStudio(
328
+ api_key="YOUR_API_KEY",
329
+ )
330
+ client.export_storage.azure_spi.validate(
331
+ project=1,
332
+ )
333
+ """
334
+ _response = self._client_wrapper.httpx_client.request(
335
+ "api/storages/export/azure_spi/validate",
336
+ method="POST",
337
+ json={
338
+ "account_name": account_name,
339
+ "can_delete_objects": can_delete_objects,
340
+ "client_id": client_id,
341
+ "client_secret": client_secret,
342
+ "container": container,
343
+ "description": description,
344
+ "last_sync": last_sync,
345
+ "last_sync_count": last_sync_count,
346
+ "last_sync_job": last_sync_job,
347
+ "meta": meta,
348
+ "prefix": prefix,
349
+ "project": project,
350
+ "regex_filter": regex_filter,
351
+ "status": status,
352
+ "synchronizable": synchronizable,
353
+ "tenant_id": tenant_id,
354
+ "title": title,
355
+ "traceback": traceback,
356
+ "use_blob_urls": use_blob_urls,
357
+ "user_delegation_key": user_delegation_key,
358
+ },
359
+ request_options=request_options,
360
+ omit=OMIT,
361
+ )
362
+ try:
363
+ if 200 <= _response.status_code < 300:
364
+ return
365
+ _response_json = _response.json()
366
+ except JSONDecodeError:
367
+ raise ApiError(status_code=_response.status_code, body=_response.text)
368
+ raise ApiError(status_code=_response.status_code, body=_response_json)
369
+
370
+ def get(
371
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
372
+ ) -> AzureServicePrincipalExportStorage:
373
+ """
374
+ Get a specific Azure export storage connection that was set up with Service Principal authentication.
375
+
376
+ Parameters
377
+ ----------
378
+ id : int
379
+
380
+ request_options : typing.Optional[RequestOptions]
381
+ Request-specific configuration.
382
+
383
+ Returns
384
+ -------
385
+ AzureServicePrincipalExportStorage
386
+
387
+
388
+ Examples
389
+ --------
390
+ from label_studio_sdk import LabelStudio
391
+
392
+ client = LabelStudio(
393
+ api_key="YOUR_API_KEY",
394
+ )
395
+ client.export_storage.azure_spi.get(
396
+ id=1,
397
+ )
398
+ """
399
+ _response = self._client_wrapper.httpx_client.request(
400
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
401
+ method="GET",
402
+ request_options=request_options,
403
+ )
404
+ try:
405
+ if 200 <= _response.status_code < 300:
406
+ return typing.cast(
407
+ AzureServicePrincipalExportStorage,
408
+ construct_type(
409
+ type_=AzureServicePrincipalExportStorage, # type: ignore
410
+ object_=_response.json(),
411
+ ),
412
+ )
413
+ _response_json = _response.json()
414
+ except JSONDecodeError:
415
+ raise ApiError(status_code=_response.status_code, body=_response.text)
416
+ raise ApiError(status_code=_response.status_code, body=_response_json)
417
+
418
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
419
+ """
420
+ Delete a specific Azure export storage connection that was set up with Service Principal authentication.
421
+
422
+ Parameters
423
+ ----------
424
+ id : int
425
+
426
+ request_options : typing.Optional[RequestOptions]
427
+ Request-specific configuration.
428
+
429
+ Returns
430
+ -------
431
+ None
432
+
433
+ Examples
434
+ --------
435
+ from label_studio_sdk import LabelStudio
436
+
437
+ client = LabelStudio(
438
+ api_key="YOUR_API_KEY",
439
+ )
440
+ client.export_storage.azure_spi.delete(
441
+ id=1,
442
+ )
443
+ """
444
+ _response = self._client_wrapper.httpx_client.request(
445
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
446
+ method="DELETE",
447
+ request_options=request_options,
448
+ )
449
+ try:
450
+ if 200 <= _response.status_code < 300:
451
+ return
452
+ _response_json = _response.json()
453
+ except JSONDecodeError:
454
+ raise ApiError(status_code=_response.status_code, body=_response.text)
455
+ raise ApiError(status_code=_response.status_code, body=_response_json)
456
+
457
+ def update(
458
+ self,
459
+ id: int,
460
+ *,
461
+ account_name: typing.Optional[str] = OMIT,
462
+ can_delete_objects: typing.Optional[bool] = OMIT,
463
+ client_id: typing.Optional[str] = OMIT,
464
+ client_secret: typing.Optional[str] = OMIT,
465
+ container: typing.Optional[str] = OMIT,
466
+ description: typing.Optional[str] = OMIT,
467
+ last_sync: typing.Optional[dt.datetime] = OMIT,
468
+ last_sync_count: typing.Optional[int] = OMIT,
469
+ last_sync_job: typing.Optional[str] = OMIT,
470
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
471
+ prefix: typing.Optional[str] = OMIT,
472
+ project: typing.Optional[int] = OMIT,
473
+ regex_filter: typing.Optional[str] = OMIT,
474
+ status: typing.Optional[StatusC5AEnum] = OMIT,
475
+ synchronizable: typing.Optional[bool] = OMIT,
476
+ tenant_id: typing.Optional[str] = OMIT,
477
+ title: typing.Optional[str] = OMIT,
478
+ traceback: typing.Optional[str] = OMIT,
479
+ use_blob_urls: typing.Optional[bool] = OMIT,
480
+ user_delegation_key: typing.Optional[str] = OMIT,
481
+ request_options: typing.Optional[RequestOptions] = None,
482
+ ) -> AzureServicePrincipalExportStorage:
483
+ """
484
+ Update a specific Azure export storage connection that was set up with Service Principal authentication.
485
+
486
+ Parameters
487
+ ----------
488
+ id : int
489
+
490
+ account_name : typing.Optional[str]
491
+ Azure Blob account name
492
+
493
+ can_delete_objects : typing.Optional[bool]
494
+ Deletion from storage enabled
495
+
496
+ client_id : typing.Optional[str]
497
+ Azure Blob Service Principal Client ID
498
+
499
+ client_secret : typing.Optional[str]
500
+ Azure Blob Service Principal Client Secret
501
+
502
+ container : typing.Optional[str]
503
+ Azure blob container
504
+
505
+ description : typing.Optional[str]
506
+ Cloud storage description
507
+
508
+ last_sync : typing.Optional[dt.datetime]
509
+ Last sync finished time
510
+
511
+ last_sync_count : typing.Optional[int]
512
+ Count of tasks synced last time
513
+
514
+ last_sync_job : typing.Optional[str]
515
+ Last sync job ID
516
+
517
+ meta : typing.Optional[typing.Optional[typing.Any]]
518
+
519
+ prefix : typing.Optional[str]
520
+ Azure blob prefix name
521
+
522
+ project : typing.Optional[int]
523
+ A unique integer value identifying this project.
524
+
525
+ regex_filter : typing.Optional[str]
526
+ Cloud storage regex for filtering objects
527
+
528
+ status : typing.Optional[StatusC5AEnum]
529
+
530
+ synchronizable : typing.Optional[bool]
531
+
532
+ tenant_id : typing.Optional[str]
533
+ Azure Tenant ID
534
+
535
+ title : typing.Optional[str]
536
+ Cloud storage title
537
+
538
+ traceback : typing.Optional[str]
539
+ Traceback report for the last failed sync
540
+
541
+ use_blob_urls : typing.Optional[bool]
542
+ Interpret objects as BLOBs and generate URLs
543
+
544
+ user_delegation_key : typing.Optional[str]
545
+ User Delegation Key (Backend)
546
+
547
+ request_options : typing.Optional[RequestOptions]
548
+ Request-specific configuration.
549
+
550
+ Returns
551
+ -------
552
+ AzureServicePrincipalExportStorage
553
+
554
+
555
+ Examples
556
+ --------
557
+ from label_studio_sdk import LabelStudio
558
+
559
+ client = LabelStudio(
560
+ api_key="YOUR_API_KEY",
561
+ )
562
+ client.export_storage.azure_spi.update(
563
+ id=1,
564
+ )
565
+ """
566
+ _response = self._client_wrapper.httpx_client.request(
567
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
568
+ method="PATCH",
569
+ json={
570
+ "account_name": account_name,
571
+ "can_delete_objects": can_delete_objects,
572
+ "client_id": client_id,
573
+ "client_secret": client_secret,
574
+ "container": container,
575
+ "description": description,
576
+ "last_sync": last_sync,
577
+ "last_sync_count": last_sync_count,
578
+ "last_sync_job": last_sync_job,
579
+ "meta": meta,
580
+ "prefix": prefix,
581
+ "project": project,
582
+ "regex_filter": regex_filter,
583
+ "status": status,
584
+ "synchronizable": synchronizable,
585
+ "tenant_id": tenant_id,
586
+ "title": title,
587
+ "traceback": traceback,
588
+ "use_blob_urls": use_blob_urls,
589
+ "user_delegation_key": user_delegation_key,
590
+ },
591
+ headers={
592
+ "content-type": "application/json",
593
+ },
594
+ request_options=request_options,
595
+ omit=OMIT,
596
+ )
597
+ try:
598
+ if 200 <= _response.status_code < 300:
599
+ return typing.cast(
600
+ AzureServicePrincipalExportStorage,
601
+ construct_type(
602
+ type_=AzureServicePrincipalExportStorage, # type: ignore
603
+ object_=_response.json(),
604
+ ),
605
+ )
606
+ _response_json = _response.json()
607
+ except JSONDecodeError:
608
+ raise ApiError(status_code=_response.status_code, body=_response.text)
609
+ raise ApiError(status_code=_response.status_code, body=_response_json)
610
+
611
+ def sync(
612
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
613
+ ) -> AzureServicePrincipalExportStorage:
614
+ """
615
+ Sync tasks from an Azure SPI export storage.
616
+
617
+ Parameters
618
+ ----------
619
+ id : int
620
+
621
+ request_options : typing.Optional[RequestOptions]
622
+ Request-specific configuration.
623
+
624
+ Returns
625
+ -------
626
+ AzureServicePrincipalExportStorage
627
+
628
+
629
+ Examples
630
+ --------
631
+ from label_studio_sdk import LabelStudio
632
+
633
+ client = LabelStudio(
634
+ api_key="YOUR_API_KEY",
635
+ )
636
+ client.export_storage.azure_spi.sync(
637
+ id=1,
638
+ )
639
+ """
640
+ _response = self._client_wrapper.httpx_client.request(
641
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}/sync",
642
+ method="POST",
643
+ request_options=request_options,
644
+ )
645
+ try:
646
+ if 200 <= _response.status_code < 300:
647
+ return typing.cast(
648
+ AzureServicePrincipalExportStorage,
649
+ construct_type(
650
+ type_=AzureServicePrincipalExportStorage, # type: ignore
651
+ object_=_response.json(),
652
+ ),
653
+ )
654
+ _response_json = _response.json()
655
+ except JSONDecodeError:
656
+ raise ApiError(status_code=_response.status_code, body=_response.text)
657
+ raise ApiError(status_code=_response.status_code, body=_response_json)
658
+
659
+
660
+ class AsyncAzureSpiClient:
661
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
662
+ self._client_wrapper = client_wrapper
663
+
664
+ async def list(
665
+ self,
666
+ *,
667
+ ordering: typing.Optional[str] = None,
668
+ project: typing.Optional[int] = None,
669
+ request_options: typing.Optional[RequestOptions] = None,
670
+ ) -> typing.List[AzureServicePrincipalExportStorage]:
671
+ """
672
+ Get a list of all Azure export storage connections that were set up with Service Principal authentication.
673
+
674
+ Parameters
675
+ ----------
676
+ ordering : typing.Optional[str]
677
+ Which field to use when ordering the results.
678
+
679
+ project : typing.Optional[int]
680
+ Project ID
681
+
682
+ request_options : typing.Optional[RequestOptions]
683
+ Request-specific configuration.
684
+
685
+ Returns
686
+ -------
687
+ typing.List[AzureServicePrincipalExportStorage]
688
+
689
+
690
+ Examples
691
+ --------
692
+ import asyncio
693
+
694
+ from label_studio_sdk import AsyncLabelStudio
695
+
696
+ client = AsyncLabelStudio(
697
+ api_key="YOUR_API_KEY",
698
+ )
699
+
700
+
701
+ async def main() -> None:
702
+ await client.export_storage.azure_spi.list()
703
+
704
+
705
+ asyncio.run(main())
706
+ """
707
+ _response = await self._client_wrapper.httpx_client.request(
708
+ "api/storages/export/azure_spi",
709
+ method="GET",
710
+ params={
711
+ "ordering": ordering,
712
+ "project": project,
713
+ },
714
+ request_options=request_options,
715
+ )
716
+ try:
717
+ if 200 <= _response.status_code < 300:
718
+ return typing.cast(
719
+ typing.List[AzureServicePrincipalExportStorage],
720
+ construct_type(
721
+ type_=typing.List[AzureServicePrincipalExportStorage], # type: ignore
722
+ object_=_response.json(),
723
+ ),
724
+ )
725
+ _response_json = _response.json()
726
+ except JSONDecodeError:
727
+ raise ApiError(status_code=_response.status_code, body=_response.text)
728
+ raise ApiError(status_code=_response.status_code, body=_response_json)
729
+
730
+ async def create(
731
+ self,
732
+ *,
733
+ project: int,
734
+ account_name: typing.Optional[str] = OMIT,
735
+ can_delete_objects: typing.Optional[bool] = OMIT,
736
+ client_id: typing.Optional[str] = OMIT,
737
+ client_secret: typing.Optional[str] = OMIT,
738
+ container: typing.Optional[str] = OMIT,
739
+ description: typing.Optional[str] = OMIT,
740
+ last_sync: typing.Optional[dt.datetime] = OMIT,
741
+ last_sync_count: typing.Optional[int] = OMIT,
742
+ last_sync_job: typing.Optional[str] = OMIT,
743
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
744
+ prefix: typing.Optional[str] = OMIT,
745
+ regex_filter: typing.Optional[str] = OMIT,
746
+ status: typing.Optional[StatusC5AEnum] = OMIT,
747
+ synchronizable: typing.Optional[bool] = OMIT,
748
+ tenant_id: typing.Optional[str] = OMIT,
749
+ title: typing.Optional[str] = OMIT,
750
+ traceback: typing.Optional[str] = OMIT,
751
+ use_blob_urls: typing.Optional[bool] = OMIT,
752
+ user_delegation_key: typing.Optional[str] = OMIT,
753
+ request_options: typing.Optional[RequestOptions] = None,
754
+ ) -> AzureServicePrincipalExportStorage:
755
+ """
756
+ Create an Azure export storage connection with Service Principal authentication to store annotations.
757
+
758
+ Parameters
759
+ ----------
760
+ project : int
761
+ A unique integer value identifying this project.
762
+
763
+ account_name : typing.Optional[str]
764
+ Azure Blob account name
765
+
766
+ can_delete_objects : typing.Optional[bool]
767
+ Deletion from storage enabled
768
+
769
+ client_id : typing.Optional[str]
770
+ Azure Blob Service Principal Client ID
771
+
772
+ client_secret : typing.Optional[str]
773
+ Azure Blob Service Principal Client Secret
774
+
775
+ container : typing.Optional[str]
776
+ Azure blob container
777
+
778
+ description : typing.Optional[str]
779
+ Cloud storage description
780
+
781
+ last_sync : typing.Optional[dt.datetime]
782
+ Last sync finished time
783
+
784
+ last_sync_count : typing.Optional[int]
785
+ Count of tasks synced last time
786
+
787
+ last_sync_job : typing.Optional[str]
788
+ Last sync job ID
789
+
790
+ meta : typing.Optional[typing.Optional[typing.Any]]
791
+
792
+ prefix : typing.Optional[str]
793
+ Azure blob prefix name
794
+
795
+ regex_filter : typing.Optional[str]
796
+ Cloud storage regex for filtering objects
797
+
798
+ status : typing.Optional[StatusC5AEnum]
799
+
800
+ synchronizable : typing.Optional[bool]
801
+
802
+ tenant_id : typing.Optional[str]
803
+ Azure Tenant ID
804
+
805
+ title : typing.Optional[str]
806
+ Cloud storage title
807
+
808
+ traceback : typing.Optional[str]
809
+ Traceback report for the last failed sync
810
+
811
+ use_blob_urls : typing.Optional[bool]
812
+ Interpret objects as BLOBs and generate URLs
813
+
814
+ user_delegation_key : typing.Optional[str]
815
+ User Delegation Key (Backend)
816
+
817
+ request_options : typing.Optional[RequestOptions]
818
+ Request-specific configuration.
819
+
820
+ Returns
821
+ -------
822
+ AzureServicePrincipalExportStorage
823
+
824
+
825
+ Examples
826
+ --------
827
+ import asyncio
828
+
829
+ from label_studio_sdk import AsyncLabelStudio
830
+
831
+ client = AsyncLabelStudio(
832
+ api_key="YOUR_API_KEY",
833
+ )
834
+
835
+
836
+ async def main() -> None:
837
+ await client.export_storage.azure_spi.create(
838
+ project=1,
839
+ )
840
+
841
+
842
+ asyncio.run(main())
843
+ """
844
+ _response = await self._client_wrapper.httpx_client.request(
845
+ "api/storages/export/azure_spi",
846
+ method="POST",
847
+ json={
848
+ "account_name": account_name,
849
+ "can_delete_objects": can_delete_objects,
850
+ "client_id": client_id,
851
+ "client_secret": client_secret,
852
+ "container": container,
853
+ "description": description,
854
+ "last_sync": last_sync,
855
+ "last_sync_count": last_sync_count,
856
+ "last_sync_job": last_sync_job,
857
+ "meta": meta,
858
+ "prefix": prefix,
859
+ "project": project,
860
+ "regex_filter": regex_filter,
861
+ "status": status,
862
+ "synchronizable": synchronizable,
863
+ "tenant_id": tenant_id,
864
+ "title": title,
865
+ "traceback": traceback,
866
+ "use_blob_urls": use_blob_urls,
867
+ "user_delegation_key": user_delegation_key,
868
+ },
869
+ request_options=request_options,
870
+ omit=OMIT,
871
+ )
872
+ try:
873
+ if 200 <= _response.status_code < 300:
874
+ return typing.cast(
875
+ AzureServicePrincipalExportStorage,
876
+ construct_type(
877
+ type_=AzureServicePrincipalExportStorage, # type: ignore
878
+ object_=_response.json(),
879
+ ),
880
+ )
881
+ _response_json = _response.json()
882
+ except JSONDecodeError:
883
+ raise ApiError(status_code=_response.status_code, body=_response.text)
884
+ raise ApiError(status_code=_response.status_code, body=_response_json)
885
+
886
+ async def validate(
887
+ self,
888
+ *,
889
+ project: int,
890
+ account_name: typing.Optional[str] = OMIT,
891
+ can_delete_objects: typing.Optional[bool] = OMIT,
892
+ client_id: typing.Optional[str] = OMIT,
893
+ client_secret: typing.Optional[str] = OMIT,
894
+ container: typing.Optional[str] = OMIT,
895
+ description: typing.Optional[str] = OMIT,
896
+ last_sync: typing.Optional[dt.datetime] = OMIT,
897
+ last_sync_count: typing.Optional[int] = OMIT,
898
+ last_sync_job: typing.Optional[str] = OMIT,
899
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
900
+ prefix: typing.Optional[str] = OMIT,
901
+ regex_filter: typing.Optional[str] = OMIT,
902
+ status: typing.Optional[StatusC5AEnum] = OMIT,
903
+ synchronizable: typing.Optional[bool] = OMIT,
904
+ tenant_id: typing.Optional[str] = OMIT,
905
+ title: typing.Optional[str] = OMIT,
906
+ traceback: typing.Optional[str] = OMIT,
907
+ use_blob_urls: typing.Optional[bool] = OMIT,
908
+ user_delegation_key: typing.Optional[str] = OMIT,
909
+ request_options: typing.Optional[RequestOptions] = None,
910
+ ) -> None:
911
+ """
912
+ Validate a specific Azure export storage connection that was set up with Service Principal authentication.
913
+
914
+ Parameters
915
+ ----------
916
+ project : int
917
+ A unique integer value identifying this project.
918
+
919
+ account_name : typing.Optional[str]
920
+ Azure Blob account name
921
+
922
+ can_delete_objects : typing.Optional[bool]
923
+ Deletion from storage enabled
924
+
925
+ client_id : typing.Optional[str]
926
+ Azure Blob Service Principal Client ID
927
+
928
+ client_secret : typing.Optional[str]
929
+ Azure Blob Service Principal Client Secret
930
+
931
+ container : typing.Optional[str]
932
+ Azure blob container
933
+
934
+ description : typing.Optional[str]
935
+ Cloud storage description
936
+
937
+ last_sync : typing.Optional[dt.datetime]
938
+ Last sync finished time
939
+
940
+ last_sync_count : typing.Optional[int]
941
+ Count of tasks synced last time
942
+
943
+ last_sync_job : typing.Optional[str]
944
+ Last sync job ID
945
+
946
+ meta : typing.Optional[typing.Optional[typing.Any]]
947
+
948
+ prefix : typing.Optional[str]
949
+ Azure blob prefix name
950
+
951
+ regex_filter : typing.Optional[str]
952
+ Cloud storage regex for filtering objects
953
+
954
+ status : typing.Optional[StatusC5AEnum]
955
+
956
+ synchronizable : typing.Optional[bool]
957
+
958
+ tenant_id : typing.Optional[str]
959
+ Azure Tenant ID
960
+
961
+ title : typing.Optional[str]
962
+ Cloud storage title
963
+
964
+ traceback : typing.Optional[str]
965
+ Traceback report for the last failed sync
966
+
967
+ use_blob_urls : typing.Optional[bool]
968
+ Interpret objects as BLOBs and generate URLs
969
+
970
+ user_delegation_key : typing.Optional[str]
971
+ User Delegation Key (Backend)
972
+
973
+ request_options : typing.Optional[RequestOptions]
974
+ Request-specific configuration.
975
+
976
+ Returns
977
+ -------
978
+ None
979
+
980
+ Examples
981
+ --------
982
+ import asyncio
983
+
984
+ from label_studio_sdk import AsyncLabelStudio
985
+
986
+ client = AsyncLabelStudio(
987
+ api_key="YOUR_API_KEY",
988
+ )
989
+
990
+
991
+ async def main() -> None:
992
+ await client.export_storage.azure_spi.validate(
993
+ project=1,
994
+ )
995
+
996
+
997
+ asyncio.run(main())
998
+ """
999
+ _response = await self._client_wrapper.httpx_client.request(
1000
+ "api/storages/export/azure_spi/validate",
1001
+ method="POST",
1002
+ json={
1003
+ "account_name": account_name,
1004
+ "can_delete_objects": can_delete_objects,
1005
+ "client_id": client_id,
1006
+ "client_secret": client_secret,
1007
+ "container": container,
1008
+ "description": description,
1009
+ "last_sync": last_sync,
1010
+ "last_sync_count": last_sync_count,
1011
+ "last_sync_job": last_sync_job,
1012
+ "meta": meta,
1013
+ "prefix": prefix,
1014
+ "project": project,
1015
+ "regex_filter": regex_filter,
1016
+ "status": status,
1017
+ "synchronizable": synchronizable,
1018
+ "tenant_id": tenant_id,
1019
+ "title": title,
1020
+ "traceback": traceback,
1021
+ "use_blob_urls": use_blob_urls,
1022
+ "user_delegation_key": user_delegation_key,
1023
+ },
1024
+ request_options=request_options,
1025
+ omit=OMIT,
1026
+ )
1027
+ try:
1028
+ if 200 <= _response.status_code < 300:
1029
+ return
1030
+ _response_json = _response.json()
1031
+ except JSONDecodeError:
1032
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1033
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1034
+
1035
+ async def get(
1036
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
1037
+ ) -> AzureServicePrincipalExportStorage:
1038
+ """
1039
+ Get a specific Azure export storage connection that was set up with Service Principal authentication.
1040
+
1041
+ Parameters
1042
+ ----------
1043
+ id : int
1044
+
1045
+ request_options : typing.Optional[RequestOptions]
1046
+ Request-specific configuration.
1047
+
1048
+ Returns
1049
+ -------
1050
+ AzureServicePrincipalExportStorage
1051
+
1052
+
1053
+ Examples
1054
+ --------
1055
+ import asyncio
1056
+
1057
+ from label_studio_sdk import AsyncLabelStudio
1058
+
1059
+ client = AsyncLabelStudio(
1060
+ api_key="YOUR_API_KEY",
1061
+ )
1062
+
1063
+
1064
+ async def main() -> None:
1065
+ await client.export_storage.azure_spi.get(
1066
+ id=1,
1067
+ )
1068
+
1069
+
1070
+ asyncio.run(main())
1071
+ """
1072
+ _response = await self._client_wrapper.httpx_client.request(
1073
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
1074
+ method="GET",
1075
+ request_options=request_options,
1076
+ )
1077
+ try:
1078
+ if 200 <= _response.status_code < 300:
1079
+ return typing.cast(
1080
+ AzureServicePrincipalExportStorage,
1081
+ construct_type(
1082
+ type_=AzureServicePrincipalExportStorage, # type: ignore
1083
+ object_=_response.json(),
1084
+ ),
1085
+ )
1086
+ _response_json = _response.json()
1087
+ except JSONDecodeError:
1088
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1089
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1090
+
1091
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
1092
+ """
1093
+ Delete a specific Azure export storage connection that was set up with Service Principal authentication.
1094
+
1095
+ Parameters
1096
+ ----------
1097
+ id : int
1098
+
1099
+ request_options : typing.Optional[RequestOptions]
1100
+ Request-specific configuration.
1101
+
1102
+ Returns
1103
+ -------
1104
+ None
1105
+
1106
+ Examples
1107
+ --------
1108
+ import asyncio
1109
+
1110
+ from label_studio_sdk import AsyncLabelStudio
1111
+
1112
+ client = AsyncLabelStudio(
1113
+ api_key="YOUR_API_KEY",
1114
+ )
1115
+
1116
+
1117
+ async def main() -> None:
1118
+ await client.export_storage.azure_spi.delete(
1119
+ id=1,
1120
+ )
1121
+
1122
+
1123
+ asyncio.run(main())
1124
+ """
1125
+ _response = await self._client_wrapper.httpx_client.request(
1126
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
1127
+ method="DELETE",
1128
+ request_options=request_options,
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)
1137
+
1138
+ async def update(
1139
+ self,
1140
+ id: int,
1141
+ *,
1142
+ account_name: typing.Optional[str] = OMIT,
1143
+ can_delete_objects: typing.Optional[bool] = OMIT,
1144
+ client_id: typing.Optional[str] = OMIT,
1145
+ client_secret: typing.Optional[str] = OMIT,
1146
+ container: typing.Optional[str] = OMIT,
1147
+ description: typing.Optional[str] = OMIT,
1148
+ last_sync: typing.Optional[dt.datetime] = OMIT,
1149
+ last_sync_count: typing.Optional[int] = OMIT,
1150
+ last_sync_job: typing.Optional[str] = OMIT,
1151
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
1152
+ prefix: typing.Optional[str] = OMIT,
1153
+ project: typing.Optional[int] = OMIT,
1154
+ regex_filter: typing.Optional[str] = OMIT,
1155
+ status: typing.Optional[StatusC5AEnum] = OMIT,
1156
+ synchronizable: typing.Optional[bool] = OMIT,
1157
+ tenant_id: typing.Optional[str] = OMIT,
1158
+ title: typing.Optional[str] = OMIT,
1159
+ traceback: typing.Optional[str] = OMIT,
1160
+ use_blob_urls: typing.Optional[bool] = OMIT,
1161
+ user_delegation_key: typing.Optional[str] = OMIT,
1162
+ request_options: typing.Optional[RequestOptions] = None,
1163
+ ) -> AzureServicePrincipalExportStorage:
1164
+ """
1165
+ Update a specific Azure export storage connection that was set up with Service Principal authentication.
1166
+
1167
+ Parameters
1168
+ ----------
1169
+ id : int
1170
+
1171
+ account_name : typing.Optional[str]
1172
+ Azure Blob account name
1173
+
1174
+ can_delete_objects : typing.Optional[bool]
1175
+ Deletion from storage enabled
1176
+
1177
+ client_id : typing.Optional[str]
1178
+ Azure Blob Service Principal Client ID
1179
+
1180
+ client_secret : typing.Optional[str]
1181
+ Azure Blob Service Principal Client Secret
1182
+
1183
+ container : typing.Optional[str]
1184
+ Azure blob container
1185
+
1186
+ description : typing.Optional[str]
1187
+ Cloud storage description
1188
+
1189
+ last_sync : typing.Optional[dt.datetime]
1190
+ Last sync finished time
1191
+
1192
+ last_sync_count : typing.Optional[int]
1193
+ Count of tasks synced last time
1194
+
1195
+ last_sync_job : typing.Optional[str]
1196
+ Last sync job ID
1197
+
1198
+ meta : typing.Optional[typing.Optional[typing.Any]]
1199
+
1200
+ prefix : typing.Optional[str]
1201
+ Azure blob prefix name
1202
+
1203
+ project : typing.Optional[int]
1204
+ A unique integer value identifying this project.
1205
+
1206
+ regex_filter : typing.Optional[str]
1207
+ Cloud storage regex for filtering objects
1208
+
1209
+ status : typing.Optional[StatusC5AEnum]
1210
+
1211
+ synchronizable : typing.Optional[bool]
1212
+
1213
+ tenant_id : typing.Optional[str]
1214
+ Azure Tenant ID
1215
+
1216
+ title : typing.Optional[str]
1217
+ Cloud storage title
1218
+
1219
+ traceback : typing.Optional[str]
1220
+ Traceback report for the last failed sync
1221
+
1222
+ use_blob_urls : typing.Optional[bool]
1223
+ Interpret objects as BLOBs and generate URLs
1224
+
1225
+ user_delegation_key : typing.Optional[str]
1226
+ User Delegation Key (Backend)
1227
+
1228
+ request_options : typing.Optional[RequestOptions]
1229
+ Request-specific configuration.
1230
+
1231
+ Returns
1232
+ -------
1233
+ AzureServicePrincipalExportStorage
1234
+
1235
+
1236
+ Examples
1237
+ --------
1238
+ import asyncio
1239
+
1240
+ from label_studio_sdk import AsyncLabelStudio
1241
+
1242
+ client = AsyncLabelStudio(
1243
+ api_key="YOUR_API_KEY",
1244
+ )
1245
+
1246
+
1247
+ async def main() -> None:
1248
+ await client.export_storage.azure_spi.update(
1249
+ id=1,
1250
+ )
1251
+
1252
+
1253
+ asyncio.run(main())
1254
+ """
1255
+ _response = await self._client_wrapper.httpx_client.request(
1256
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}",
1257
+ method="PATCH",
1258
+ json={
1259
+ "account_name": account_name,
1260
+ "can_delete_objects": can_delete_objects,
1261
+ "client_id": client_id,
1262
+ "client_secret": client_secret,
1263
+ "container": container,
1264
+ "description": description,
1265
+ "last_sync": last_sync,
1266
+ "last_sync_count": last_sync_count,
1267
+ "last_sync_job": last_sync_job,
1268
+ "meta": meta,
1269
+ "prefix": prefix,
1270
+ "project": project,
1271
+ "regex_filter": regex_filter,
1272
+ "status": status,
1273
+ "synchronizable": synchronizable,
1274
+ "tenant_id": tenant_id,
1275
+ "title": title,
1276
+ "traceback": traceback,
1277
+ "use_blob_urls": use_blob_urls,
1278
+ "user_delegation_key": user_delegation_key,
1279
+ },
1280
+ headers={
1281
+ "content-type": "application/json",
1282
+ },
1283
+ request_options=request_options,
1284
+ omit=OMIT,
1285
+ )
1286
+ try:
1287
+ if 200 <= _response.status_code < 300:
1288
+ return typing.cast(
1289
+ AzureServicePrincipalExportStorage,
1290
+ construct_type(
1291
+ type_=AzureServicePrincipalExportStorage, # type: ignore
1292
+ object_=_response.json(),
1293
+ ),
1294
+ )
1295
+ _response_json = _response.json()
1296
+ except JSONDecodeError:
1297
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1298
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1299
+
1300
+ async def sync(
1301
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
1302
+ ) -> AzureServicePrincipalExportStorage:
1303
+ """
1304
+ Sync tasks from an Azure SPI export storage.
1305
+
1306
+ Parameters
1307
+ ----------
1308
+ id : int
1309
+
1310
+ request_options : typing.Optional[RequestOptions]
1311
+ Request-specific configuration.
1312
+
1313
+ Returns
1314
+ -------
1315
+ AzureServicePrincipalExportStorage
1316
+
1317
+
1318
+ Examples
1319
+ --------
1320
+ import asyncio
1321
+
1322
+ from label_studio_sdk import AsyncLabelStudio
1323
+
1324
+ client = AsyncLabelStudio(
1325
+ api_key="YOUR_API_KEY",
1326
+ )
1327
+
1328
+
1329
+ async def main() -> None:
1330
+ await client.export_storage.azure_spi.sync(
1331
+ id=1,
1332
+ )
1333
+
1334
+
1335
+ asyncio.run(main())
1336
+ """
1337
+ _response = await self._client_wrapper.httpx_client.request(
1338
+ f"api/storages/export/azure_spi/{jsonable_encoder(id)}/sync",
1339
+ method="POST",
1340
+ request_options=request_options,
1341
+ )
1342
+ try:
1343
+ if 200 <= _response.status_code < 300:
1344
+ return typing.cast(
1345
+ AzureServicePrincipalExportStorage,
1346
+ construct_type(
1347
+ type_=AzureServicePrincipalExportStorage, # type: ignore
1348
+ object_=_response.json(),
1349
+ ),
1350
+ )
1351
+ _response_json = _response.json()
1352
+ except JSONDecodeError:
1353
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1354
+ raise ApiError(status_code=_response.status_code, body=_response_json)