sigv4.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-sigv4@0.15.0.0/sigv4.bend as Sigv4
AWS Signature V4 signing and S3 object storage over Hairpin. Source: https://github.com/paymog/bend-kit/tree/main/sigv4
12 imports
import Base import bend-kit-crypto@0.2.2.2/crypto.bend as Crypto import bend-kit-hairpin@0.17.0.0/hairpin.bend as Hairpin import bend-kit-retry@0.3.0.0/retry.bend as Retry import bend-kit-http@0.44.0.1/http.bend as Http import bend-kit-http@0.44.0.1/pure.bend as HttpPure import bend-kit-time@0.3.0.2/pure.bend as Time import bend-kit-url@0.4.1.0/url.bend as Url import bend-kit-encoding@0.5.0.1/encoding.bend as Enc import bend-kit-bytes@0.3.3.1/bytes.bend as Bytes import ./pure.bend as Pure import ./xml.bend as Xml
Types
type Credentials source · line 19 · raw
Data
Text (path, query, header values) is a String of code points; non-ASCII is sent as UTF-8. S3 decodes and re-encodes wire escapes once; other services encode an escaped wire path twice. SigV4 encoding keeps only A-Z a-z 0-9 - _ . ~ and uses uppercase %XX. date is the x-amz-date form, YYYYMMDDTHHMMSSZ. token is "" for long-term keys.
Credentials@access:String -> @secret:String -> @token:String -> Credentials
type Style source · line 299 · raw
Data
Path: {endpoint}/{bucket}/{key}. Virtual: {bucket}.{endpoint host}/{key}.
PathStyle
VirtualStyle
type Config source · line 304 · raw
Data
endpoint: scheme://host[:port], as https://s3.us-east-1.amazonaws.com or http://127.0.0.1:9000. Its path is ignored.
Config@endpoint:String -> @region:String -> @style:Style -> @creds:Credentials -> Config
type Client source · line 307 · raw
Type
Client@cfg:Config -> @http:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client -> Client
type Err source · line 313 · raw
Data
ErrNet: no response. ErrSign: the signer failed. ErrConfig: a bad endpoint or a missing setting. ErrS3: any status outside 2xx, redirects included, with S3's error Code and Message ("" when there is no error body, as for HEAD). ErrXml: a 2xx body that is not the XML asked for, with its text.
ErrNet@e:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Err -> Err
ErrSign@code:U32 -> @why:String -> Err
ErrConfig@why:String -> Err
ErrS3@status:U32 -> @code:String -> @message:String -> Err
ErrXml@body:String -> Err
type Object source · line 321 · raw
Data
etag keeps S3's quotes. modified is S3's ISO 8601 text.
Object@key:String -> @size:Nat -> @etag:String -> @modified:String -> Object
type Page source · line 325 · raw
Data
next: the continuation token when S3 cut the listing off.
Page@objects:List<&2, Object> -> @prefixes:List<&2, String> -> @next:Maybe<&2, String> -> Page
type Meta source · line 329 · raw
Data
From a HEAD: Content-Length, ETag, Content-Type, and Last-Modified.
Meta@size:Nat -> @etag:String -> @mime:String -> @modified:String -> Meta
type Where source · line 442 · raw
Data
origin: scheme://host field. host: the Host field, as Http sends it. path: the wire path.
Where@origin:String -> @host:String -> @path:String -> Where
Definitions
def utf8.c3 source · line 23 · raw
@three:Bool -> @+c:U32 -> @acc:String -> String
Code points to UTF-8 octets, one Char per octet. acc is reversed.
def utf8.c2 source · line 26 · raw
@two:Bool -> @+c:U32 -> @acc:String -> String
def utf8.c1 source · line 29 · raw
@one:Bool -> @+c:U32 -> @acc:String -> String
def utf8.go source · line 32 · raw
@s:String -> @acc:String -> String
def utf8 source · line 35 · raw
@s:String -> String
def encode source · line 39 · raw
@s:String -> @slash:Bool -> String
SigV4 URI encoding of text: UTF-8, then every octet but the unreserved ones as %XX. slash keeps '/'.
def dec.of source · line 42 · raw
@m:Maybe<&2, String> -> @+raw:String -> String
def norm source · line 46 · raw
@s:String -> String
A wire component, re-encoded. A malformed escape stays literal, so its '%' is encoded.
def norms source · line 49 · raw
@xs:List<&2, String> -> List<&2, String>
def wire.segs source · line 53 · raw
@xs:List<&2, String> -> List<&2, String>
Non-S3 services encode the wire path a second time; '%' becomes '%25'.
def dots.seg source · line 57 · raw
@skip:Bool -> @up:Bool -> @+seg:String -> @st:List<&2, String> -> List<&2, String>
Canonical URI (RFC 3986 §5.2.4 for services other than s3): "" and "." segments drop, ".." pops.
def dots source · line 60 · raw
@xs:List<&2, String> -> @st:List<&2, String> -> List<&2, String>
def uri.slash source · line 63 · raw
@empty:Bool -> @trail:Bool -> @+body:String -> String
def uri.dots source · line 66 · raw
@+path:String -> String
def uri.s3 source · line 70 · raw
@empty:Bool -> @+path:String -> String
S3 signs the path as sent: each segment re-encoded, nothing removed.
def uri.if source · line 73 · raw
@s3:Bool -> @+path:String -> String
def uri source · line 76 · raw
@+service:String -> @+path:String -> String
def pair source · line 80 · raw
@xs:List<&2, String> -> Sigma<&2, &2, String, _ => String>
Canonical query: split on '&', each "k=v" (a bare "k" is "k="), re-encoded, sorted by key then value.
def pairs.if source · line 83 · raw
@empty:Bool -> @+h:String -> @rest:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def pairs source · line 86 · raw
@xs:List<&2, String> -> List<&2, Sigma<&2, &2, String, _ => String>>
def pair.le.of source · line 89 · raw
@c:Cmp -> @av:String -> @bv:String -> Bool
def pair.le source · line 92 · raw
@a:Sigma<&2, &2, String, _ => String> -> @b:Sigma<&2, &2, String, _ => String> -> Bool
def pairs.show source · line 95 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, String>
def query source · line 98 · raw
@q:String -> String
def squash.if source · line 103 · raw
@space:Bool -> @sp:Bool -> @+c:U32 -> @rest:String -> String
Canonical headers: lowercase names, trimmed values with space runs squashed, sorted by name, and a repeated name's values joined by ',' in the order given.
def squash source · line 106 · raw
@s:String -> @sp:Bool -> String
def hdrs.low source · line 109 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def name.le source · line 112 · raw
@a:Sigma<&2, &2, String, _ => String> -> @b:Sigma<&2, &2, String, _ => String> -> Bool
def grp.if source · line 115 · raw
@same:Bool -> @+n:String -> @+v:String -> @+pn:String -> @+pv:String -> @rest:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def grp.add source · line 118 · raw
@acc:List<&2, Sigma<&2, &2, String, _ => String>> -> @+n:String -> @+v:String -> List<&2, Sigma<&2, &2, String, _ => String>>
def grp source · line 121 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> @acc:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def headers source · line 124 · raw
@hs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def names source · line 127 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, String>
def lines source · line 130 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> String
def signed source · line 134 · raw
@hs:List<&2, Sigma<&2, &2, String, _ => String>> -> String
The SignedHeaders value for headers hs.
def canonical source · line 139 · raw
@+service:String -> @+method:String -> @+path:String -> @+q:String -> @+hs:List<&2, Sigma<&2, &2, String, _ => String>> -> @+phash:String -> String
The canonical request. hs must hold every header to sign, host included. phash is the payload's lowercase hex SHA-256, or "UNSIGNED-PAYLOAD".
def scope source · line 142 · raw
@+date:String -> @+region:String -> @+service:String -> String
def to_sign source · line 146 · raw
@+date:String -> @+scope:String -> @+hash:String -> String
The string to sign, from the hex SHA-256 of the canonical request.
def header source · line 149 · raw
@+access:String -> @+scope:String -> @+signed:String -> @+sig:String -> String
def hex.of source · line 154 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)> -> Result<&1, &1, Pair(U32, String), String>
def sha.words source · line 162 · raw
@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
Hex SHA-256 of a byte string.
def sha source · line 166 · raw
@+s:String -> IO(Result<&1, &1, Pair(U32, String), String>)
def mac.words source · line 171 · raw
@+kn:U32 -> @kb:Array<U32> -> @d:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
def words source · line 175 · raw
@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>
def mac source · line 180 · raw
@k:Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)> -> @+msg:String -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
HMAC-SHA256 of msg under the key k holds, or k's failure.
def key source · line 188 · raw
@+secret:String -> @+day:String -> @+region:String -> @+service:String -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
The signing key: HMAC(HMAC(HMAC(HMAC("AWS4" + secret, day), region), service), "aws4_request").
def signature.of source · line 195 · raw
@h:Result<&1, &1, Pair(U32, String), String> -> @+secret:String -> @+date:String -> @+region:String -> @+service:String -> IO(Result<&1, &1, Pair(U32, String), String>)
def signature source · line 206 · raw
@+secret:String -> @+date:String -> @+region:String -> @+service:String -> @+creq:String -> IO(Result<&1, &1, Pair(U32, String), String>)
The hex signature of a canonical request.
def header.of source · line 211 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> @+access:String -> @+scope:String -> @+signed:String -> Result<&1, &1, Pair(U32, String), String>
def sign source · line 221 · raw
@creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+hs:List<&2, Sigma<&2, &2, String, _ => String>> -> @+phash:String -> IO(Result<&1, &1, Pair(U32, String), String>)
The Authorization header over exactly the headers hs: the general form, for any header set. hs must include host and x-amz-date, and x-amz-security-token for temporary credentials; creds.token is not added here (authorize.hash adds it). Send every header in hs.
def token.hdr source · line 227 · raw
@empty:Bool -> @+token:String -> List<&2, Sigma<&2, &2, String, _ => String>>
def authorize.hash source · line 237 · raw
@creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @+phash:String -> IO(Result<&1, &1, Pair(U32, String), String>)
The Authorization header over host;x-amz-content-sha256;x-amz-date, plus x-amz-security-token when creds has a token. Send those headers with these values. phash: the payload's hex SHA-256, or "UNSIGNED-PAYLOAD".
def authorize.pair source · line 241 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> @+phash:String -> Result<&1, &1, Pair(U32, String), Pair(String, String)>
def authorize.of source · line 248 · raw
@h:Result<&1, &1, Pair(U32, String), String> -> @creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> IO(Result<&1, &1, Pair(U32, String), Pair(String, String)>)
def authorize source · line 258 · raw
@creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @payload:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(String, String)>)
authorize.hash over the payload's SHA-256. Done{(authorization, x-amz-content-sha256)}.
def token.q source · line 263 · raw
@empty:Bool -> @+token:String -> String
def presign.query source · line 267 · raw
@+access:String -> @+token:String -> @+scope:String -> @+date:String -> @+expires:U32 -> @+q:String -> String
The query a presigned request adds to q, before X-Amz-Signature.
def presign.of source · line 270 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> @+cq:String -> Result<&1, &1, Pair(U32, String), String>
def presign.go source · line 277 · raw
@+creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @+expires:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
def presign.if source · line 284 · raw
@ok:Bool -> @+creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @+expires:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
def presign source · line 293 · raw
@+creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @+expires:U32 -> IO(Result<&1, &1, Pair(U32, String), String>)
A presigned URL's query, signing host only over UNSIGNED-PAYLOAD, valid for expires seconds, 1 to 604800 (else Fail EINVAL). Request https://{host}{path}?{result} with no auth headers.
def new source · line 335 · raw
@cfg:Config -> Client
Redirects come back as ErrS3: a signed request must not follow one.
def close source · line 338 · raw
@c:Client -> IO(Unit)
def retry source · line 343 · raw
@c:Client -> @n:U32 -> Client
Up to n more tries after a connect error, a timeout, or 408, 429, 500, 502, 503, or 504. The signature stays valid for 15 minutes.
def timeout source · line 347 · raw
@c:Client -> @ms:U32 -> Client
def aws source · line 352 · raw
@+region:String -> @creds:Credentials -> Config
AWS itself: https://s3.{region}.amazonaws.com, virtual-hosted.
def env source · line 355 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> String
def or source · line 362 · raw
@+a:String -> @b:String -> String
def from_env.cfg source · line 365 · raw
@custom:Bool -> @+region:String -> @endpoint:String -> @creds:Credentials -> Config
def from_env.if source · line 372 · raw
@missing:Bool -> @access:String -> @secret:String -> @token:String -> @region:String -> @+endpoint:String -> Result<&1, &1, Err, Config>
def from_env.of source · line 380 · raw
@+access:String -> @+secret:String -> @token:String -> @region:String -> @endpoint:String -> Result<&1, &1, Err, Config>
def from_env source · line 385 · raw
IO(Result<&1, &1, Err, Config>)
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN; AWS_REGION, else AWS_DEFAULT_REGION, else us-east-1; AWS_ENDPOINT_URL_S3, else AWS_ENDPOINT_URL. A custom endpoint is path-style, as MinIO wants; AWS is virtual-hosted.
def xml source · line 398 · raw
@s:String -> Maybe<&2, List<&2, 0x1b38e8c63c3a9432a9c7ccfe8c14f0ef/xml.Leaf>>
def fault.of source · line 401 · raw
@+status:U32 -> @cm:Pair(String, String) -> Err
def fault source · line 405 · raw
@+status:U32 -> @m:Maybe<&2, List<&2, 0x1b38e8c63c3a9432a9c7ccfe8c14f0ef/xml.Leaf>> -> Err
def ok source · line 408 · raw
@+s:U32 -> Bool
def judge.res source · line 411 · raw
@good:Bool -> @+status:U32 -> @h:Map<&2, List<&2, String>> -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>
def judge source · line 418 · raw
@r:Result<&1, &1, 0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>
def stamp.of source · line 428 · raw
@m:Maybe<&2, 0xb11aca60dbb10f10d8f37cc3807477a2/pure.DateTime> -> String
def stamp source · line 436 · raw
IO(String)
Now as YYYYMMDDTHHMMSSZ. "" only outside years 0 to 9999, which S3 then refuses.
def seg source · line 446 · raw
@+key:String -> String
"" for the bucket itself.
def loc.at source · line 449 · raw
@style:Style -> @+bucket:String -> @+key:String -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Where
def loc source · line 460 · raw
@style:Style -> @+bucket:String -> @+key:String -> @m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, Where>
def token source · line 467 · raw
@c:Credentials -> String
def with.token source · line 471 · raw
@+token:String -> @+h:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>
def request.signed source · line 475 · raw
@extra:Map<&2, List<&2, String>> -> @date:String -> @+token:String -> @got:Pair(String, String) -> Map<&2, List<&2, String>>
extra, and the headers the signature covers. Host is Http's own, from the same URL.
def url source · line 479 · raw
@origin:String -> @path:String -> @+query:String -> String
def call.done source · line 482 · raw
@cfg:Config -> @x:Pair(0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client, Result<&1, &1, 0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>)
def send.budget source · line 488 · raw
@+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @y:Pair(0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client, 0x14e48621ef66156b0eb652524b8594d4/retry.Budget) -> IO(Pair(0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client, Pair(0x14e48621ef66156b0eb652524b8594d4/retry.Budget, Result<&1, &1, 0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Err, 0x447471668985e2b96a635a7780cac836/pure.Res>)))
Hairpin's request with the codings "identity": Http then leaves a stored Content-Encoding (gzip, br, ..) as sent, so GET returns the object's bytes and HEAD's size matches. ponytail: Http still undoes x-gzip, which S3 rarely stores.
def send source · line 493 · raw
@c:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client -> @+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client, Result<&1, &1, 0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
def call.send source · line 500 · raw
@s:Result<&1, &1, Pair(U32, String), Pair(String, String)> -> @cfg:Config -> @http:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client -> @+method:String -> @url:String -> @extra:Map<&2, List<&2, String>> -> @date:String -> @token:String -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
def call.sign source · line 512 · raw
@got:Where -> @+endpoint:String -> @+region:String -> @+style:Style -> @+creds:Credentials -> @http:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client -> @+method:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @+date:String -> @b:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
The signer hashes one copy of the body; the other goes on the wire.
def call.at source · line 521 · raw
@w:Maybe<&2, Where> -> @+endpoint:String -> @+region:String -> @+style:Style -> @+creds:Credentials -> @http:0xd210518ce9c6fd74c4bcc47edf83f3cb/hairpin.Client -> @+method:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @+date:String -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
def call.run source · line 532 · raw
@c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
Object calls require a bucket and a key. ListObjectsV2 targets the bucket with list-type=2. The absolute URL bypasses base resolution, so '.' and '..' in object keys survive.
def call.guard source · line 540 · raw
@bad:Bool -> @c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
def call source · line 548 · raw
@c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>))
def etag.of source · line 555 · raw
@r:Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, String>
def put.done source · line 563 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, String>)
def put source · line 568 · raw
@c:Client -> @bucket:String -> @key:String -> @+mime:String -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, String>))
PutObject. mime: Content-Type, "" for none. The ETag comes back.
def xgzip.values source · line 574 · raw
@xs:List<&2, String> -> Bool
def xgzip.fields source · line 581 · raw
@xs:List<&2, String> -> Bool
def body.encoding source · line 588 · raw
@gzip:Bool -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, Err, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>
def body.of source · line 595 · raw
@r:Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>
def get.done source · line 603 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)
def get source · line 609 · raw
@c:Client -> @bucket:String -> @key:String -> IO(Pair(Client, Result<&1, &1, Err, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>))
GetObject: the object's bytes. A missing key is ErrS3{404, "NoSuchKey", ..}. ponytail: Hairpin decodes x-gzip; reject it rather than return bytes that differ from the stored object.
def nat source · line 614 · raw
@s:String -> Nat
def meta.of source · line 617 · raw
@r:Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, Meta>
def head.done source · line 625 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Meta>)
def head source · line 630 · raw
@c:Client -> @bucket:String -> @key:String -> IO(Pair(Client, Result<&1, &1, Err, Meta>))
HeadObject. A missing key is ErrS3{404, "", ""}: HEAD has no error body.
def unit.of source · line 635 · raw
@r:Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, Unit>
def delete.done source · line 642 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Unit>)
def delete source · line 647 · raw
@c:Client -> @bucket:String -> @key:String -> IO(Pair(Client, Result<&1, &1, Err, Unit>))
DeleteObject. S3 answers 204 for a key that was never there too.
def object source · line 654 · raw
@key:String -> @size:Nat -> @etag:String -> @modified:String -> Object
def page.result source · line 657 · raw
@m:Maybe<&2, 0x1b38e8c63c3a9432a9c7ccfe8c14f0ef/xml.Page<Object>> -> @s:String -> Result<&1, &1, Err, Page>
def page.doc source · line 664 · raw
@+s:String -> @m:Maybe<&2, List<&2, 0x1b38e8c63c3a9432a9c7ccfe8c14f0ef/xml.Leaf>> -> Result<&1, &1, Err, Page>
def page.of source · line 667 · raw
@r:Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res> -> Result<&1, &1, Err, Page>
def list.done source · line 676 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x447471668985e2b96a635a7780cac836/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Page>)
def q.kv source · line 680 · raw
@k:String -> @+v:String -> String
def q.opt source · line 683 · raw
@k:String -> @+v:String -> @+rest:List<&2, String> -> List<&2, String>
def q.token source · line 686 · raw
@t:Maybe<&2, String> -> @rest:List<&2, String> -> List<&2, String>
def q.max source · line 693 · raw
@+n:U32 -> List<&2, String>
def list.query source · line 697 · raw
@prefix:String -> @delim:String -> @+max:U32 -> @t:Maybe<&2, String> -> String
In the signer's order: continuation-token, delimiter, list-type, max-keys, prefix.
def list source · line 701 · raw
@c:Client -> @+bucket:String -> @prefix:String -> @delim:String -> @+max:U32 -> @token:Maybe<&2, String> -> IO(Pair(Client, Result<&1, &1, Err, Page>))
One page of ListObjectsV2. prefix, delim: "" for none. max: keys per page, 0 for S3's 1000. token: a page's next.
def all.merge source · line 707 · raw
@objs:List<&2, Object> -> @pre:List<&2, String> -> @r:Result<&1, &1, Err, Page> -> Result<&1, &1, Err, Page>
def all.go source · line 715 · raw
@f:Nat -> @+bucket:String -> @+prefix:String -> @+delim:String -> @+max:U32 -> @objs:List<&2, Object> -> @pre:List<&2, String> -> @x:Pair(Client, Result<&1, &1, Err, Page>) -> IO(Pair(Client, Result<&1, &1, Err, Page>))
f: pages left. When they run out, next holds the token to go on from.
def list.all source · line 736 · raw
@c:Client -> @+bucket:String -> @+prefix:String -> @+delim:String -> @+max:U32 -> IO(Pair(Client, Result<&1, &1, Err, Page>))
Every page, following NextContinuationToken, up to 100000 pages.