Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Add metadata to aws/invoke return values #12

Open
jeroenvandijk opened this issue Jan 5, 2021 · 4 comments
Open

Add metadata to aws/invoke return values #12

jeroenvandijk opened this issue Jan 5, 2021 · 4 comments

Comments

@jeroenvandijk
Copy link
Collaborator

Probably this needs to be solved in a similar way to #10 and #11

From https://github.com/cognitect-labs/aws-api#explore

(aws/invoke s3 {:op :ListBuckets})
;; http-request and http-response are in the metadata
(meta *1)
@borkdude
Copy link
Contributor

borkdude commented Jan 5, 2021

What does this metadata look like in practice? Is it pure data?

@jeroenvandijk
Copy link
Collaborator Author

jeroenvandijk commented Jan 5, 2021

It also contains the input stream:

(clojure.pprint/pprint (meta (aws/invoke s3 {:op :DeleteBucket :request {:Bucket "babashka-test2"}})))
{:http-request
 {:request-method :delete,
  :scheme :https,
  :server-port 443,
  :uri "/babashka-test2",
  :headers
  {"x-amz-date" "20210105T115030Z",
   "host" "s3.amazonaws.com",
   "x-amz-content-sha256"
   "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
   "authorization"
   "AWS4-HMAC-SHA256 Credential=***/20210105/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=1858d205f3ae96fe6a0e5da7172233ae7b214c64079752fae395cb18798e1a0e"},
  :body nil,
  :server-name "s3.amazonaws.com"},
 :http-response
 {:status 404,
  :headers
  {"transfer-encoding" "chunked",
   "server" "AmazonS3",
   "x-amz-request-id" "8AE22B9B1C591701",
   "x-amz-id-2"
   "9gXtOaRbmzLbjrWC7EFL7zk1eMTyL8QAbn4npf5l9fk4IUwCGeeBD4/Mj43joZeJF4ijPo2MqW8=",
   "date" "Tue, 05 Jan 2021 11:50:30 GMT",
   "content-type" "application/xml"},
  :body
  #object[java.io.BufferedInputStream 0x73a96295 "java.io.BufferedInputStream@73a96295"]}}
nil

@borkdude
Copy link
Contributor

borkdude commented Jan 5, 2021

Maybe we can leave this out for now. It would surprise me if you could do anything with that inputstream, since it was already read by aws-api itself probably.

@borkdude
Copy link
Contributor

borkdude commented Jan 5, 2021

I think the request metadata can be returned in a :pod.babashka.aws/meta key (without the response inputstream) so we can add that to the response on the client side

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants