label-studio-sdk 1.0.20__py3-none-any.whl → 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of label-studio-sdk might be problematic. Click here for more details.
- label_studio_sdk/__init__.py +325 -180
- label_studio_sdk/actions/__init__.py +4 -0
- label_studio_sdk/actions/client.py +46 -10
- label_studio_sdk/actions/types/__init__.py +4 -0
- label_studio_sdk/actions/types/actions_create_request_filters.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_id.py +7 -7
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +2 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +2 -2
- label_studio_sdk/actions/types/actions_list_response_item.py +25 -0
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +22 -0
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +379 -243
- label_studio_sdk/annotations/types/__init__.py +4 -2
- label_studio_sdk/annotations/types/annotation_bulk_serializer_with_selected_items_request_last_action.py +7 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +8 -5
- label_studio_sdk/base_client.py +28 -24
- label_studio_sdk/comments/client.py +378 -140
- label_studio_sdk/converter/README.md +207 -0
- label_studio_sdk/converter/imports/coco.py +132 -23
- label_studio_sdk/core/__init__.py +4 -0
- label_studio_sdk/core/unchecked_base_model.py +305 -0
- label_studio_sdk/environment.py +1 -1
- label_studio_sdk/errors/__init__.py +10 -1
- label_studio_sdk/errors/forbidden_error.py +9 -0
- label_studio_sdk/errors/method_not_allowed_error.py +9 -0
- label_studio_sdk/export_storage/__init__.py +1 -24
- label_studio_sdk/export_storage/azure/__init__.py +0 -3
- label_studio_sdk/export_storage/azure/client.py +231 -273
- label_studio_sdk/export_storage/client.py +5 -5
- label_studio_sdk/export_storage/gcs/__init__.py +0 -3
- label_studio_sdk/export_storage/gcs/client.py +231 -273
- label_studio_sdk/export_storage/local/__init__.py +0 -3
- label_studio_sdk/export_storage/local/client.py +211 -253
- label_studio_sdk/export_storage/redis/__init__.py +0 -3
- label_studio_sdk/export_storage/redis/client.py +239 -281
- label_studio_sdk/export_storage/s3/__init__.py +0 -3
- label_studio_sdk/export_storage/s3/client.py +254 -296
- label_studio_sdk/export_storage/s3s/client.py +694 -210
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +2 -2
- label_studio_sdk/files/client.py +52 -71
- label_studio_sdk/import_storage/__init__.py +1 -24
- label_studio_sdk/import_storage/azure/__init__.py +0 -3
- label_studio_sdk/import_storage/azure/client.py +249 -299
- label_studio_sdk/import_storage/client.py +5 -5
- label_studio_sdk/import_storage/gcs/__init__.py +0 -3
- label_studio_sdk/import_storage/gcs/client.py +249 -299
- label_studio_sdk/import_storage/local/__init__.py +0 -3
- label_studio_sdk/import_storage/local/client.py +211 -257
- label_studio_sdk/import_storage/redis/__init__.py +0 -3
- label_studio_sdk/import_storage/redis/client.py +239 -285
- label_studio_sdk/import_storage/s3/__init__.py +0 -3
- label_studio_sdk/import_storage/s3/client.py +274 -324
- label_studio_sdk/import_storage/s3s/client.py +728 -434
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +2 -2
- label_studio_sdk/jwt_settings/client.py +56 -58
- label_studio_sdk/label_interface/control_tags.py +48 -8
- label_studio_sdk/label_interface/interface.py +261 -56
- label_studio_sdk/ml/__init__.py +2 -16
- label_studio_sdk/ml/client.py +196 -179
- label_studio_sdk/ml/types/__init__.py +2 -12
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +20 -0
- label_studio_sdk/model_providers/__init__.py +3 -0
- label_studio_sdk/model_providers/client.py +280 -228
- label_studio_sdk/model_providers/types/__init__.py +5 -0
- label_studio_sdk/{prompts/types/prompts_batch_predictions_response.py → model_providers/types/model_providers_list_model_provider_choices_response.py} +3 -3
- label_studio_sdk/organizations/__init__.py +5 -0
- label_studio_sdk/organizations/client.py +331 -0
- label_studio_sdk/organizations/members/__init__.py +2 -0
- label_studio_sdk/organizations/members/client.py +290 -0
- label_studio_sdk/predictions/client.py +29 -77
- label_studio_sdk/projects/__init__.py +18 -9
- label_studio_sdk/projects/client.py +905 -414
- label_studio_sdk/projects/exports/__init__.py +2 -2
- label_studio_sdk/projects/exports/client.py +336 -396
- label_studio_sdk/projects/exports/client_ext.py +30 -30
- label_studio_sdk/projects/exports/types/__init__.py +1 -2
- label_studio_sdk/projects/exports/types/exports_convert_response.py +5 -9
- label_studio_sdk/projects/pauses/client.py +114 -105
- label_studio_sdk/projects/stats/__init__.py +5 -0
- label_studio_sdk/projects/stats/client.py +175 -0
- label_studio_sdk/projects/stats/types/__init__.py +8 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +44 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_common_tasks.py +7 -0
- label_studio_sdk/projects/stats/types/stats_iaa_response_iaa.py +5 -0
- label_studio_sdk/{types/base_task_file_upload.py → projects/stats/types/stats_iaa_response_std.py} +1 -1
- label_studio_sdk/projects/types/__init__.py +10 -6
- label_studio_sdk/projects/types/lse_project_create_request_sampling.py +7 -0
- label_studio_sdk/projects/types/lse_project_create_request_skip_queue.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_sampling.py +7 -0
- label_studio_sdk/projects/types/patched_lse_project_update_request_skip_queue.py +7 -0
- label_studio_sdk/{prompts/types/prompts_batch_failed_predictions_response.py → projects/types/projects_duplicate_response.py} +8 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +2 -2
- label_studio_sdk/projects/types/projects_list_request_filter.py +1 -1
- label_studio_sdk/prompts/__init__.py +4 -10
- label_studio_sdk/prompts/client.py +511 -442
- label_studio_sdk/prompts/indicators/__init__.py +3 -0
- label_studio_sdk/prompts/indicators/client.py +47 -49
- label_studio_sdk/prompts/indicators/types/__init__.py +5 -0
- label_studio_sdk/{types/key_indicator_value.py → prompts/indicators/types/indicators_list_response_item.py} +3 -3
- label_studio_sdk/prompts/runs/client.py +113 -135
- label_studio_sdk/prompts/types/__init__.py +2 -12
- label_studio_sdk/prompts/types/prompts_compatible_projects_request_project_type.py +7 -0
- label_studio_sdk/prompts/versions/client.py +372 -312
- label_studio_sdk/tasks/__init__.py +2 -2
- label_studio_sdk/tasks/client.py +514 -213
- label_studio_sdk/tasks/types/__init__.py +1 -2
- label_studio_sdk/tokens/client.py +160 -152
- label_studio_sdk/tokens/client_ext.py +3 -3
- label_studio_sdk/types/__init__.py +258 -142
- label_studio_sdk/{webhooks/types/webhooks_update_request_actions_item.py → types/actions_enum.py} +4 -1
- label_studio_sdk/types/all_roles_project_list.py +197 -0
- label_studio_sdk/types/all_roles_project_list_sampling.py +7 -0
- label_studio_sdk/types/all_roles_project_list_skip_queue.py +7 -0
- label_studio_sdk/types/annotated_enum.py +5 -0
- label_studio_sdk/types/annotation.py +24 -10
- label_studio_sdk/types/annotation_last_action.py +3 -15
- label_studio_sdk/types/{annotations_dm_field.py → annotation_request.py} +21 -30
- label_studio_sdk/types/annotation_request_last_action.py +7 -0
- label_studio_sdk/types/assignment_settings.py +31 -0
- label_studio_sdk/types/assignment_settings_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/assignment_settings_request.py +32 -0
- label_studio_sdk/types/assignment_settings_request_label_stream_task_distribution.py +7 -0
- label_studio_sdk/types/{key_indicators_item_additional_kpis_item.py → associated_project.py} +9 -6
- label_studio_sdk/types/auth_method_enum.py +5 -0
- label_studio_sdk/types/azure_blob_export_storage.py +8 -12
- label_studio_sdk/types/azure_blob_import_storage.py +8 -12
- label_studio_sdk/types/{prompt_associated_projects_item_id.py → batch_failed_predictions.py} +4 -4
- label_studio_sdk/types/{access_token_response.py → batch_predictions.py} +6 -8
- label_studio_sdk/types/blank_enum.py +5 -0
- label_studio_sdk/types/{key_indicators_item_extra_kpis_item.py → blueprint_list.py} +12 -6
- label_studio_sdk/types/budget_reset_period_enum.py +5 -0
- label_studio_sdk/types/child_filter.py +44 -0
- label_studio_sdk/types/comment.py +39 -14
- label_studio_sdk/types/comment_request.py +32 -0
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +53 -0
- label_studio_sdk/types/converted_format.py +5 -5
- label_studio_sdk/types/{api_token_response.py → converted_format_request.py} +8 -15
- label_studio_sdk/types/custom_scripts_editable_by_enum.py +5 -0
- label_studio_sdk/types/default_role_enum.py +5 -0
- label_studio_sdk/types/edition_enum.py +5 -0
- label_studio_sdk/types/export.py +7 -7
- label_studio_sdk/types/file_upload.py +5 -5
- label_studio_sdk/types/filter.py +9 -6
- label_studio_sdk/types/filter_group.py +3 -3
- label_studio_sdk/types/finished_enum.py +5 -0
- label_studio_sdk/types/gcs_export_storage.py +8 -12
- label_studio_sdk/types/gcs_import_storage.py +8 -12
- label_studio_sdk/types/{rotate_token_response.py → hotkeys.py} +5 -8
- label_studio_sdk/types/{base_task.py → import_api_request.py} +11 -34
- label_studio_sdk/types/inference_run_cost_estimate.py +2 -2
- label_studio_sdk/types/label_stream_task_distribution_enum.py +5 -0
- label_studio_sdk/types/{annotations_dm_field_last_action.py → last_action_enum.py} +1 -1
- label_studio_sdk/types/local_files_export_storage.py +8 -12
- label_studio_sdk/types/local_files_import_storage.py +8 -12
- label_studio_sdk/types/{annotation_filter_options.py → lse_annotation_filter_options.py} +12 -2
- label_studio_sdk/types/lse_annotation_filter_options_request.py +42 -0
- label_studio_sdk/types/lse_annotation_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_annotation_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/{export_snapshot.py → lse_export_create.py} +11 -11
- label_studio_sdk/types/lse_fields.py +49 -0
- label_studio_sdk/types/lse_fields_onboarding_state.py +8 -0
- label_studio_sdk/types/lse_fields_trial_role.py +8 -0
- label_studio_sdk/types/lse_key_indicator_value.py +35 -0
- label_studio_sdk/types/lse_organization.py +57 -0
- label_studio_sdk/types/lse_organization_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/lse_project_create.py +196 -0
- label_studio_sdk/types/lse_project_create_sampling.py +7 -0
- label_studio_sdk/types/lse_project_create_skip_queue.py +7 -0
- label_studio_sdk/types/lse_project_update.py +215 -0
- label_studio_sdk/types/lse_project_update_sampling.py +7 -0
- label_studio_sdk/types/lse_project_update_skip_queue.py +7 -0
- label_studio_sdk/types/lse_s3export_storage.py +134 -0
- label_studio_sdk/{import_storage/s3/types/s3create_response.py → types/lse_s3export_storage_request.py} +47 -21
- label_studio_sdk/{import_storage/s3/types/s3update_response.py → types/lse_s3import_storage.py} +60 -21
- label_studio_sdk/types/{s3s_import_storage.py → lse_s3import_storage_request.py} +32 -21
- label_studio_sdk/types/lse_task.py +117 -0
- label_studio_sdk/types/{data_manager_task_serializer_drafts_item.py → lse_task_drafts_item.py} +2 -2
- label_studio_sdk/types/lse_task_filter_options.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request.py +63 -0
- label_studio_sdk/types/lse_task_filter_options_request_annotated.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_finished.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_request_skipped.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_reviewed.py +7 -0
- label_studio_sdk/types/lse_task_filter_options_skipped.py +7 -0
- label_studio_sdk/types/{data_manager_task_serializer_predictions_item.py → lse_task_predictions_item.py} +4 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +54 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +28 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +117 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +22 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +28 -0
- label_studio_sdk/types/lse_user.py +49 -0
- label_studio_sdk/types/{base_user.py → lse_user_api.py} +17 -6
- label_studio_sdk/types/lseapi_token_create.py +21 -0
- label_studio_sdk/types/lseapi_token_list.py +21 -0
- label_studio_sdk/types/lsejwt_settings.py +32 -0
- label_studio_sdk/types/maybe_expanded_comment.py +7 -0
- label_studio_sdk/types/ml_backend.py +16 -17
- label_studio_sdk/types/mode_enum.py +5 -0
- label_studio_sdk/types/model_interface.py +44 -0
- label_studio_sdk/types/model_interface_request.py +40 -0
- label_studio_sdk/types/model_interface_serializer_get.py +45 -0
- label_studio_sdk/types/model_provider_connection.py +48 -17
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +3 -1
- label_studio_sdk/types/model_provider_connection_request.py +71 -0
- label_studio_sdk/types/model_run.py +40 -0
- label_studio_sdk/types/{inference_run_status.py → model_run_status_enum.py} +1 -1
- label_studio_sdk/types/null_enum.py +3 -0
- label_studio_sdk/types/onboarding_state_enum.py +7 -0
- label_studio_sdk/types/organization_billing.py +20 -0
- label_studio_sdk/types/organization_id.py +28 -0
- label_studio_sdk/types/organization_invite.py +20 -0
- label_studio_sdk/types/organization_member.py +37 -0
- label_studio_sdk/types/organization_membership.py +24 -0
- label_studio_sdk/{projects/types/projects_list_response.py → types/paginated_all_roles_project_list_list.py} +5 -5
- label_studio_sdk/types/{jwt_settings_response.py → paginated_role_based_task_list.py} +11 -9
- label_studio_sdk/types/pause.py +55 -14
- label_studio_sdk/types/pause_request.py +41 -0
- label_studio_sdk/types/prediction.py +7 -11
- label_studio_sdk/types/prediction_request.py +56 -0
- label_studio_sdk/types/project.py +32 -39
- label_studio_sdk/types/project_import.py +12 -13
- label_studio_sdk/types/project_label_config.py +2 -2
- label_studio_sdk/types/project_label_config_request.py +22 -0
- label_studio_sdk/types/project_sampling.py +3 -3
- label_studio_sdk/types/project_skip_queue.py +3 -1
- label_studio_sdk/types/project_subset_enum.py +5 -0
- label_studio_sdk/types/{prompt_version_provider.py → provider_enum.py} +1 -1
- label_studio_sdk/types/reason_enum.py +7 -0
- label_studio_sdk/types/redis_export_storage.py +8 -12
- label_studio_sdk/types/redis_import_storage.py +8 -12
- label_studio_sdk/types/refined_prompt_response.py +5 -6
- label_studio_sdk/types/requeue_rejected_tasks_mode_enum.py +5 -0
- label_studio_sdk/types/review_criteria_enum.py +5 -0
- label_studio_sdk/types/review_settings.py +80 -0
- label_studio_sdk/types/review_settings_request.py +80 -0
- label_studio_sdk/types/review_settings_request_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_request_review_criteria.py +7 -0
- label_studio_sdk/types/review_settings_requeue_rejected_tasks_mode.py +8 -0
- label_studio_sdk/types/review_settings_review_criteria.py +7 -0
- label_studio_sdk/types/reviewed_enum.py +5 -0
- label_studio_sdk/types/role_based_task.py +8 -0
- label_studio_sdk/types/s3export_storage.py +8 -12
- label_studio_sdk/types/s3import_storage.py +8 -12
- label_studio_sdk/types/sampling_enum.py +7 -0
- label_studio_sdk/types/scope_enum.py +5 -0
- label_studio_sdk/types/selected_items_request.py +23 -0
- label_studio_sdk/types/serialization_option.py +2 -6
- label_studio_sdk/types/serialization_option_request.py +22 -0
- label_studio_sdk/types/serialization_options.py +17 -5
- label_studio_sdk/types/serialization_options_request.py +47 -0
- label_studio_sdk/types/skill_name_enum.py +5 -0
- label_studio_sdk/types/skip_queue_enum.py +5 -0
- label_studio_sdk/types/skipped_enum.py +5 -0
- label_studio_sdk/types/state_enum.py +5 -0
- label_studio_sdk/types/status7bf_enum.py +5 -0
- label_studio_sdk/types/{azure_blob_import_storage_status.py → status_c5a_enum.py} +2 -2
- label_studio_sdk/types/third_party_model_version.py +65 -0
- label_studio_sdk/types/third_party_model_version_request.py +54 -0
- label_studio_sdk/types/token_refresh_response.py +19 -0
- label_studio_sdk/types/token_rotate_response.py +19 -0
- label_studio_sdk/types/trial_role_enum.py +16 -0
- label_studio_sdk/types/user_simple.py +8 -5
- label_studio_sdk/types/user_simple_request.py +28 -0
- label_studio_sdk/types/version_response.py +49 -0
- label_studio_sdk/types/view.py +8 -15
- label_studio_sdk/types/webhook.py +9 -13
- label_studio_sdk/types/webhook_serializer_for_update.py +15 -13
- label_studio_sdk/types/workspace.py +14 -34
- label_studio_sdk/types/workspace_member_create.py +27 -0
- label_studio_sdk/types/workspace_member_list.py +24 -0
- label_studio_sdk/users/client.py +604 -87
- label_studio_sdk/users/types/users_get_token_response.py +4 -11
- label_studio_sdk/users/types/users_reset_token_response.py +4 -11
- label_studio_sdk/versions/__init__.py +0 -3
- label_studio_sdk/versions/client.py +14 -14
- label_studio_sdk/views/client.py +227 -141
- label_studio_sdk/views/types/views_create_request_data.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +2 -2
- label_studio_sdk/views/types/views_update_request_data.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +2 -2
- label_studio_sdk/webhooks/__init__.py +36 -2
- label_studio_sdk/webhooks/client.py +173 -367
- label_studio_sdk/webhooks/types/__init__.py +34 -2
- label_studio_sdk/webhooks/types/webhooks_info_response.py +80 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +24 -0
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +24 -0
- label_studio_sdk/workspaces/__init__.py +1 -2
- label_studio_sdk/workspaces/client.py +97 -117
- label_studio_sdk/workspaces/members/__init__.py +0 -3
- label_studio_sdk/workspaces/members/client.py +65 -81
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/METADATA +1 -1
- label_studio_sdk-2.0.0.dist-info/RECORD +424 -0
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/WHEEL +1 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +0 -34
- label_studio_sdk/export_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +0 -57
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +0 -57
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +0 -57
- label_studio_sdk/export_storage/local/types/__init__.py +0 -6
- label_studio_sdk/export_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/export_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/export_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/export_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/export_storage/s3/types/s3create_response.py +0 -81
- label_studio_sdk/export_storage/s3/types/s3update_response.py +0 -81
- label_studio_sdk/import_storage/azure/types/__init__.py +0 -6
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +0 -72
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/__init__.py +0 -6
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +0 -72
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +0 -72
- label_studio_sdk/import_storage/local/types/__init__.py +0 -6
- label_studio_sdk/import_storage/local/types/local_create_response.py +0 -47
- label_studio_sdk/import_storage/local/types/local_update_response.py +0 -47
- label_studio_sdk/import_storage/redis/types/__init__.py +0 -6
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +0 -62
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +0 -62
- label_studio_sdk/import_storage/s3/types/__init__.py +0 -6
- label_studio_sdk/ml/types/ml_create_response.py +0 -68
- label_studio_sdk/ml/types/ml_create_response_auth_method.py +0 -5
- label_studio_sdk/ml/types/ml_update_response.py +0 -68
- label_studio_sdk/ml/types/ml_update_response_auth_method.py +0 -5
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +0 -44
- label_studio_sdk/projects/types/projects_create_response.py +0 -91
- label_studio_sdk/projects/types/projects_update_response.py +0 -96
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +0 -32
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +0 -59
- label_studio_sdk/tasks/types/tasks_list_response.py +0 -38
- label_studio_sdk/types/annotation_completed_by.py +0 -6
- label_studio_sdk/types/azure_blob_export_storage_status.py +0 -7
- label_studio_sdk/types/base_task_updated_by.py +0 -7
- label_studio_sdk/types/comment_created_by.py +0 -5
- label_studio_sdk/types/converted_format_status.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer.py +0 -118
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_comment_authors_item.py +0 -5
- label_studio_sdk/types/data_manager_task_serializer_predictions_item_model_run.py +0 -5
- label_studio_sdk/types/export_format.py +0 -25
- label_studio_sdk/types/export_snapshot_status.py +0 -5
- label_studio_sdk/types/export_status.py +0 -5
- label_studio_sdk/types/gcs_export_storage_status.py +0 -7
- label_studio_sdk/types/gcs_import_storage_status.py +0 -7
- label_studio_sdk/types/inference_run.py +0 -34
- label_studio_sdk/types/inference_run_created_by.py +0 -5
- label_studio_sdk/types/inference_run_organization.py +0 -5
- label_studio_sdk/types/inference_run_project_subset.py +0 -5
- label_studio_sdk/types/key_indicators.py +0 -6
- label_studio_sdk/types/key_indicators_item.py +0 -41
- label_studio_sdk/types/local_files_export_storage_status.py +0 -7
- label_studio_sdk/types/local_files_import_storage_status.py +0 -7
- label_studio_sdk/types/ml_backend_auth_method.py +0 -5
- label_studio_sdk/types/ml_backend_state.py +0 -5
- label_studio_sdk/types/model_provider_connection_created_by.py +0 -5
- label_studio_sdk/types/model_provider_connection_organization.py +0 -5
- label_studio_sdk/types/model_provider_connection_provider.py +0 -7
- label_studio_sdk/types/model_provider_connection_scope.py +0 -5
- label_studio_sdk/types/pause_paused_by.py +0 -5
- label_studio_sdk/types/project_import_status.py +0 -5
- label_studio_sdk/types/prompt.py +0 -71
- label_studio_sdk/types/prompt_associated_projects_item.py +0 -6
- label_studio_sdk/types/prompt_created_by.py +0 -5
- label_studio_sdk/types/prompt_organization.py +0 -5
- label_studio_sdk/types/prompt_version.py +0 -32
- label_studio_sdk/types/prompt_version_created_by.py +0 -5
- label_studio_sdk/types/prompt_version_organization.py +0 -5
- label_studio_sdk/types/redis_export_storage_status.py +0 -7
- label_studio_sdk/types/redis_import_storage_status.py +0 -7
- label_studio_sdk/types/refined_prompt_response_refinement_status.py +0 -7
- label_studio_sdk/types/s3export_storage_status.py +0 -7
- label_studio_sdk/types/s3import_storage_status.py +0 -7
- label_studio_sdk/types/s3s_export_storage.py +0 -73
- label_studio_sdk/types/s3s_import_storage_status.py +0 -7
- label_studio_sdk/types/task.py +0 -156
- label_studio_sdk/types/task_annotators_item.py +0 -5
- label_studio_sdk/types/task_comment_authors_item.py +0 -5
- label_studio_sdk/types/task_filter_options.py +0 -39
- label_studio_sdk/types/webhook_actions_item.py +0 -21
- label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +0 -21
- label_studio_sdk/versions/types/__init__.py +0 -6
- label_studio_sdk/versions/types/versions_get_response.py +0 -73
- label_studio_sdk/versions/types/versions_get_response_edition.py +0 -5
- label_studio_sdk/workspaces/members/types/__init__.py +0 -6
- label_studio_sdk/workspaces/members/types/members_create_response.py +0 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +0 -22
- label_studio_sdk-1.0.20.dist-info/RECORD +0 -374
- {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.0.dist-info}/LICENSE +0 -0
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
|
5
5
|
from ...core.request_options import RequestOptions
|
|
6
|
-
from ...types.
|
|
7
|
-
from ...core.
|
|
6
|
+
from ...types.lse_s3import_storage import LseS3ImportStorage
|
|
7
|
+
from ...core.unchecked_base_model import construct_type
|
|
8
8
|
from json.decoder import JSONDecodeError
|
|
9
9
|
from ...core.api_error import ApiError
|
|
10
|
+
import datetime as dt
|
|
11
|
+
from ...types.status_c5a_enum import StatusC5AEnum
|
|
10
12
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
11
13
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
14
|
|
|
@@ -19,18 +21,20 @@ class S3SClient:
|
|
|
19
21
|
self._client_wrapper = client_wrapper
|
|
20
22
|
|
|
21
23
|
def list(
|
|
22
|
-
self,
|
|
23
|
-
|
|
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[LseS3ImportStorage]:
|
|
24
30
|
"""
|
|
25
|
-
|
|
26
|
-
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
27
|
-
|
|
28
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
29
|
-
|
|
30
|
-
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
31
|
+
Get list of all S3 import storage connections set up with IAM role access.
|
|
31
32
|
|
|
32
33
|
Parameters
|
|
33
34
|
----------
|
|
35
|
+
ordering : typing.Optional[str]
|
|
36
|
+
Which field to use when ordering the results.
|
|
37
|
+
|
|
34
38
|
project : typing.Optional[int]
|
|
35
39
|
Project ID
|
|
36
40
|
|
|
@@ -39,7 +43,7 @@ class S3SClient:
|
|
|
39
43
|
|
|
40
44
|
Returns
|
|
41
45
|
-------
|
|
42
|
-
typing.List[
|
|
46
|
+
typing.List[LseS3ImportStorage]
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
Examples
|
|
@@ -52,9 +56,10 @@ class S3SClient:
|
|
|
52
56
|
client.import_storage.s3s.list()
|
|
53
57
|
"""
|
|
54
58
|
_response = self._client_wrapper.httpx_client.request(
|
|
55
|
-
"api/storages/s3s",
|
|
59
|
+
"api/storages/s3s/",
|
|
56
60
|
method="GET",
|
|
57
61
|
params={
|
|
62
|
+
"ordering": ordering,
|
|
58
63
|
"project": project,
|
|
59
64
|
},
|
|
60
65
|
request_options=request_options,
|
|
@@ -62,9 +67,9 @@ class S3SClient:
|
|
|
62
67
|
try:
|
|
63
68
|
if 200 <= _response.status_code < 300:
|
|
64
69
|
return typing.cast(
|
|
65
|
-
typing.List[
|
|
66
|
-
|
|
67
|
-
type_=typing.List[
|
|
70
|
+
typing.List[LseS3ImportStorage],
|
|
71
|
+
construct_type(
|
|
72
|
+
type_=typing.List[LseS3ImportStorage], # type: ignore
|
|
68
73
|
object_=_response.json(),
|
|
69
74
|
),
|
|
70
75
|
)
|
|
@@ -76,57 +81,70 @@ class S3SClient:
|
|
|
76
81
|
def create(
|
|
77
82
|
self,
|
|
78
83
|
*,
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
role_arn: str,
|
|
85
|
+
project: int,
|
|
86
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
81
87
|
presign: typing.Optional[bool] = OMIT,
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
89
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
90
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
91
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
92
|
+
traceback: typing.Optional[str] = OMIT,
|
|
93
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
84
94
|
title: typing.Optional[str] = OMIT,
|
|
85
95
|
description: typing.Optional[str] = OMIT,
|
|
86
|
-
project: typing.Optional[int] = OMIT,
|
|
87
96
|
bucket: typing.Optional[str] = OMIT,
|
|
88
97
|
prefix: typing.Optional[str] = OMIT,
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
99
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
100
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
101
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
102
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
103
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
91
104
|
region_name: typing.Optional[str] = OMIT,
|
|
92
105
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
106
|
+
external_id: typing.Optional[str] = OMIT,
|
|
107
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
108
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
109
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
93
110
|
request_options: typing.Optional[RequestOptions] = None,
|
|
94
|
-
) ->
|
|
111
|
+
) -> LseS3ImportStorage:
|
|
95
112
|
"""
|
|
113
|
+
Create S3 import storage with IAM role access.
|
|
96
114
|
|
|
97
|
-
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
role_arn : str
|
|
118
|
+
AWS RoleArn
|
|
98
119
|
|
|
99
|
-
|
|
120
|
+
project : int
|
|
121
|
+
A unique integer value identifying this project.
|
|
100
122
|
|
|
101
|
-
|
|
123
|
+
synchronizable : typing.Optional[bool]
|
|
102
124
|
|
|
103
|
-
|
|
125
|
+
presign : typing.Optional[bool]
|
|
104
126
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
regex_filter : typing.Optional[str]
|
|
108
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
127
|
+
last_sync : typing.Optional[dt.datetime]
|
|
128
|
+
Last sync finished time
|
|
109
129
|
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
last_sync_count : typing.Optional[int]
|
|
131
|
+
Count of tasks synced last time
|
|
112
132
|
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
last_sync_job : typing.Optional[str]
|
|
134
|
+
Last sync job ID
|
|
115
135
|
|
|
116
|
-
|
|
117
|
-
Presign TTL in minutes
|
|
136
|
+
status : typing.Optional[StatusC5AEnum]
|
|
118
137
|
|
|
119
|
-
|
|
120
|
-
|
|
138
|
+
traceback : typing.Optional[str]
|
|
139
|
+
Traceback report for the last failed sync
|
|
140
|
+
|
|
141
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
121
142
|
|
|
122
143
|
title : typing.Optional[str]
|
|
123
|
-
|
|
144
|
+
Cloud storage title
|
|
124
145
|
|
|
125
146
|
description : typing.Optional[str]
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
project : typing.Optional[int]
|
|
129
|
-
Project ID
|
|
147
|
+
Cloud storage description
|
|
130
148
|
|
|
131
149
|
bucket : typing.Optional[str]
|
|
132
150
|
S3 bucket name
|
|
@@ -134,11 +152,23 @@ class S3SClient:
|
|
|
134
152
|
prefix : typing.Optional[str]
|
|
135
153
|
S3 bucket prefix
|
|
136
154
|
|
|
137
|
-
|
|
138
|
-
|
|
155
|
+
regex_filter : typing.Optional[str]
|
|
156
|
+
Cloud storage regex for filtering objects
|
|
139
157
|
|
|
140
|
-
|
|
141
|
-
|
|
158
|
+
use_blob_urls : typing.Optional[bool]
|
|
159
|
+
Interpret objects as BLOBs and generate URLs
|
|
160
|
+
|
|
161
|
+
aws_access_key_id : typing.Optional[str]
|
|
162
|
+
AWS_ACCESS_KEY_ID
|
|
163
|
+
|
|
164
|
+
aws_secret_access_key : typing.Optional[str]
|
|
165
|
+
AWS_SECRET_ACCESS_KEY
|
|
166
|
+
|
|
167
|
+
aws_session_token : typing.Optional[str]
|
|
168
|
+
AWS_SESSION_TOKEN
|
|
169
|
+
|
|
170
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
171
|
+
AWS SSE KMS Key ID
|
|
142
172
|
|
|
143
173
|
region_name : typing.Optional[str]
|
|
144
174
|
AWS Region
|
|
@@ -146,12 +176,23 @@ class S3SClient:
|
|
|
146
176
|
s3endpoint : typing.Optional[str]
|
|
147
177
|
S3 Endpoint
|
|
148
178
|
|
|
179
|
+
external_id : typing.Optional[str]
|
|
180
|
+
AWS ExternalId
|
|
181
|
+
|
|
182
|
+
legacy_auth : typing.Optional[bool]
|
|
183
|
+
|
|
184
|
+
presign_ttl : typing.Optional[int]
|
|
185
|
+
Presigned URLs TTL (in minutes)
|
|
186
|
+
|
|
187
|
+
recursive_scan : typing.Optional[bool]
|
|
188
|
+
Perform recursive scan over the bucket content
|
|
189
|
+
|
|
149
190
|
request_options : typing.Optional[RequestOptions]
|
|
150
191
|
Request-specific configuration.
|
|
151
192
|
|
|
152
193
|
Returns
|
|
153
194
|
-------
|
|
154
|
-
|
|
195
|
+
LseS3ImportStorage
|
|
155
196
|
|
|
156
197
|
|
|
157
198
|
Examples
|
|
@@ -161,29 +202,41 @@ class S3SClient:
|
|
|
161
202
|
client = LabelStudio(
|
|
162
203
|
api_key="YOUR_API_KEY",
|
|
163
204
|
)
|
|
164
|
-
client.import_storage.s3s.create(
|
|
205
|
+
client.import_storage.s3s.create(
|
|
206
|
+
role_arn="role_arn",
|
|
207
|
+
project=1,
|
|
208
|
+
)
|
|
165
209
|
"""
|
|
166
210
|
_response = self._client_wrapper.httpx_client.request(
|
|
167
|
-
"api/storages/s3s",
|
|
211
|
+
"api/storages/s3s/",
|
|
168
212
|
method="POST",
|
|
169
213
|
json={
|
|
170
|
-
"
|
|
171
|
-
"use_blob_urls": use_blob_urls,
|
|
214
|
+
"synchronizable": synchronizable,
|
|
172
215
|
"presign": presign,
|
|
173
|
-
"
|
|
174
|
-
"
|
|
216
|
+
"last_sync": last_sync,
|
|
217
|
+
"last_sync_count": last_sync_count,
|
|
218
|
+
"last_sync_job": last_sync_job,
|
|
219
|
+
"status": status,
|
|
220
|
+
"traceback": traceback,
|
|
221
|
+
"meta": meta,
|
|
175
222
|
"title": title,
|
|
176
223
|
"description": description,
|
|
177
|
-
"project": project,
|
|
178
224
|
"bucket": bucket,
|
|
179
225
|
"prefix": prefix,
|
|
180
|
-
"
|
|
181
|
-
"
|
|
226
|
+
"regex_filter": regex_filter,
|
|
227
|
+
"use_blob_urls": use_blob_urls,
|
|
228
|
+
"aws_access_key_id": aws_access_key_id,
|
|
229
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
230
|
+
"aws_session_token": aws_session_token,
|
|
231
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
182
232
|
"region_name": region_name,
|
|
183
233
|
"s3_endpoint": s3endpoint,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"
|
|
234
|
+
"external_id": external_id,
|
|
235
|
+
"role_arn": role_arn,
|
|
236
|
+
"legacy_auth": legacy_auth,
|
|
237
|
+
"presign_ttl": presign_ttl,
|
|
238
|
+
"recursive_scan": recursive_scan,
|
|
239
|
+
"project": project,
|
|
187
240
|
},
|
|
188
241
|
request_options=request_options,
|
|
189
242
|
omit=OMIT,
|
|
@@ -191,9 +244,9 @@ class S3SClient:
|
|
|
191
244
|
try:
|
|
192
245
|
if 200 <= _response.status_code < 300:
|
|
193
246
|
return typing.cast(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
type_=
|
|
247
|
+
LseS3ImportStorage,
|
|
248
|
+
construct_type(
|
|
249
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
197
250
|
object_=_response.json(),
|
|
198
251
|
),
|
|
199
252
|
)
|
|
@@ -202,22 +255,20 @@ class S3SClient:
|
|
|
202
255
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
203
256
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
204
257
|
|
|
205
|
-
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
258
|
+
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LseS3ImportStorage:
|
|
206
259
|
"""
|
|
207
|
-
|
|
208
|
-
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
260
|
+
Get a specific S3 import storage connection that was set up with IAM role access.
|
|
209
261
|
|
|
210
262
|
Parameters
|
|
211
263
|
----------
|
|
212
264
|
id : int
|
|
213
|
-
Import storage ID
|
|
214
265
|
|
|
215
266
|
request_options : typing.Optional[RequestOptions]
|
|
216
267
|
Request-specific configuration.
|
|
217
268
|
|
|
218
269
|
Returns
|
|
219
270
|
-------
|
|
220
|
-
|
|
271
|
+
LseS3ImportStorage
|
|
221
272
|
|
|
222
273
|
|
|
223
274
|
Examples
|
|
@@ -239,9 +290,9 @@ class S3SClient:
|
|
|
239
290
|
try:
|
|
240
291
|
if 200 <= _response.status_code < 300:
|
|
241
292
|
return typing.cast(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
type_=
|
|
293
|
+
LseS3ImportStorage,
|
|
294
|
+
construct_type(
|
|
295
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
245
296
|
object_=_response.json(),
|
|
246
297
|
),
|
|
247
298
|
)
|
|
@@ -252,17 +303,11 @@ class S3SClient:
|
|
|
252
303
|
|
|
253
304
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
254
305
|
"""
|
|
255
|
-
|
|
256
|
-
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
257
|
-
|
|
258
|
-
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
259
|
-
|
|
260
|
-
If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
|
|
306
|
+
Delete a specific S3 import storage connection that was set up with IAM role access.
|
|
261
307
|
|
|
262
308
|
Parameters
|
|
263
309
|
----------
|
|
264
310
|
id : int
|
|
265
|
-
Import storage ID
|
|
266
311
|
|
|
267
312
|
request_options : typing.Optional[RequestOptions]
|
|
268
313
|
Request-specific configuration.
|
|
@@ -299,56 +344,66 @@ class S3SClient:
|
|
|
299
344
|
self,
|
|
300
345
|
id: int,
|
|
301
346
|
*,
|
|
302
|
-
|
|
303
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
347
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
304
348
|
presign: typing.Optional[bool] = OMIT,
|
|
305
|
-
|
|
306
|
-
|
|
349
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
350
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
351
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
352
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
353
|
+
traceback: typing.Optional[str] = OMIT,
|
|
354
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
307
355
|
title: typing.Optional[str] = OMIT,
|
|
308
356
|
description: typing.Optional[str] = OMIT,
|
|
309
|
-
project: typing.Optional[int] = OMIT,
|
|
310
357
|
bucket: typing.Optional[str] = OMIT,
|
|
311
358
|
prefix: typing.Optional[str] = OMIT,
|
|
312
|
-
|
|
313
|
-
|
|
359
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
360
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
361
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
362
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
363
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
364
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
314
365
|
region_name: typing.Optional[str] = OMIT,
|
|
315
366
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
367
|
+
external_id: typing.Optional[str] = OMIT,
|
|
368
|
+
role_arn: typing.Optional[str] = OMIT,
|
|
369
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
370
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
371
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
372
|
+
project: typing.Optional[int] = OMIT,
|
|
316
373
|
request_options: typing.Optional[RequestOptions] = None,
|
|
317
|
-
) ->
|
|
374
|
+
) -> LseS3ImportStorage:
|
|
318
375
|
"""
|
|
319
|
-
|
|
320
|
-
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
321
|
-
|
|
322
|
-
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
376
|
+
Update a specific S3 import storage connection that was set up with IAM role access.
|
|
323
377
|
|
|
324
378
|
Parameters
|
|
325
379
|
----------
|
|
326
380
|
id : int
|
|
327
|
-
Import storage ID
|
|
328
|
-
|
|
329
|
-
regex_filter : typing.Optional[str]
|
|
330
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
331
381
|
|
|
332
|
-
|
|
333
|
-
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
382
|
+
synchronizable : typing.Optional[bool]
|
|
334
383
|
|
|
335
384
|
presign : typing.Optional[bool]
|
|
336
|
-
Presign URLs for download
|
|
337
385
|
|
|
338
|
-
|
|
339
|
-
|
|
386
|
+
last_sync : typing.Optional[dt.datetime]
|
|
387
|
+
Last sync finished time
|
|
340
388
|
|
|
341
|
-
|
|
342
|
-
|
|
389
|
+
last_sync_count : typing.Optional[int]
|
|
390
|
+
Count of tasks synced last time
|
|
391
|
+
|
|
392
|
+
last_sync_job : typing.Optional[str]
|
|
393
|
+
Last sync job ID
|
|
394
|
+
|
|
395
|
+
status : typing.Optional[StatusC5AEnum]
|
|
396
|
+
|
|
397
|
+
traceback : typing.Optional[str]
|
|
398
|
+
Traceback report for the last failed sync
|
|
399
|
+
|
|
400
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
343
401
|
|
|
344
402
|
title : typing.Optional[str]
|
|
345
|
-
|
|
403
|
+
Cloud storage title
|
|
346
404
|
|
|
347
405
|
description : typing.Optional[str]
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
project : typing.Optional[int]
|
|
351
|
-
Project ID
|
|
406
|
+
Cloud storage description
|
|
352
407
|
|
|
353
408
|
bucket : typing.Optional[str]
|
|
354
409
|
S3 bucket name
|
|
@@ -356,11 +411,23 @@ class S3SClient:
|
|
|
356
411
|
prefix : typing.Optional[str]
|
|
357
412
|
S3 bucket prefix
|
|
358
413
|
|
|
359
|
-
|
|
360
|
-
|
|
414
|
+
regex_filter : typing.Optional[str]
|
|
415
|
+
Cloud storage regex for filtering objects
|
|
361
416
|
|
|
362
|
-
|
|
363
|
-
|
|
417
|
+
use_blob_urls : typing.Optional[bool]
|
|
418
|
+
Interpret objects as BLOBs and generate URLs
|
|
419
|
+
|
|
420
|
+
aws_access_key_id : typing.Optional[str]
|
|
421
|
+
AWS_ACCESS_KEY_ID
|
|
422
|
+
|
|
423
|
+
aws_secret_access_key : typing.Optional[str]
|
|
424
|
+
AWS_SECRET_ACCESS_KEY
|
|
425
|
+
|
|
426
|
+
aws_session_token : typing.Optional[str]
|
|
427
|
+
AWS_SESSION_TOKEN
|
|
428
|
+
|
|
429
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
430
|
+
AWS SSE KMS Key ID
|
|
364
431
|
|
|
365
432
|
region_name : typing.Optional[str]
|
|
366
433
|
AWS Region
|
|
@@ -368,12 +435,29 @@ class S3SClient:
|
|
|
368
435
|
s3endpoint : typing.Optional[str]
|
|
369
436
|
S3 Endpoint
|
|
370
437
|
|
|
438
|
+
external_id : typing.Optional[str]
|
|
439
|
+
AWS ExternalId
|
|
440
|
+
|
|
441
|
+
role_arn : typing.Optional[str]
|
|
442
|
+
AWS RoleArn
|
|
443
|
+
|
|
444
|
+
legacy_auth : typing.Optional[bool]
|
|
445
|
+
|
|
446
|
+
presign_ttl : typing.Optional[int]
|
|
447
|
+
Presigned URLs TTL (in minutes)
|
|
448
|
+
|
|
449
|
+
recursive_scan : typing.Optional[bool]
|
|
450
|
+
Perform recursive scan over the bucket content
|
|
451
|
+
|
|
452
|
+
project : typing.Optional[int]
|
|
453
|
+
A unique integer value identifying this project.
|
|
454
|
+
|
|
371
455
|
request_options : typing.Optional[RequestOptions]
|
|
372
456
|
Request-specific configuration.
|
|
373
457
|
|
|
374
458
|
Returns
|
|
375
459
|
-------
|
|
376
|
-
|
|
460
|
+
LseS3ImportStorage
|
|
377
461
|
|
|
378
462
|
|
|
379
463
|
Examples
|
|
@@ -391,20 +475,32 @@ class S3SClient:
|
|
|
391
475
|
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
392
476
|
method="PATCH",
|
|
393
477
|
json={
|
|
394
|
-
"
|
|
395
|
-
"use_blob_urls": use_blob_urls,
|
|
478
|
+
"synchronizable": synchronizable,
|
|
396
479
|
"presign": presign,
|
|
397
|
-
"
|
|
398
|
-
"
|
|
480
|
+
"last_sync": last_sync,
|
|
481
|
+
"last_sync_count": last_sync_count,
|
|
482
|
+
"last_sync_job": last_sync_job,
|
|
483
|
+
"status": status,
|
|
484
|
+
"traceback": traceback,
|
|
485
|
+
"meta": meta,
|
|
399
486
|
"title": title,
|
|
400
487
|
"description": description,
|
|
401
|
-
"project": project,
|
|
402
488
|
"bucket": bucket,
|
|
403
489
|
"prefix": prefix,
|
|
404
|
-
"
|
|
405
|
-
"
|
|
490
|
+
"regex_filter": regex_filter,
|
|
491
|
+
"use_blob_urls": use_blob_urls,
|
|
492
|
+
"aws_access_key_id": aws_access_key_id,
|
|
493
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
494
|
+
"aws_session_token": aws_session_token,
|
|
495
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
406
496
|
"region_name": region_name,
|
|
407
497
|
"s3_endpoint": s3endpoint,
|
|
498
|
+
"external_id": external_id,
|
|
499
|
+
"role_arn": role_arn,
|
|
500
|
+
"legacy_auth": legacy_auth,
|
|
501
|
+
"presign_ttl": presign_ttl,
|
|
502
|
+
"recursive_scan": recursive_scan,
|
|
503
|
+
"project": project,
|
|
408
504
|
},
|
|
409
505
|
headers={
|
|
410
506
|
"content-type": "application/json",
|
|
@@ -415,9 +511,55 @@ class S3SClient:
|
|
|
415
511
|
try:
|
|
416
512
|
if 200 <= _response.status_code < 300:
|
|
417
513
|
return typing.cast(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
type_=
|
|
514
|
+
LseS3ImportStorage,
|
|
515
|
+
construct_type(
|
|
516
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
517
|
+
object_=_response.json(),
|
|
518
|
+
),
|
|
519
|
+
)
|
|
520
|
+
_response_json = _response.json()
|
|
521
|
+
except JSONDecodeError:
|
|
522
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
523
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
524
|
+
|
|
525
|
+
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LseS3ImportStorage:
|
|
526
|
+
"""
|
|
527
|
+
Sync tasks from an S3 import storage connection that was set up with IAM role access.
|
|
528
|
+
|
|
529
|
+
Parameters
|
|
530
|
+
----------
|
|
531
|
+
id : int
|
|
532
|
+
|
|
533
|
+
request_options : typing.Optional[RequestOptions]
|
|
534
|
+
Request-specific configuration.
|
|
535
|
+
|
|
536
|
+
Returns
|
|
537
|
+
-------
|
|
538
|
+
LseS3ImportStorage
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
Examples
|
|
542
|
+
--------
|
|
543
|
+
from label_studio_sdk import LabelStudio
|
|
544
|
+
|
|
545
|
+
client = LabelStudio(
|
|
546
|
+
api_key="YOUR_API_KEY",
|
|
547
|
+
)
|
|
548
|
+
client.import_storage.s3s.sync(
|
|
549
|
+
id=1,
|
|
550
|
+
)
|
|
551
|
+
"""
|
|
552
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
553
|
+
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
554
|
+
method="POST",
|
|
555
|
+
request_options=request_options,
|
|
556
|
+
)
|
|
557
|
+
try:
|
|
558
|
+
if 200 <= _response.status_code < 300:
|
|
559
|
+
return typing.cast(
|
|
560
|
+
LseS3ImportStorage,
|
|
561
|
+
construct_type(
|
|
562
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
421
563
|
object_=_response.json(),
|
|
422
564
|
),
|
|
423
565
|
)
|
|
@@ -429,51 +571,70 @@ class S3SClient:
|
|
|
429
571
|
def validate(
|
|
430
572
|
self,
|
|
431
573
|
*,
|
|
432
|
-
|
|
433
|
-
|
|
574
|
+
role_arn: str,
|
|
575
|
+
project: int,
|
|
576
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
434
577
|
presign: typing.Optional[bool] = OMIT,
|
|
435
|
-
|
|
436
|
-
|
|
578
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
579
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
580
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
581
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
582
|
+
traceback: typing.Optional[str] = OMIT,
|
|
583
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
437
584
|
title: typing.Optional[str] = OMIT,
|
|
438
585
|
description: typing.Optional[str] = OMIT,
|
|
439
|
-
project: typing.Optional[int] = OMIT,
|
|
440
586
|
bucket: typing.Optional[str] = OMIT,
|
|
441
587
|
prefix: typing.Optional[str] = OMIT,
|
|
442
|
-
|
|
443
|
-
|
|
588
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
589
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
590
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
591
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
592
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
593
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
444
594
|
region_name: typing.Optional[str] = OMIT,
|
|
445
595
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
596
|
+
external_id: typing.Optional[str] = OMIT,
|
|
597
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
598
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
599
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
446
600
|
request_options: typing.Optional[RequestOptions] = None,
|
|
447
601
|
) -> None:
|
|
448
602
|
"""
|
|
449
|
-
|
|
450
|
-
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
603
|
+
Validate a specific S3 import storage connection that was set up with IAM role access.
|
|
451
604
|
|
|
452
605
|
Parameters
|
|
453
606
|
----------
|
|
454
|
-
|
|
455
|
-
|
|
607
|
+
role_arn : str
|
|
608
|
+
AWS RoleArn
|
|
456
609
|
|
|
457
|
-
|
|
458
|
-
|
|
610
|
+
project : int
|
|
611
|
+
A unique integer value identifying this project.
|
|
612
|
+
|
|
613
|
+
synchronizable : typing.Optional[bool]
|
|
459
614
|
|
|
460
615
|
presign : typing.Optional[bool]
|
|
461
|
-
Presign URLs for download
|
|
462
616
|
|
|
463
|
-
|
|
464
|
-
|
|
617
|
+
last_sync : typing.Optional[dt.datetime]
|
|
618
|
+
Last sync finished time
|
|
465
619
|
|
|
466
|
-
|
|
467
|
-
|
|
620
|
+
last_sync_count : typing.Optional[int]
|
|
621
|
+
Count of tasks synced last time
|
|
622
|
+
|
|
623
|
+
last_sync_job : typing.Optional[str]
|
|
624
|
+
Last sync job ID
|
|
625
|
+
|
|
626
|
+
status : typing.Optional[StatusC5AEnum]
|
|
627
|
+
|
|
628
|
+
traceback : typing.Optional[str]
|
|
629
|
+
Traceback report for the last failed sync
|
|
630
|
+
|
|
631
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
468
632
|
|
|
469
633
|
title : typing.Optional[str]
|
|
470
|
-
|
|
634
|
+
Cloud storage title
|
|
471
635
|
|
|
472
636
|
description : typing.Optional[str]
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
project : typing.Optional[int]
|
|
476
|
-
Project ID
|
|
637
|
+
Cloud storage description
|
|
477
638
|
|
|
478
639
|
bucket : typing.Optional[str]
|
|
479
640
|
S3 bucket name
|
|
@@ -481,11 +642,23 @@ class S3SClient:
|
|
|
481
642
|
prefix : typing.Optional[str]
|
|
482
643
|
S3 bucket prefix
|
|
483
644
|
|
|
484
|
-
|
|
485
|
-
|
|
645
|
+
regex_filter : typing.Optional[str]
|
|
646
|
+
Cloud storage regex for filtering objects
|
|
486
647
|
|
|
487
|
-
|
|
488
|
-
|
|
648
|
+
use_blob_urls : typing.Optional[bool]
|
|
649
|
+
Interpret objects as BLOBs and generate URLs
|
|
650
|
+
|
|
651
|
+
aws_access_key_id : typing.Optional[str]
|
|
652
|
+
AWS_ACCESS_KEY_ID
|
|
653
|
+
|
|
654
|
+
aws_secret_access_key : typing.Optional[str]
|
|
655
|
+
AWS_SECRET_ACCESS_KEY
|
|
656
|
+
|
|
657
|
+
aws_session_token : typing.Optional[str]
|
|
658
|
+
AWS_SESSION_TOKEN
|
|
659
|
+
|
|
660
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
661
|
+
AWS SSE KMS Key ID
|
|
489
662
|
|
|
490
663
|
region_name : typing.Optional[str]
|
|
491
664
|
AWS Region
|
|
@@ -493,6 +666,17 @@ class S3SClient:
|
|
|
493
666
|
s3endpoint : typing.Optional[str]
|
|
494
667
|
S3 Endpoint
|
|
495
668
|
|
|
669
|
+
external_id : typing.Optional[str]
|
|
670
|
+
AWS ExternalId
|
|
671
|
+
|
|
672
|
+
legacy_auth : typing.Optional[bool]
|
|
673
|
+
|
|
674
|
+
presign_ttl : typing.Optional[int]
|
|
675
|
+
Presigned URLs TTL (in minutes)
|
|
676
|
+
|
|
677
|
+
recursive_scan : typing.Optional[bool]
|
|
678
|
+
Perform recursive scan over the bucket content
|
|
679
|
+
|
|
496
680
|
request_options : typing.Optional[RequestOptions]
|
|
497
681
|
Request-specific configuration.
|
|
498
682
|
|
|
@@ -507,29 +691,41 @@ class S3SClient:
|
|
|
507
691
|
client = LabelStudio(
|
|
508
692
|
api_key="YOUR_API_KEY",
|
|
509
693
|
)
|
|
510
|
-
client.import_storage.s3s.validate(
|
|
694
|
+
client.import_storage.s3s.validate(
|
|
695
|
+
role_arn="role_arn",
|
|
696
|
+
project=1,
|
|
697
|
+
)
|
|
511
698
|
"""
|
|
512
699
|
_response = self._client_wrapper.httpx_client.request(
|
|
513
700
|
"api/storages/s3s/validate",
|
|
514
701
|
method="POST",
|
|
515
702
|
json={
|
|
516
|
-
"
|
|
517
|
-
"use_blob_urls": use_blob_urls,
|
|
703
|
+
"synchronizable": synchronizable,
|
|
518
704
|
"presign": presign,
|
|
519
|
-
"
|
|
520
|
-
"
|
|
705
|
+
"last_sync": last_sync,
|
|
706
|
+
"last_sync_count": last_sync_count,
|
|
707
|
+
"last_sync_job": last_sync_job,
|
|
708
|
+
"status": status,
|
|
709
|
+
"traceback": traceback,
|
|
710
|
+
"meta": meta,
|
|
521
711
|
"title": title,
|
|
522
712
|
"description": description,
|
|
523
|
-
"project": project,
|
|
524
713
|
"bucket": bucket,
|
|
525
714
|
"prefix": prefix,
|
|
526
|
-
"
|
|
527
|
-
"
|
|
715
|
+
"regex_filter": regex_filter,
|
|
716
|
+
"use_blob_urls": use_blob_urls,
|
|
717
|
+
"aws_access_key_id": aws_access_key_id,
|
|
718
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
719
|
+
"aws_session_token": aws_session_token,
|
|
720
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
528
721
|
"region_name": region_name,
|
|
529
722
|
"s3_endpoint": s3endpoint,
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
"
|
|
723
|
+
"external_id": external_id,
|
|
724
|
+
"role_arn": role_arn,
|
|
725
|
+
"legacy_auth": legacy_auth,
|
|
726
|
+
"presign_ttl": presign_ttl,
|
|
727
|
+
"recursive_scan": recursive_scan,
|
|
728
|
+
"project": project,
|
|
533
729
|
},
|
|
534
730
|
request_options=request_options,
|
|
535
731
|
omit=OMIT,
|
|
@@ -542,90 +738,44 @@ class S3SClient:
|
|
|
542
738
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
543
739
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
544
740
|
|
|
545
|
-
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
546
|
-
"""
|
|
547
741
|
|
|
548
|
-
|
|
742
|
+
class AsyncS3SClient:
|
|
743
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
744
|
+
self._client_wrapper = client_wrapper
|
|
745
|
+
|
|
746
|
+
async def list(
|
|
747
|
+
self,
|
|
748
|
+
*,
|
|
749
|
+
ordering: typing.Optional[str] = None,
|
|
750
|
+
project: typing.Optional[int] = None,
|
|
751
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
752
|
+
) -> typing.List[LseS3ImportStorage]:
|
|
753
|
+
"""
|
|
754
|
+
Get list of all S3 import storage connections set up with IAM role access.
|
|
549
755
|
|
|
550
756
|
Parameters
|
|
551
757
|
----------
|
|
552
|
-
|
|
553
|
-
|
|
758
|
+
ordering : typing.Optional[str]
|
|
759
|
+
Which field to use when ordering the results.
|
|
760
|
+
|
|
761
|
+
project : typing.Optional[int]
|
|
762
|
+
Project ID
|
|
554
763
|
|
|
555
764
|
request_options : typing.Optional[RequestOptions]
|
|
556
765
|
Request-specific configuration.
|
|
557
766
|
|
|
558
767
|
Returns
|
|
559
768
|
-------
|
|
560
|
-
|
|
769
|
+
typing.List[LseS3ImportStorage]
|
|
561
770
|
|
|
562
771
|
|
|
563
772
|
Examples
|
|
564
773
|
--------
|
|
565
|
-
|
|
774
|
+
import asyncio
|
|
566
775
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
client.import_storage.s3s.sync(
|
|
571
|
-
id=1,
|
|
572
|
-
)
|
|
573
|
-
"""
|
|
574
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
575
|
-
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
576
|
-
method="POST",
|
|
577
|
-
request_options=request_options,
|
|
578
|
-
)
|
|
579
|
-
try:
|
|
580
|
-
if 200 <= _response.status_code < 300:
|
|
581
|
-
return typing.cast(
|
|
582
|
-
S3SImportStorage,
|
|
583
|
-
parse_obj_as(
|
|
584
|
-
type_=S3SImportStorage, # type: ignore
|
|
585
|
-
object_=_response.json(),
|
|
586
|
-
),
|
|
587
|
-
)
|
|
588
|
-
_response_json = _response.json()
|
|
589
|
-
except JSONDecodeError:
|
|
590
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
591
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
class AsyncS3SClient:
|
|
595
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
596
|
-
self._client_wrapper = client_wrapper
|
|
597
|
-
|
|
598
|
-
async def list(
|
|
599
|
-
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
600
|
-
) -> typing.List[S3SImportStorage]:
|
|
601
|
-
"""
|
|
602
|
-
|
|
603
|
-
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
604
|
-
|
|
605
|
-
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
606
|
-
|
|
607
|
-
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
608
|
-
|
|
609
|
-
Parameters
|
|
610
|
-
----------
|
|
611
|
-
project : typing.Optional[int]
|
|
612
|
-
Project ID
|
|
613
|
-
|
|
614
|
-
request_options : typing.Optional[RequestOptions]
|
|
615
|
-
Request-specific configuration.
|
|
616
|
-
|
|
617
|
-
Returns
|
|
618
|
-
-------
|
|
619
|
-
typing.List[S3SImportStorage]
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
Examples
|
|
623
|
-
--------
|
|
624
|
-
import asyncio
|
|
625
|
-
|
|
626
|
-
from label_studio_sdk import AsyncLabelStudio
|
|
627
|
-
|
|
628
|
-
client = AsyncLabelStudio(
|
|
776
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
777
|
+
|
|
778
|
+
client = AsyncLabelStudio(
|
|
629
779
|
api_key="YOUR_API_KEY",
|
|
630
780
|
)
|
|
631
781
|
|
|
@@ -637,9 +787,10 @@ class AsyncS3SClient:
|
|
|
637
787
|
asyncio.run(main())
|
|
638
788
|
"""
|
|
639
789
|
_response = await self._client_wrapper.httpx_client.request(
|
|
640
|
-
"api/storages/s3s",
|
|
790
|
+
"api/storages/s3s/",
|
|
641
791
|
method="GET",
|
|
642
792
|
params={
|
|
793
|
+
"ordering": ordering,
|
|
643
794
|
"project": project,
|
|
644
795
|
},
|
|
645
796
|
request_options=request_options,
|
|
@@ -647,9 +798,9 @@ class AsyncS3SClient:
|
|
|
647
798
|
try:
|
|
648
799
|
if 200 <= _response.status_code < 300:
|
|
649
800
|
return typing.cast(
|
|
650
|
-
typing.List[
|
|
651
|
-
|
|
652
|
-
type_=typing.List[
|
|
801
|
+
typing.List[LseS3ImportStorage],
|
|
802
|
+
construct_type(
|
|
803
|
+
type_=typing.List[LseS3ImportStorage], # type: ignore
|
|
653
804
|
object_=_response.json(),
|
|
654
805
|
),
|
|
655
806
|
)
|
|
@@ -661,57 +812,70 @@ class AsyncS3SClient:
|
|
|
661
812
|
async def create(
|
|
662
813
|
self,
|
|
663
814
|
*,
|
|
664
|
-
|
|
665
|
-
|
|
815
|
+
role_arn: str,
|
|
816
|
+
project: int,
|
|
817
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
666
818
|
presign: typing.Optional[bool] = OMIT,
|
|
667
|
-
|
|
668
|
-
|
|
819
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
820
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
821
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
822
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
823
|
+
traceback: typing.Optional[str] = OMIT,
|
|
824
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
669
825
|
title: typing.Optional[str] = OMIT,
|
|
670
826
|
description: typing.Optional[str] = OMIT,
|
|
671
|
-
project: typing.Optional[int] = OMIT,
|
|
672
827
|
bucket: typing.Optional[str] = OMIT,
|
|
673
828
|
prefix: typing.Optional[str] = OMIT,
|
|
674
|
-
|
|
675
|
-
|
|
829
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
830
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
831
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
832
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
833
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
834
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
676
835
|
region_name: typing.Optional[str] = OMIT,
|
|
677
836
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
837
|
+
external_id: typing.Optional[str] = OMIT,
|
|
838
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
839
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
840
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
678
841
|
request_options: typing.Optional[RequestOptions] = None,
|
|
679
|
-
) ->
|
|
842
|
+
) -> LseS3ImportStorage:
|
|
680
843
|
"""
|
|
844
|
+
Create S3 import storage with IAM role access.
|
|
681
845
|
|
|
682
|
-
|
|
846
|
+
Parameters
|
|
847
|
+
----------
|
|
848
|
+
role_arn : str
|
|
849
|
+
AWS RoleArn
|
|
683
850
|
|
|
684
|
-
|
|
851
|
+
project : int
|
|
852
|
+
A unique integer value identifying this project.
|
|
685
853
|
|
|
686
|
-
|
|
854
|
+
synchronizable : typing.Optional[bool]
|
|
687
855
|
|
|
688
|
-
|
|
856
|
+
presign : typing.Optional[bool]
|
|
689
857
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
regex_filter : typing.Optional[str]
|
|
693
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
858
|
+
last_sync : typing.Optional[dt.datetime]
|
|
859
|
+
Last sync finished time
|
|
694
860
|
|
|
695
|
-
|
|
696
|
-
|
|
861
|
+
last_sync_count : typing.Optional[int]
|
|
862
|
+
Count of tasks synced last time
|
|
697
863
|
|
|
698
|
-
|
|
699
|
-
|
|
864
|
+
last_sync_job : typing.Optional[str]
|
|
865
|
+
Last sync job ID
|
|
700
866
|
|
|
701
|
-
|
|
702
|
-
Presign TTL in minutes
|
|
867
|
+
status : typing.Optional[StatusC5AEnum]
|
|
703
868
|
|
|
704
|
-
|
|
705
|
-
|
|
869
|
+
traceback : typing.Optional[str]
|
|
870
|
+
Traceback report for the last failed sync
|
|
871
|
+
|
|
872
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
706
873
|
|
|
707
874
|
title : typing.Optional[str]
|
|
708
|
-
|
|
875
|
+
Cloud storage title
|
|
709
876
|
|
|
710
877
|
description : typing.Optional[str]
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
project : typing.Optional[int]
|
|
714
|
-
Project ID
|
|
878
|
+
Cloud storage description
|
|
715
879
|
|
|
716
880
|
bucket : typing.Optional[str]
|
|
717
881
|
S3 bucket name
|
|
@@ -719,11 +883,23 @@ class AsyncS3SClient:
|
|
|
719
883
|
prefix : typing.Optional[str]
|
|
720
884
|
S3 bucket prefix
|
|
721
885
|
|
|
722
|
-
|
|
723
|
-
|
|
886
|
+
regex_filter : typing.Optional[str]
|
|
887
|
+
Cloud storage regex for filtering objects
|
|
724
888
|
|
|
725
|
-
|
|
726
|
-
|
|
889
|
+
use_blob_urls : typing.Optional[bool]
|
|
890
|
+
Interpret objects as BLOBs and generate URLs
|
|
891
|
+
|
|
892
|
+
aws_access_key_id : typing.Optional[str]
|
|
893
|
+
AWS_ACCESS_KEY_ID
|
|
894
|
+
|
|
895
|
+
aws_secret_access_key : typing.Optional[str]
|
|
896
|
+
AWS_SECRET_ACCESS_KEY
|
|
897
|
+
|
|
898
|
+
aws_session_token : typing.Optional[str]
|
|
899
|
+
AWS_SESSION_TOKEN
|
|
900
|
+
|
|
901
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
902
|
+
AWS SSE KMS Key ID
|
|
727
903
|
|
|
728
904
|
region_name : typing.Optional[str]
|
|
729
905
|
AWS Region
|
|
@@ -731,12 +907,23 @@ class AsyncS3SClient:
|
|
|
731
907
|
s3endpoint : typing.Optional[str]
|
|
732
908
|
S3 Endpoint
|
|
733
909
|
|
|
910
|
+
external_id : typing.Optional[str]
|
|
911
|
+
AWS ExternalId
|
|
912
|
+
|
|
913
|
+
legacy_auth : typing.Optional[bool]
|
|
914
|
+
|
|
915
|
+
presign_ttl : typing.Optional[int]
|
|
916
|
+
Presigned URLs TTL (in minutes)
|
|
917
|
+
|
|
918
|
+
recursive_scan : typing.Optional[bool]
|
|
919
|
+
Perform recursive scan over the bucket content
|
|
920
|
+
|
|
734
921
|
request_options : typing.Optional[RequestOptions]
|
|
735
922
|
Request-specific configuration.
|
|
736
923
|
|
|
737
924
|
Returns
|
|
738
925
|
-------
|
|
739
|
-
|
|
926
|
+
LseS3ImportStorage
|
|
740
927
|
|
|
741
928
|
|
|
742
929
|
Examples
|
|
@@ -751,32 +938,44 @@ class AsyncS3SClient:
|
|
|
751
938
|
|
|
752
939
|
|
|
753
940
|
async def main() -> None:
|
|
754
|
-
await client.import_storage.s3s.create(
|
|
941
|
+
await client.import_storage.s3s.create(
|
|
942
|
+
role_arn="role_arn",
|
|
943
|
+
project=1,
|
|
944
|
+
)
|
|
755
945
|
|
|
756
946
|
|
|
757
947
|
asyncio.run(main())
|
|
758
948
|
"""
|
|
759
949
|
_response = await self._client_wrapper.httpx_client.request(
|
|
760
|
-
"api/storages/s3s",
|
|
950
|
+
"api/storages/s3s/",
|
|
761
951
|
method="POST",
|
|
762
952
|
json={
|
|
763
|
-
"
|
|
764
|
-
"use_blob_urls": use_blob_urls,
|
|
953
|
+
"synchronizable": synchronizable,
|
|
765
954
|
"presign": presign,
|
|
766
|
-
"
|
|
767
|
-
"
|
|
955
|
+
"last_sync": last_sync,
|
|
956
|
+
"last_sync_count": last_sync_count,
|
|
957
|
+
"last_sync_job": last_sync_job,
|
|
958
|
+
"status": status,
|
|
959
|
+
"traceback": traceback,
|
|
960
|
+
"meta": meta,
|
|
768
961
|
"title": title,
|
|
769
962
|
"description": description,
|
|
770
|
-
"project": project,
|
|
771
963
|
"bucket": bucket,
|
|
772
964
|
"prefix": prefix,
|
|
773
|
-
"
|
|
774
|
-
"
|
|
965
|
+
"regex_filter": regex_filter,
|
|
966
|
+
"use_blob_urls": use_blob_urls,
|
|
967
|
+
"aws_access_key_id": aws_access_key_id,
|
|
968
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
969
|
+
"aws_session_token": aws_session_token,
|
|
970
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
775
971
|
"region_name": region_name,
|
|
776
972
|
"s3_endpoint": s3endpoint,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
"
|
|
973
|
+
"external_id": external_id,
|
|
974
|
+
"role_arn": role_arn,
|
|
975
|
+
"legacy_auth": legacy_auth,
|
|
976
|
+
"presign_ttl": presign_ttl,
|
|
977
|
+
"recursive_scan": recursive_scan,
|
|
978
|
+
"project": project,
|
|
780
979
|
},
|
|
781
980
|
request_options=request_options,
|
|
782
981
|
omit=OMIT,
|
|
@@ -784,9 +983,9 @@ class AsyncS3SClient:
|
|
|
784
983
|
try:
|
|
785
984
|
if 200 <= _response.status_code < 300:
|
|
786
985
|
return typing.cast(
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
type_=
|
|
986
|
+
LseS3ImportStorage,
|
|
987
|
+
construct_type(
|
|
988
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
790
989
|
object_=_response.json(),
|
|
791
990
|
),
|
|
792
991
|
)
|
|
@@ -795,22 +994,20 @@ class AsyncS3SClient:
|
|
|
795
994
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
796
995
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
797
996
|
|
|
798
|
-
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
997
|
+
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LseS3ImportStorage:
|
|
799
998
|
"""
|
|
800
|
-
|
|
801
|
-
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
999
|
+
Get a specific S3 import storage connection that was set up with IAM role access.
|
|
802
1000
|
|
|
803
1001
|
Parameters
|
|
804
1002
|
----------
|
|
805
1003
|
id : int
|
|
806
|
-
Import storage ID
|
|
807
1004
|
|
|
808
1005
|
request_options : typing.Optional[RequestOptions]
|
|
809
1006
|
Request-specific configuration.
|
|
810
1007
|
|
|
811
1008
|
Returns
|
|
812
1009
|
-------
|
|
813
|
-
|
|
1010
|
+
LseS3ImportStorage
|
|
814
1011
|
|
|
815
1012
|
|
|
816
1013
|
Examples
|
|
@@ -840,9 +1037,9 @@ class AsyncS3SClient:
|
|
|
840
1037
|
try:
|
|
841
1038
|
if 200 <= _response.status_code < 300:
|
|
842
1039
|
return typing.cast(
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
type_=
|
|
1040
|
+
LseS3ImportStorage,
|
|
1041
|
+
construct_type(
|
|
1042
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
846
1043
|
object_=_response.json(),
|
|
847
1044
|
),
|
|
848
1045
|
)
|
|
@@ -853,17 +1050,11 @@ class AsyncS3SClient:
|
|
|
853
1050
|
|
|
854
1051
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
855
1052
|
"""
|
|
856
|
-
|
|
857
|
-
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
858
|
-
|
|
859
|
-
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
860
|
-
|
|
861
|
-
If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
|
|
1053
|
+
Delete a specific S3 import storage connection that was set up with IAM role access.
|
|
862
1054
|
|
|
863
1055
|
Parameters
|
|
864
1056
|
----------
|
|
865
1057
|
id : int
|
|
866
|
-
Import storage ID
|
|
867
1058
|
|
|
868
1059
|
request_options : typing.Optional[RequestOptions]
|
|
869
1060
|
Request-specific configuration.
|
|
@@ -908,56 +1099,66 @@ class AsyncS3SClient:
|
|
|
908
1099
|
self,
|
|
909
1100
|
id: int,
|
|
910
1101
|
*,
|
|
911
|
-
|
|
912
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
1102
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
913
1103
|
presign: typing.Optional[bool] = OMIT,
|
|
914
|
-
|
|
915
|
-
|
|
1104
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
1105
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
1106
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
1107
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
1108
|
+
traceback: typing.Optional[str] = OMIT,
|
|
1109
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
916
1110
|
title: typing.Optional[str] = OMIT,
|
|
917
1111
|
description: typing.Optional[str] = OMIT,
|
|
918
|
-
project: typing.Optional[int] = OMIT,
|
|
919
1112
|
bucket: typing.Optional[str] = OMIT,
|
|
920
1113
|
prefix: typing.Optional[str] = OMIT,
|
|
921
|
-
|
|
922
|
-
|
|
1114
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
1115
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
1116
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
1117
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
1118
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
1119
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
923
1120
|
region_name: typing.Optional[str] = OMIT,
|
|
924
1121
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
1122
|
+
external_id: typing.Optional[str] = OMIT,
|
|
1123
|
+
role_arn: typing.Optional[str] = OMIT,
|
|
1124
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
1125
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
1126
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
1127
|
+
project: typing.Optional[int] = OMIT,
|
|
925
1128
|
request_options: typing.Optional[RequestOptions] = None,
|
|
926
|
-
) ->
|
|
1129
|
+
) -> LseS3ImportStorage:
|
|
927
1130
|
"""
|
|
928
|
-
|
|
929
|
-
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
930
|
-
|
|
931
|
-
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
1131
|
+
Update a specific S3 import storage connection that was set up with IAM role access.
|
|
932
1132
|
|
|
933
1133
|
Parameters
|
|
934
1134
|
----------
|
|
935
1135
|
id : int
|
|
936
|
-
Import storage ID
|
|
937
1136
|
|
|
938
|
-
|
|
939
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
940
|
-
|
|
941
|
-
use_blob_urls : typing.Optional[bool]
|
|
942
|
-
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
1137
|
+
synchronizable : typing.Optional[bool]
|
|
943
1138
|
|
|
944
1139
|
presign : typing.Optional[bool]
|
|
945
|
-
Presign URLs for download
|
|
946
1140
|
|
|
947
|
-
|
|
948
|
-
|
|
1141
|
+
last_sync : typing.Optional[dt.datetime]
|
|
1142
|
+
Last sync finished time
|
|
949
1143
|
|
|
950
|
-
|
|
951
|
-
|
|
1144
|
+
last_sync_count : typing.Optional[int]
|
|
1145
|
+
Count of tasks synced last time
|
|
1146
|
+
|
|
1147
|
+
last_sync_job : typing.Optional[str]
|
|
1148
|
+
Last sync job ID
|
|
1149
|
+
|
|
1150
|
+
status : typing.Optional[StatusC5AEnum]
|
|
1151
|
+
|
|
1152
|
+
traceback : typing.Optional[str]
|
|
1153
|
+
Traceback report for the last failed sync
|
|
1154
|
+
|
|
1155
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
952
1156
|
|
|
953
1157
|
title : typing.Optional[str]
|
|
954
|
-
|
|
1158
|
+
Cloud storage title
|
|
955
1159
|
|
|
956
1160
|
description : typing.Optional[str]
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
project : typing.Optional[int]
|
|
960
|
-
Project ID
|
|
1161
|
+
Cloud storage description
|
|
961
1162
|
|
|
962
1163
|
bucket : typing.Optional[str]
|
|
963
1164
|
S3 bucket name
|
|
@@ -965,11 +1166,23 @@ class AsyncS3SClient:
|
|
|
965
1166
|
prefix : typing.Optional[str]
|
|
966
1167
|
S3 bucket prefix
|
|
967
1168
|
|
|
968
|
-
|
|
969
|
-
|
|
1169
|
+
regex_filter : typing.Optional[str]
|
|
1170
|
+
Cloud storage regex for filtering objects
|
|
970
1171
|
|
|
971
|
-
|
|
972
|
-
|
|
1172
|
+
use_blob_urls : typing.Optional[bool]
|
|
1173
|
+
Interpret objects as BLOBs and generate URLs
|
|
1174
|
+
|
|
1175
|
+
aws_access_key_id : typing.Optional[str]
|
|
1176
|
+
AWS_ACCESS_KEY_ID
|
|
1177
|
+
|
|
1178
|
+
aws_secret_access_key : typing.Optional[str]
|
|
1179
|
+
AWS_SECRET_ACCESS_KEY
|
|
1180
|
+
|
|
1181
|
+
aws_session_token : typing.Optional[str]
|
|
1182
|
+
AWS_SESSION_TOKEN
|
|
1183
|
+
|
|
1184
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
1185
|
+
AWS SSE KMS Key ID
|
|
973
1186
|
|
|
974
1187
|
region_name : typing.Optional[str]
|
|
975
1188
|
AWS Region
|
|
@@ -977,12 +1190,29 @@ class AsyncS3SClient:
|
|
|
977
1190
|
s3endpoint : typing.Optional[str]
|
|
978
1191
|
S3 Endpoint
|
|
979
1192
|
|
|
1193
|
+
external_id : typing.Optional[str]
|
|
1194
|
+
AWS ExternalId
|
|
1195
|
+
|
|
1196
|
+
role_arn : typing.Optional[str]
|
|
1197
|
+
AWS RoleArn
|
|
1198
|
+
|
|
1199
|
+
legacy_auth : typing.Optional[bool]
|
|
1200
|
+
|
|
1201
|
+
presign_ttl : typing.Optional[int]
|
|
1202
|
+
Presigned URLs TTL (in minutes)
|
|
1203
|
+
|
|
1204
|
+
recursive_scan : typing.Optional[bool]
|
|
1205
|
+
Perform recursive scan over the bucket content
|
|
1206
|
+
|
|
1207
|
+
project : typing.Optional[int]
|
|
1208
|
+
A unique integer value identifying this project.
|
|
1209
|
+
|
|
980
1210
|
request_options : typing.Optional[RequestOptions]
|
|
981
1211
|
Request-specific configuration.
|
|
982
1212
|
|
|
983
1213
|
Returns
|
|
984
1214
|
-------
|
|
985
|
-
|
|
1215
|
+
LseS3ImportStorage
|
|
986
1216
|
|
|
987
1217
|
|
|
988
1218
|
Examples
|
|
@@ -1008,20 +1238,32 @@ class AsyncS3SClient:
|
|
|
1008
1238
|
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
1009
1239
|
method="PATCH",
|
|
1010
1240
|
json={
|
|
1011
|
-
"
|
|
1012
|
-
"use_blob_urls": use_blob_urls,
|
|
1241
|
+
"synchronizable": synchronizable,
|
|
1013
1242
|
"presign": presign,
|
|
1014
|
-
"
|
|
1015
|
-
"
|
|
1243
|
+
"last_sync": last_sync,
|
|
1244
|
+
"last_sync_count": last_sync_count,
|
|
1245
|
+
"last_sync_job": last_sync_job,
|
|
1246
|
+
"status": status,
|
|
1247
|
+
"traceback": traceback,
|
|
1248
|
+
"meta": meta,
|
|
1016
1249
|
"title": title,
|
|
1017
1250
|
"description": description,
|
|
1018
|
-
"project": project,
|
|
1019
1251
|
"bucket": bucket,
|
|
1020
1252
|
"prefix": prefix,
|
|
1021
|
-
"
|
|
1022
|
-
"
|
|
1253
|
+
"regex_filter": regex_filter,
|
|
1254
|
+
"use_blob_urls": use_blob_urls,
|
|
1255
|
+
"aws_access_key_id": aws_access_key_id,
|
|
1256
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
1257
|
+
"aws_session_token": aws_session_token,
|
|
1258
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
1023
1259
|
"region_name": region_name,
|
|
1024
1260
|
"s3_endpoint": s3endpoint,
|
|
1261
|
+
"external_id": external_id,
|
|
1262
|
+
"role_arn": role_arn,
|
|
1263
|
+
"legacy_auth": legacy_auth,
|
|
1264
|
+
"presign_ttl": presign_ttl,
|
|
1265
|
+
"recursive_scan": recursive_scan,
|
|
1266
|
+
"project": project,
|
|
1025
1267
|
},
|
|
1026
1268
|
headers={
|
|
1027
1269
|
"content-type": "application/json",
|
|
@@ -1032,9 +1274,63 @@ class AsyncS3SClient:
|
|
|
1032
1274
|
try:
|
|
1033
1275
|
if 200 <= _response.status_code < 300:
|
|
1034
1276
|
return typing.cast(
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
type_=
|
|
1277
|
+
LseS3ImportStorage,
|
|
1278
|
+
construct_type(
|
|
1279
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
1280
|
+
object_=_response.json(),
|
|
1281
|
+
),
|
|
1282
|
+
)
|
|
1283
|
+
_response_json = _response.json()
|
|
1284
|
+
except JSONDecodeError:
|
|
1285
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1286
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1287
|
+
|
|
1288
|
+
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> LseS3ImportStorage:
|
|
1289
|
+
"""
|
|
1290
|
+
Sync tasks from an S3 import storage connection that was set up with IAM role access.
|
|
1291
|
+
|
|
1292
|
+
Parameters
|
|
1293
|
+
----------
|
|
1294
|
+
id : int
|
|
1295
|
+
|
|
1296
|
+
request_options : typing.Optional[RequestOptions]
|
|
1297
|
+
Request-specific configuration.
|
|
1298
|
+
|
|
1299
|
+
Returns
|
|
1300
|
+
-------
|
|
1301
|
+
LseS3ImportStorage
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
Examples
|
|
1305
|
+
--------
|
|
1306
|
+
import asyncio
|
|
1307
|
+
|
|
1308
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1309
|
+
|
|
1310
|
+
client = AsyncLabelStudio(
|
|
1311
|
+
api_key="YOUR_API_KEY",
|
|
1312
|
+
)
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
async def main() -> None:
|
|
1316
|
+
await client.import_storage.s3s.sync(
|
|
1317
|
+
id=1,
|
|
1318
|
+
)
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
asyncio.run(main())
|
|
1322
|
+
"""
|
|
1323
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1324
|
+
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
1325
|
+
method="POST",
|
|
1326
|
+
request_options=request_options,
|
|
1327
|
+
)
|
|
1328
|
+
try:
|
|
1329
|
+
if 200 <= _response.status_code < 300:
|
|
1330
|
+
return typing.cast(
|
|
1331
|
+
LseS3ImportStorage,
|
|
1332
|
+
construct_type(
|
|
1333
|
+
type_=LseS3ImportStorage, # type: ignore
|
|
1038
1334
|
object_=_response.json(),
|
|
1039
1335
|
),
|
|
1040
1336
|
)
|
|
@@ -1046,51 +1342,70 @@ class AsyncS3SClient:
|
|
|
1046
1342
|
async def validate(
|
|
1047
1343
|
self,
|
|
1048
1344
|
*,
|
|
1049
|
-
|
|
1050
|
-
|
|
1345
|
+
role_arn: str,
|
|
1346
|
+
project: int,
|
|
1347
|
+
synchronizable: typing.Optional[bool] = OMIT,
|
|
1051
1348
|
presign: typing.Optional[bool] = OMIT,
|
|
1052
|
-
|
|
1053
|
-
|
|
1349
|
+
last_sync: typing.Optional[dt.datetime] = OMIT,
|
|
1350
|
+
last_sync_count: typing.Optional[int] = OMIT,
|
|
1351
|
+
last_sync_job: typing.Optional[str] = OMIT,
|
|
1352
|
+
status: typing.Optional[StatusC5AEnum] = OMIT,
|
|
1353
|
+
traceback: typing.Optional[str] = OMIT,
|
|
1354
|
+
meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
1054
1355
|
title: typing.Optional[str] = OMIT,
|
|
1055
1356
|
description: typing.Optional[str] = OMIT,
|
|
1056
|
-
project: typing.Optional[int] = OMIT,
|
|
1057
1357
|
bucket: typing.Optional[str] = OMIT,
|
|
1058
1358
|
prefix: typing.Optional[str] = OMIT,
|
|
1059
|
-
|
|
1060
|
-
|
|
1359
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
1360
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
1361
|
+
aws_access_key_id: typing.Optional[str] = OMIT,
|
|
1362
|
+
aws_secret_access_key: typing.Optional[str] = OMIT,
|
|
1363
|
+
aws_session_token: typing.Optional[str] = OMIT,
|
|
1364
|
+
aws_sse_kms_key_id: typing.Optional[str] = OMIT,
|
|
1061
1365
|
region_name: typing.Optional[str] = OMIT,
|
|
1062
1366
|
s3endpoint: typing.Optional[str] = OMIT,
|
|
1367
|
+
external_id: typing.Optional[str] = OMIT,
|
|
1368
|
+
legacy_auth: typing.Optional[bool] = OMIT,
|
|
1369
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
1370
|
+
recursive_scan: typing.Optional[bool] = OMIT,
|
|
1063
1371
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1064
1372
|
) -> None:
|
|
1065
1373
|
"""
|
|
1066
|
-
|
|
1067
|
-
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
1374
|
+
Validate a specific S3 import storage connection that was set up with IAM role access.
|
|
1068
1375
|
|
|
1069
1376
|
Parameters
|
|
1070
1377
|
----------
|
|
1071
|
-
|
|
1072
|
-
|
|
1378
|
+
role_arn : str
|
|
1379
|
+
AWS RoleArn
|
|
1073
1380
|
|
|
1074
|
-
|
|
1075
|
-
|
|
1381
|
+
project : int
|
|
1382
|
+
A unique integer value identifying this project.
|
|
1383
|
+
|
|
1384
|
+
synchronizable : typing.Optional[bool]
|
|
1076
1385
|
|
|
1077
1386
|
presign : typing.Optional[bool]
|
|
1078
|
-
Presign URLs for download
|
|
1079
1387
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1388
|
+
last_sync : typing.Optional[dt.datetime]
|
|
1389
|
+
Last sync finished time
|
|
1082
1390
|
|
|
1083
|
-
|
|
1084
|
-
|
|
1391
|
+
last_sync_count : typing.Optional[int]
|
|
1392
|
+
Count of tasks synced last time
|
|
1393
|
+
|
|
1394
|
+
last_sync_job : typing.Optional[str]
|
|
1395
|
+
Last sync job ID
|
|
1396
|
+
|
|
1397
|
+
status : typing.Optional[StatusC5AEnum]
|
|
1398
|
+
|
|
1399
|
+
traceback : typing.Optional[str]
|
|
1400
|
+
Traceback report for the last failed sync
|
|
1401
|
+
|
|
1402
|
+
meta : typing.Optional[typing.Optional[typing.Any]]
|
|
1085
1403
|
|
|
1086
1404
|
title : typing.Optional[str]
|
|
1087
|
-
|
|
1405
|
+
Cloud storage title
|
|
1088
1406
|
|
|
1089
1407
|
description : typing.Optional[str]
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
project : typing.Optional[int]
|
|
1093
|
-
Project ID
|
|
1408
|
+
Cloud storage description
|
|
1094
1409
|
|
|
1095
1410
|
bucket : typing.Optional[str]
|
|
1096
1411
|
S3 bucket name
|
|
@@ -1098,11 +1413,23 @@ class AsyncS3SClient:
|
|
|
1098
1413
|
prefix : typing.Optional[str]
|
|
1099
1414
|
S3 bucket prefix
|
|
1100
1415
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1416
|
+
regex_filter : typing.Optional[str]
|
|
1417
|
+
Cloud storage regex for filtering objects
|
|
1103
1418
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1419
|
+
use_blob_urls : typing.Optional[bool]
|
|
1420
|
+
Interpret objects as BLOBs and generate URLs
|
|
1421
|
+
|
|
1422
|
+
aws_access_key_id : typing.Optional[str]
|
|
1423
|
+
AWS_ACCESS_KEY_ID
|
|
1424
|
+
|
|
1425
|
+
aws_secret_access_key : typing.Optional[str]
|
|
1426
|
+
AWS_SECRET_ACCESS_KEY
|
|
1427
|
+
|
|
1428
|
+
aws_session_token : typing.Optional[str]
|
|
1429
|
+
AWS_SESSION_TOKEN
|
|
1430
|
+
|
|
1431
|
+
aws_sse_kms_key_id : typing.Optional[str]
|
|
1432
|
+
AWS SSE KMS Key ID
|
|
1106
1433
|
|
|
1107
1434
|
region_name : typing.Optional[str]
|
|
1108
1435
|
AWS Region
|
|
@@ -1110,6 +1437,17 @@ class AsyncS3SClient:
|
|
|
1110
1437
|
s3endpoint : typing.Optional[str]
|
|
1111
1438
|
S3 Endpoint
|
|
1112
1439
|
|
|
1440
|
+
external_id : typing.Optional[str]
|
|
1441
|
+
AWS ExternalId
|
|
1442
|
+
|
|
1443
|
+
legacy_auth : typing.Optional[bool]
|
|
1444
|
+
|
|
1445
|
+
presign_ttl : typing.Optional[int]
|
|
1446
|
+
Presigned URLs TTL (in minutes)
|
|
1447
|
+
|
|
1448
|
+
recursive_scan : typing.Optional[bool]
|
|
1449
|
+
Perform recursive scan over the bucket content
|
|
1450
|
+
|
|
1113
1451
|
request_options : typing.Optional[RequestOptions]
|
|
1114
1452
|
Request-specific configuration.
|
|
1115
1453
|
|
|
@@ -1129,7 +1467,10 @@ class AsyncS3SClient:
|
|
|
1129
1467
|
|
|
1130
1468
|
|
|
1131
1469
|
async def main() -> None:
|
|
1132
|
-
await client.import_storage.s3s.validate(
|
|
1470
|
+
await client.import_storage.s3s.validate(
|
|
1471
|
+
role_arn="role_arn",
|
|
1472
|
+
project=1,
|
|
1473
|
+
)
|
|
1133
1474
|
|
|
1134
1475
|
|
|
1135
1476
|
asyncio.run(main())
|
|
@@ -1138,23 +1479,32 @@ class AsyncS3SClient:
|
|
|
1138
1479
|
"api/storages/s3s/validate",
|
|
1139
1480
|
method="POST",
|
|
1140
1481
|
json={
|
|
1141
|
-
"
|
|
1142
|
-
"use_blob_urls": use_blob_urls,
|
|
1482
|
+
"synchronizable": synchronizable,
|
|
1143
1483
|
"presign": presign,
|
|
1144
|
-
"
|
|
1145
|
-
"
|
|
1484
|
+
"last_sync": last_sync,
|
|
1485
|
+
"last_sync_count": last_sync_count,
|
|
1486
|
+
"last_sync_job": last_sync_job,
|
|
1487
|
+
"status": status,
|
|
1488
|
+
"traceback": traceback,
|
|
1489
|
+
"meta": meta,
|
|
1146
1490
|
"title": title,
|
|
1147
1491
|
"description": description,
|
|
1148
|
-
"project": project,
|
|
1149
1492
|
"bucket": bucket,
|
|
1150
1493
|
"prefix": prefix,
|
|
1151
|
-
"
|
|
1152
|
-
"
|
|
1494
|
+
"regex_filter": regex_filter,
|
|
1495
|
+
"use_blob_urls": use_blob_urls,
|
|
1496
|
+
"aws_access_key_id": aws_access_key_id,
|
|
1497
|
+
"aws_secret_access_key": aws_secret_access_key,
|
|
1498
|
+
"aws_session_token": aws_session_token,
|
|
1499
|
+
"aws_sse_kms_key_id": aws_sse_kms_key_id,
|
|
1153
1500
|
"region_name": region_name,
|
|
1154
1501
|
"s3_endpoint": s3endpoint,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
"
|
|
1502
|
+
"external_id": external_id,
|
|
1503
|
+
"role_arn": role_arn,
|
|
1504
|
+
"legacy_auth": legacy_auth,
|
|
1505
|
+
"presign_ttl": presign_ttl,
|
|
1506
|
+
"recursive_scan": recursive_scan,
|
|
1507
|
+
"project": project,
|
|
1158
1508
|
},
|
|
1159
1509
|
request_options=request_options,
|
|
1160
1510
|
omit=OMIT,
|
|
@@ -1166,59 +1516,3 @@ class AsyncS3SClient:
|
|
|
1166
1516
|
except JSONDecodeError:
|
|
1167
1517
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1168
1518
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1169
|
-
|
|
1170
|
-
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
1171
|
-
"""
|
|
1172
|
-
|
|
1173
|
-
Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
1174
|
-
|
|
1175
|
-
Parameters
|
|
1176
|
-
----------
|
|
1177
|
-
id : int
|
|
1178
|
-
Storage ID
|
|
1179
|
-
|
|
1180
|
-
request_options : typing.Optional[RequestOptions]
|
|
1181
|
-
Request-specific configuration.
|
|
1182
|
-
|
|
1183
|
-
Returns
|
|
1184
|
-
-------
|
|
1185
|
-
S3SImportStorage
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
Examples
|
|
1189
|
-
--------
|
|
1190
|
-
import asyncio
|
|
1191
|
-
|
|
1192
|
-
from label_studio_sdk import AsyncLabelStudio
|
|
1193
|
-
|
|
1194
|
-
client = AsyncLabelStudio(
|
|
1195
|
-
api_key="YOUR_API_KEY",
|
|
1196
|
-
)
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
async def main() -> None:
|
|
1200
|
-
await client.import_storage.s3s.sync(
|
|
1201
|
-
id=1,
|
|
1202
|
-
)
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
asyncio.run(main())
|
|
1206
|
-
"""
|
|
1207
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1208
|
-
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
1209
|
-
method="POST",
|
|
1210
|
-
request_options=request_options,
|
|
1211
|
-
)
|
|
1212
|
-
try:
|
|
1213
|
-
if 200 <= _response.status_code < 300:
|
|
1214
|
-
return typing.cast(
|
|
1215
|
-
S3SImportStorage,
|
|
1216
|
-
parse_obj_as(
|
|
1217
|
-
type_=S3SImportStorage, # type: ignore
|
|
1218
|
-
object_=_response.json(),
|
|
1219
|
-
),
|
|
1220
|
-
)
|
|
1221
|
-
_response_json = _response.json()
|
|
1222
|
-
except JSONDecodeError:
|
|
1223
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1224
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|