Fork me on GitHub
#babashka
<
2022-03-31
>
djblue05:03:02

Doing some fun stuff with the clojure reader and just found out you could reify clojure.lang.LispReader$Resolver in bb 🤯

🎉 2
djblue05:03:10

bb continues to amaze me

Benjamin10:03:42

Is there a way to reify a protocol without loading the namespace? I wanted to reify cognitect.aws.credentials/CredentialsProvider but loading in bb there are some classes missing

java.util.concurrent.ExecutorService
my use case would be fixed with https://github.com/cognitect-labs/aws-api/issues/170 as well because I just want to provide the session token with a basic creds provider I did a workaround now where I use system property creds provider

✅ 1
borkdude10:03:11

Can you point me to the relevant bit of code?

borkdude10:03:18

We could maybe just add that class

borkdude10:03:25

The docs seem to suggest that the arg vec position is preferred: https://clojure.org/reference/java_interop#typehints

borkdude10:03:46

Can you give an actual example of the code that should run in bb maybe?

Benjamin10:03:12

(def
      client
      (aws/client
       {:api :athena
        :region "us-east-1"
        :credentials-provider
        (let [access-key-id (config-get "aws_access_key_id")
              secret-access-key (config-get "aws_secret_access_key")
              token (config-get "aws_session_token")]
          (reify cognitect.aws.credentials/CredentialsProvider
            (fetch [_]
              {:aws/access-key-id     access-key-id
               :aws/secret-access-key secret-access-key
               :aws/session-token token})))}))
interesting part:
(reify cognitect.aws.credentials/CredentialsProvider
            (fetch [_]
              {:aws/access-key-id     access-key-id
               :aws/secret-access-key secret-access-key
               :aws/session-token token}))

borkdude10:03:35

Credentials in the AWS pod are not supported through reify. It supports it in a custom way, see here: https://github.com/babashka/pod-babashka-aws#credentials

borkdude10:03:51

If you need anything added/changed to this custom way, write an issue about it.

Benjamin10:03:33

yea indeed I wanted to use basic creds provider but I need the session token https://github.com/cognitect-labs/aws-api/issues/170 . So when that is merged my issue if fixed, until then I just workaround with system properties provider, so it's fine

borkdude10:03:48

ok then, thanks! Maybe you could leave a comment in that cognitect issue to signal interest

clojure-spin 1
borkdude10:03:04

you already did, so all good :)

borkdude11:03:04

I was aware of asdf, but never actually tried it. Works great for testing different versions of things.

$ asdf plugin add babashka
$ asdf install babashka 0.7.8
$ ASDF_BABASHKA_VERSION=0.7.8 bb
Babashka v0.7.8 REPL.
$ ASDF_BABASHKA_VERSION=0.7.7 bb
Babashka v0.7.7 REPL.

âž• 2