Where S3 requests go. AWS uses virtual-hosted URLs on the regional endpoint, https://<bucket>.s3.<region>.amazonaws.com/<key>, or path-style for a bucket that can't be a hostname label: dots (the TLS wildcard certificate doesn't match those) and legacy uppercase names.

opts.endpoint points at an S3-compatible store (Cloudflare R2, MinIO, ...), which defaults to path-style: <endpoint>/<bucket>/<key>. Pass path-style: false for https://<bucket>.<endpoint host>/<key>, or path-style: true to force path-style on AWS.

A bucket goes into a URL, so resolve checks it with ::aws::core/check-bucket and a bad name is an Err before anything is signed.

Functions

base-url

fn (resolved: Map): Str

The S3 service URL (no trailing slash): resolved.endpoint, else https://s3.<region>.amazonaws.com.

body-text

fn (body: Any): Str

A response body as a Str, decoding Bytes.

bucket-url

fn (bucket: Str, resolved: Map): Str

The URL of a bucket (no trailing slash) for resolved settings: see the namespace doc for the forms.

decode-listed

fn (value: Str?): Str?

Decode a value from a listing made with encoding-type=url: + is a space and %XX an escape. Null stays null.

object-url

fn (bucket: Str, key: Str, resolved: Map): Str

The URL of an object: bucket-url plus the key with each path segment encoded. / in the key stays a path separator.

resolve

fn (opts: Map, bucket: Str): Map
fn (opts: Map, bucket: Str, other-bucket: Str): Map

::aws::core/resolve(opts), or an Err when a bucket isn't a valid name. Credentials in opts are masked first, whatever else is wrong.

virtual-host-url

fn (endpoint: Str, bucket: Str): Str