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