biodm.components.services.s3service module

class S3Service(app, table: Type[Base], *args, **kwargs)

Bases: CompositeEntityService

Class for automatic management of S3 bucket transactions for file resources.

async complete_multipart(**kwargs)
async download(**kwargs) str

Get File entry from DB, and return a direct download url.

Parameters:
  • pk_val (List[Any]) – key

  • user_info (UserInfo | None) – requesting user info

  • session (AsyncSession) – current db session

Raises:

FileNotUploadedError – File entry exists but has not been validated yet

Returns:

direct download url.

Return type:

str

async gen_key(item, session: AsyncSession)

Generate a unique bucket key from file elements.

async gen_upload_form(file: S3File, session: AsyncSession)

Populates an Upload for a newly created file. Handling simple post and multipart_upload cases.

Parameters:
  • file (S3File) – New file

  • session (AsyncSession) – current session

post_callback(item) str
async post_success(**kwargs)
async release(**kwargs) Base
s3() S3Manager