sigv4.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-sigv4@0.17.0.2/sigv4.bend as Sigv4
AWS Signature V4 signing and S3 object storage over Hairpin. Source: https://github.com/paymog/bend-kit/tree/main/sigv4
13 imports
import Base import bend-kit-crypto@0.2.2.2/crypto.bend as Crypto import bend-kit-hairpin@0.19.0.2/hairpin.bend as Hairpin import bend-kit-hairpin@0.19.0.2/pure.bend as HairpinPure import bend-kit-retry@0.3.0.0/retry.bend as Retry import bend-kit-http@0.45.0.2/http.bend as Http import bend-kit-http@0.45.0.2/pure.bend as HttpPure import bend-kit-time@0.3.0.5/pure.bend as Time import bend-kit-url@0.4.1.0/url.bend as Url import bend-kit-encoding@0.5.0.3/encoding.bend as Enc import bend-kit-bytes@0.3.3.3/bytes.bend as Bytes import ./pure.bend as Pure import ./xml.bend as Xml
Types
type Credentials source · line 20 · 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 300 · raw
Data
Path: {endpoint}/{bucket}/{key}. Virtual: {bucket}.{endpoint host}/{key}.
PathStyle
VirtualStyle
type Config source · line 305 · 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 308 · raw
Type
Client@cfg:Config -> @http:0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client -> Client
type Err source · line 314 · 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:0xa366ce5513c928891ccd4bf736f1844e/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 322 · 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 326 · 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 330 · 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 443 · 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 24 · 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 27 · raw
@two:Bool -> @+c:U32 -> @acc:String -> String
def utf8.c1 source · line 30 · raw
@one:Bool -> @+c:U32 -> @acc:String -> String
def utf8.go source · line 33 · raw
@s:String -> @acc:String -> String
def utf8 source · line 36 · raw
@s:String -> String
def encode source · line 40 · 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 43 · raw
@m:Maybe<&2, String> -> @+raw:String -> String
def norm source · line 47 · raw
@s:String -> String
A wire component, re-encoded. A malformed escape stays literal, so its '%' is encoded.
def norms source · line 50 · raw
@xs:List<&2, String> -> List<&2, String>
def wire.segs source · line 54 · 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 58 · 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 61 · raw
@xs:List<&2, String> -> @st:List<&2, String> -> List<&2, String>
def uri.slash source · line 64 · raw
@empty:Bool -> @trail:Bool -> @+body:String -> String
def uri.dots source · line 67 · raw
@+path:String -> String
def uri.s3 source · line 71 · raw
@empty:Bool -> @+path:String -> String
S3 signs the path as sent: each segment re-encoded, nothing removed.
def uri.if source · line 74 · raw
@s3:Bool -> @+path:String -> String
def uri source · line 77 · raw
@+service:String -> @+path:String -> String
def pair source · line 81 · 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 84 · raw
@empty:Bool -> @+h:String -> @rest:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def pairs source · line 87 · raw
@xs:List<&2, String> -> List<&2, Sigma<&2, &2, String, _ => String>>
def pair.le.of source · line 90 · raw
@c:Cmp -> @av:String -> @bv:String -> Bool
def pair.le source · line 93 · raw
@a:Sigma<&2, &2, String, _ => String> -> @b:Sigma<&2, &2, String, _ => String> -> Bool
def pairs.show source · line 96 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, String>
def query source · line 99 · raw
@q:String -> String
def squash.if source · line 104 · 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 107 · raw
@s:String -> @sp:Bool -> String
def hdrs.low source · line 110 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def name.le source · line 113 · raw
@a:Sigma<&2, &2, String, _ => String> -> @b:Sigma<&2, &2, String, _ => String> -> Bool
def grp.if source · line 116 · 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 119 · raw
@acc:List<&2, Sigma<&2, &2, String, _ => String>> -> @+n:String -> @+v:String -> List<&2, Sigma<&2, &2, String, _ => String>>
def grp source · line 122 · 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 125 · raw
@hs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, Sigma<&2, &2, String, _ => String>>
def names source · line 128 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> List<&2, String>
def lines source · line 131 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => String>> -> String
def signed source · line 135 · raw
@hs:List<&2, Sigma<&2, &2, String, _ => String>> -> String
The SignedHeaders value for headers hs.
def canonical source · line 140 · 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 143 · raw
@+date:String -> @+region:String -> @+service:String -> String
def to_sign source · line 147 · 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 150 · raw
@+access:String -> @+scope:String -> @+signed:String -> @+sig:String -> String
def hex.of source · line 155 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)> -> Result<&1, &1, Pair(U32, String), String>
def sha.words source · line 163 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
Hex SHA-256 of a byte string.
def sha source · line 167 · raw
@+s:String -> IO(Result<&1, &1, Pair(U32, String), String>)
def mac.words source · line 172 · raw
@+kn:U32 -> @kb:Array<U32> -> @d:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>)
def words source · line 176 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>
def mac source · line 181 · 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 189 · 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 196 · 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 207 · 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 212 · 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 222 · 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 228 · raw
@empty:Bool -> @+token:String -> List<&2, Sigma<&2, &2, String, _ => String>>
def authorize.hash source · line 238 · 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 242 · 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 249 · 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 259 · raw
@creds:Credentials -> @+region:String -> @+service:String -> @+date:String -> @+method:String -> @+path:String -> @+q:String -> @+host:String -> @payload:0x3f4d48cfd4df31741ee4b528a4e7773e/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 264 · raw
@empty:Bool -> @+token:String -> String
def presign.query source · line 268 · 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 271 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> @+cq:String -> Result<&1, &1, Pair(U32, String), String>
def presign.go source · line 278 · 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 285 · 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 294 · 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 336 · raw
@cfg:Config -> Client
Redirects come back as ErrS3: a signed request must not follow one.
def close source · line 339 · raw
@c:Client -> IO(Unit)
def retry source · line 344 · 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 348 · raw
@c:Client -> @ms:U32 -> Client
def aws source · line 353 · raw
@+region:String -> @creds:Credentials -> Config
AWS itself: https://s3.{region}.amazonaws.com, virtual-hosted.
def env source · line 356 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> String
def or source · line 363 · raw
@+a:String -> @b:String -> String
def from_env.cfg source · line 366 · raw
@custom:Bool -> @+region:String -> @endpoint:String -> @creds:Credentials -> Config
def from_env.if source · line 373 · raw
@missing:Bool -> @access:String -> @secret:String -> @token:String -> @region:String -> @+endpoint:String -> Result<&1, &1, Err, Config>
def from_env.of source · line 381 · raw
@+access:String -> @+secret:String -> @token:String -> @region:String -> @endpoint:String -> Result<&1, &1, Err, Config>
def from_env source · line 386 · 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 399 · raw
@s:String -> Maybe<&2, List<&2, 0xcbea0419f629855389ad71e2c3eb3217/xml.Leaf>>
def fault.of source · line 402 · raw
@+status:U32 -> @cm:Pair(String, String) -> Err
def fault source · line 406 · raw
@+status:U32 -> @m:Maybe<&2, List<&2, 0xcbea0419f629855389ad71e2c3eb3217/xml.Leaf>> -> Err
def ok source · line 409 · raw
@+s:U32 -> Bool
def judge.res source · line 412 · raw
@good:Bool -> @+status:U32 -> @h:Map<&2, List<&2, String>> -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>
def judge source · line 419 · raw
@r:Result<&1, &1, 0xa366ce5513c928891ccd4bf736f1844e/hairpin.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>
def stamp.of source · line 429 · raw
@m:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.DateTime> -> String
def stamp source · line 437 · raw
IO(String)
Now as YYYYMMDDTHHMMSSZ. "" only outside years 0 to 9999, which S3 then refuses.
def seg source · line 447 · raw
@+key:String -> String
"" for the bucket itself.
def loc.at source · line 450 · raw
@style:Style -> @+bucket:String -> @+key:String -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Where
def loc source · line 461 · raw
@style:Style -> @+bucket:String -> @+key:String -> @m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, Where>
def token source · line 468 · raw
@c:Credentials -> String
def with.token source · line 472 · raw
@+token:String -> @+h:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>
def request.signed source · line 476 · 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 480 · raw
@origin:String -> @path:String -> @+query:String -> String
def call.done source · line 483 · raw
@cfg:Config -> @x:Pair(0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client, Result<&1, &1, 0xa366ce5513c928891ccd4bf736f1844e/hairpin.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>)
def send.budget source · line 489 · raw
@+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @y:Pair(0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client, 0x14e48621ef66156b0eb652524b8594d4/retry.Budget) -> IO(Pair(0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client, Pair(0x14e48621ef66156b0eb652524b8594d4/retry.Budget, Result<&1, &1, 0xa366ce5513c928891ccd4bf736f1844e/hairpin.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/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 494 · raw
@c:0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client -> @+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client, Result<&1, &1, 0xa366ce5513c928891ccd4bf736f1844e/hairpin.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
def call.send source · line 501 · raw
@s:Result<&1, &1, Pair(U32, String), Pair(String, String)> -> @cfg:Config -> @http:0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client -> @+method:String -> @url:String -> @extra:Map<&2, List<&2, String>> -> @date:String -> @token:String -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
def call.sign source · line 513 · raw
@got:Where -> @+endpoint:String -> @+region:String -> @+style:Style -> @+creds:Credentials -> @http:0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client -> @+method:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @+date:String -> @b:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
The signer hashes one copy of the body; the other goes on the wire.
def call.at source · line 522 · raw
@w:Maybe<&2, Where> -> @+endpoint:String -> @+region:String -> @+style:Style -> @+creds:Credentials -> @http:0xa366ce5513c928891ccd4bf736f1844e/hairpin.Client -> @+method:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @+date:String -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
def call.run source · line 533 · raw
@c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/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 541 · raw
@bad:Bool -> @c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
def call source · line 549 · raw
@c:Client -> @+method:String -> @+bucket:String -> @+key:String -> @+query:String -> @extra:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> IO(Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>))
def etag.of source · line 556 · raw
@r:Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, String>
def put.done source · line 564 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, String>)
def put source · line 569 · raw
@c:Client -> @bucket:String -> @key:String -> @+mime:String -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/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 575 · raw
@xs:List<&2, String> -> Bool
def xgzip.fields source · line 582 · raw
@xs:List<&2, String> -> Bool
def body.encoding source · line 589 · raw
@gzip:Bool -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Result<&1, &1, Err, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def body.of source · line 596 · raw
@r:Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def get.done source · line 604 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>)
def get source · line 610 · raw
@c:Client -> @bucket:String -> @key:String -> IO(Pair(Client, Result<&1, &1, Err, 0x3f4d48cfd4df31741ee4b528a4e7773e/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 615 · raw
@s:String -> Nat
def meta.of source · line 618 · raw
@r:Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, Meta>
def head.done source · line 626 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Meta>)
def head source · line 631 · 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 636 · raw
@r:Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, Unit>
def delete.done source · line 643 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Unit>)
def delete source · line 648 · 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 655 · raw
@key:String -> @size:Nat -> @etag:String -> @modified:String -> Object
def page.result source · line 658 · raw
@m:Maybe<&2, 0xcbea0419f629855389ad71e2c3eb3217/xml.Page<Object>> -> @s:String -> Result<&1, &1, Err, Page>
def page.doc source · line 665 · raw
@+s:String -> @m:Maybe<&2, List<&2, 0xcbea0419f629855389ad71e2c3eb3217/xml.Leaf>> -> Result<&1, &1, Err, Page>
def page.of source · line 668 · raw
@r:Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Result<&1, &1, Err, Page>
def list.done source · line 677 · raw
@x:Pair(Client, Result<&1, &1, Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>) -> Pair(Client, Result<&1, &1, Err, Page>)
def q.kv source · line 681 · raw
@k:String -> @+v:String -> String
def q.opt source · line 684 · raw
@k:String -> @+v:String -> @+rest:List<&2, String> -> List<&2, String>
def q.token source · line 687 · raw
@t:Maybe<&2, String> -> @rest:List<&2, String> -> List<&2, String>
def q.max source · line 694 · raw
@+n:U32 -> List<&2, String>
def list.query source · line 698 · 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 702 · 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 708 · 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 716 · 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 737 · 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.