No (public) way to derive a service name from a client
dchelimsky opened this issue · comments
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.
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:
- document support for
datafy
- add an
:api
key to the datafied client, supporting(-> client datafy :api)
- make the client behave like a map, but don't expose all of its internals, e.g. provide keyword access and print any of
{:api "s3" :region "us-east-1"}
- #aws-api/client
{:api "s3" :region "us-east-1"}
Other ideas and feedback on these are welcome.
We already have keyword access directly on the client to keys like :region and :endpoint, so we could add :api to that.
Released in 0.8.620