cognitect-labs / aws-api

AWS, data driven
Apache License 2.0
724 stars 100 forks source link

No (public) way to derive a service name from a client #223

Closed dchelimsky closed 1 year ago

dchelimsky commented 1 year ago

Problem

There is no public API to retrieve the service name from the client. We've got a wrapper for aws/invoke that logs information about the request, including the AWS service that we're accessing, and we'd like to be able to derive that from the client instead of having to provide it to the wrapper function.

dchelimsky commented 1 year ago

Some background: pre-release versions of client were records, so they looked like maps. One problem was they contained a lot of information, some of which we'd not want printed (credentials), and the information wasn't really structured well for human consumption. There is an internal function we use to access this info to support various operations, and there is also a not-really-documented datafy implementation. These undocumented ways to get at the data give us:

(-> client cognitect.aws.client.protocol/-get-info :service :metadata :cognitect.aws/service-name)
(-> client datafy :service :metadata :cognitect.aws/service-name)

Some things to consider:

Other ideas and feedback on these are welcome.

dchelimsky commented 1 year ago

We already have keyword access directly on the client to keys like :region and :endpoint, so we could add :api to that.

dchelimsky commented 1 year ago

586dbd5921fba14dae87dc08c45f100077b92f70

dchelimsky commented 1 year ago

Released in 0.8.620