 : delete-object ( bucket key -- )
     "/" prepend H{ } clone "DELETE" <s3-request>
     dup s3-url <delete-request> sign-http-request http-request 2drop ;
+
+: bucket>alist ( bucket -- alist )
+    dup keys
+    [ name>> get-object nip ] with map-zip ;
    nip >string string>xml (keys) ;

: get-object ( bucket key -- response data )
    s3-request new
        swap "/" prepend >>path
        swap >>bucket
    s3-url http-get ;

: create-bucket ( bucket -- )
    "" swap "/" H{ } clone "PUT" <s3-request>

! Copyright (C) 2009 Chris Double. All Rights Reserved.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs base64 calendar calendar.format
calendar.parser checksums.hmac checksums.sha combinators http
http.client kernel make math.order namespaces sequences
sequences.extras sorting sorting.slots strings xml xml.traversal ;
IN: s3

SYMBOL: key-id
