aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
souenzzo 2020-10-09T13:28:20.010700Z

[thread] I needed to make aws/invoke work offline to work on our CI

souenzzo 2020-10-09T13:28:33.010800Z

(let [s3 (aws/client {:api :s3})
      reqs (atom [])
      info (aws.client/-get-info s3)
      s3 (reify
           clojure.lang.IDeref
           (deref [this]
             @reqs)
           aws.client/ClientSPI
           (-get-info [this]
             (assoc info
               :http-client (reify aws.http/HttpClient
                              (-submit [this request channel]
                                (swap! reqs conj request)
                                (async/put! channel
                                            {:status  200,
                                             :headers {"x-amz-version-id" "null"
                                                       "content-type"     "application/octet-stream"
                                                       "content-length"   "5"
                                                       "accept-ranges"    "bytes"
                                                       "etag"             "\"55b84a9d317184fe61224bfb4a060fb0\""
                                                       "last-modified"    "Thu, 08 Oct 2020 12:32:20 GMT"}
                                             :body    (ByteBuffer/wrap (.getBytes "1,2,3"))}))))))]
  (is (= "1,2,3"
         (slurp (:Body (aws/invoke s3 {:op      :GetObject
                                       :request {:Bucket "1"
                                                 :Key    "2"}})))))
  (is (= 1 (count @s3))))