biodm.managers.s3manager module

class S3Manager(app: Api, endpoint_url: str, bucket_name: str, access_key_id: Secret, secret_access_key: Secret, url_expiration: int, pending_expiration: int, region_name: str, file_size_limit: int)

Bases: ApiManager

Manages requests with an S3 storage instance.

abort_multipart_upload(object_name: str, upload_id: str) Dict[str, str]

Multipart upload termination notice

Parameters:
  • object_name (str) – object key

  • upload_id (str) – multipart upload id

Raises:

FailedCreate – Bucket returns an error

Returns:

Bucket response

Return type:

Dict[str, str]

complete_multipart_upload(object_name: str, upload_id: str, parts: List[Dict[str, str]]) Dict[str, str]

Multipart upload Completion notice

Parameters:
  • object_name (str) – object key

  • upload_id (str) – multipart upload id

  • parts (List[Dict[str, str]]) – Part - ETag mapping for all parts

Raises:

FileUploadCompleteError – Bucket returns an error

Returns:

Bucket response

Return type:

Dict[str, str]

create_multipart_upload(object_name: str) Dict[str, str]

Create multipart upload

Parameters:

object_name (str) – object key

Raises:

FailedCreate – When client fails to create multipart upload

Returns:

Multipart upload descriptior, containing ‘UploadId’

Return type:

Dict[str, str]

create_presigned_download_url(object_name: str) str

Generate a presigned URL to share an S3 object

Parameters:

object_name (String) – Object Key

Returns:

Presigned URL as string.

create_upload_part(object_name, upload_id, part_number)
property endpoint: str

External service endpoint.

list_multipart_parts(object_name: str, upload_id: str) Dict[str, str]