Module s3

Module s3 

Source
Expand description

AWS S3 SDK function wrappers for caching deployer artifacts

Structs§

Region
The region to send requests to.

Constants§

PRESIGN_DURATION
Duration for pre-signed URLs (6 hours)
S3_BUCKET_NAME
S3 bucket name for caching deployer artifacts
S3_DEPLOYMENTS_PREFIX
S3 prefix for per-deployment data
S3_TOOLS_BINARIES_PREFIX
S3 prefix for tool binaries: tools/binaries/{tool}/{version}/{platform}/{filename}
S3_TOOLS_CONFIGS_PREFIX
S3 prefix for tool configs: tools/configs/{deployer_version}/{component}/{file}

Functions§

cache_content_and_presign
Caches content to S3 if it doesn’t exist, then returns a pre-signed URL
cache_file_and_presign
Caches a file to S3 by digest if it doesn’t exist, then returns a pre-signed URL
create_s3_client
Creates an S3 client for the specified AWS region
delete_bucket
Deletes a bucket (must be empty first)
delete_bucket_and_contents
Deletes all objects in a bucket and then deletes the bucket itself
delete_prefix
Deletes all objects under a prefix in S3 using batch delete (up to 1000 objects per request)
ensure_bucket_exists
Ensures the S3 bucket exists, creating it if necessary
hash_file
Computes the SHA256 hash of a file and returns it as a hex string
is_no_such_bucket_error
Checks if an error is a “bucket does not exist” error
object_exists
Checks if an object exists in S3
presign_url
Generates a pre-signed URL for downloading an object from S3
upload_and_presign
Uploads a file to S3 and returns a pre-signed URL for downloading it
upload_file
Uploads a file to S3