Skip to main content

Module s3

Module s3 

Source
Expand description

AWS S3 upload via pure-Rust Signature V4 โ€” no AWS SDK dependency.

Mirrors the Python s3_upload.py module from resource-tracker PR #9.

Structsยง

RegionCache
A HashMap-backed cache of bucket name -> region string. Construct once and pass by &mut to get_or_detect.
S3Uri
A parsed s3://bucket/key URI.
UploadCredentials
STS credentials used to sign S3 PUT requests.

Functionsยง

detect_bucket_region
Detect the AWS region for bucket by sending an HTTP HEAD request to <bucket>.s3.amazonaws.com:80 and reading the x-amz-bucket-region response header.
detect_region_at ๐Ÿ”’
Low-level region probe: connects to host:port over plain TCP and sends a HEAD / HTTP/1.0 request. Used directly by tests with a local mock server.
epoch_to_utc ๐Ÿ”’
Decompose a Unix timestamp (seconds since 1970-01-01 UTC) into (year, month, day, hour, minute, second). No leap-second handling.
format_amz_date
Format a Unix timestamp as YYYYMMDDTHHmmSSZ.
hmac_sha256 ๐Ÿ”’
parse_s3_uri
Parse an S3 URI of the form s3://bucket/key.
s3_put
Upload body bytes to s3://bucket/key using AWS Signature V4.
s3_put_to ๐Ÿ”’
Internal: same as s3_put but accepts an explicit base_url. Used in unit tests to point at a plain-HTTP mock server.
sha256_hex ๐Ÿ”’
sign_put_request
Build the Authorization header value for a PUT to S3.

Type Aliasesยง

HmacSha256 ๐Ÿ”’