Fork me on GitHub
#datomic
<
2022-01-15
>
Benjamin14:01:56

cognitect.aws.credentials CredentialsProvider can I coerce this to com.amazonaws.auth.AWSCredentialsProvider ?

ghadi14:01:03

No these are unrelated

kenny15:01:50

However, you can wrap it pretty easily 🙂 e.g.,

(defn create-AWSCredentialsProvider
  "Wraps aws-creds/CredentialsProvider in the AWSCredentialsProvider interface for use
  in the AWS Java SDK."
  [assume-role-map]
  (let [provider (auto-refreshing-credentials-provider assume-role-map)]
    (reify AWSCredentialsProvider
      (getCredentials [_]
        (when-let [creds (anom/anomaly! (aws-creds/fetch provider))]
          (reify AWSSessionCredentials
            (getAWSAccessKeyId [_] (:aws/access-key-id creds))
            (getAWSSecretKey [_] (:aws/secret-access-key creds))
            (getSessionToken [_] (:aws/session-token creds)))))
      (refresh [_]))))

👍 1