plexus.reports.s3_utils module

plexus.reports.s3_utils.add_file_to_report_block(report_block_id, file_name, content: bytes, content_type=None, client=None)

Upload a file to S3 and add its path to an existing report block’s attachedFiles array.

Args:

report_block_id: ID of the existing report block file_name: Name of the file to create content: Bytes content to upload content_type: Optional MIME type for the file client: Optional PlexusDashboardClient instance

Returns:

Updated list of file paths in attachedFiles

plexus.reports.s3_utils.check_s3_bucket_access(bucket_name=None)

Diagnostic function to check if the S3 bucket exists and is accessible.

Args:

bucket_name: Name of the bucket to check, or None to use the default

Returns:

Dict with diagnostic information

plexus.reports.s3_utils.download_report_block_file(s3_path, local_path=None)

Download a file from the report block details S3 bucket.

Args:

s3_path: S3 key path for the file (e.g., ‘reportblocks/123/log.txt’) local_path: Optional local path to save the file to

Returns:

The content of the file as a string, and the local path if saved

plexus.reports.s3_utils.get_bucket_name()

Get the S3 bucket name for report block details from environment variables or fall back to the default.

plexus.reports.s3_utils.upload_report_block_file(report_block_id, file_name, content, content_type=None)

Upload a file to the report block details S3 bucket using the format expected by Amplify Gen2.

Args:

report_block_id: ID of the report block this file belongs to file_name: Name of the file to create content: Bytes content to upload content_type: Optional MIME type for the file

Returns:

The S3 path (key) for the file, formatted for Amplify Gen2