Conversation
We want the Env' withAuth in the final position because `authenticate` will eventually take a function of type like: `Env' withAuth -> m Env`
|
CC:
|
|
Question for the floor: would it be worth adding pattern synonyms where there's a compatible new name? |
|
I like it. |
|
Another question: Should we detect infinite loops in the AWS config files? The other SDKs do, and we probably should. |
brendanhay
left a comment
There was a problem hiding this comment.
Changes look good, I like the new design!
We should (eventually) - but I don't think it should get in the way of getting this released. |
I think it should be quick (execStateT while traversing the profile stuff), so I'll try to do it on this PR. Most other stuff should be moved into separate issues, which I'll do before merging this. |
We pin to hashable-1.3.4.1 as it's the last 1.3.x.x version and stack snapshots for GHC 8.10.7 still don't have hashable >=1.3.4.0 (which we need for amazonka-dynamodb and amazonka-dynamodb-streams)n Also remove references to .hs-boot files which no longer exist.
faee1a7 to
d33c559
Compare
ghost
left a comment
There was a problem hiding this comment.
Just some quick things I noticed while skimming. Nice work man.
d33c559 to
f8a1ebe
Compare
f8a1ebe to
57933fb
Compare
|
Going to leave this bake for a few days longer now that I've updated work code to run on it, but I think there's nothing stopping a merge early next week. |
|
This has been working well for as at work, so I'm going to merge it. |
Rewrite the authentication code to support something like an explicit "credential chain", in the vein of the official AWS SDKs. The
Credentialsdata type is removed in favour of authentication functions of typeEnv' withEnv -> m EnvorEnv -> m Env; that's a function that takes an inputEnv'(either indifferent to authentication or in the case ofsts:AssumeRole, requiring it), and produces a new outputEnv. This allows library clients much greater control over how they get the first set of access keys - if AWS releases some new way to acquire credentials, it's possible to plug that in much more easily than before.This PR also breaks up the authentication into a bunch of separate modules. This has the nice side-effect of removing the
.hs-bootfiles which came in when we started supportingsts:AssumeRoleWithWebIdentity.On the library consumer side, the new
Amazonka.Auth.STS.fromAssumedRolemakes it easy to spin off a newEnvunder an assumed role, and the parser for credentials/config files has been rewritten to support many authentication methods supported by the official SDKs.This also provides a workaround for the VPC issues in #271 - it's possible to write something like
newEnv fromDefaultInstanceProfileand have amazonka skip theisEC2check. (The IMDS client connects by IP; only theisEC2check useshttp://instance-data.)Migration for most users will be to replace
newEnv DiscoverwithnewEnv discover.Recommend reviewing commit-by-commit.
Remaining work:
profileprefix in config as "works, but not supported"~/.aws/credentialsexists but~/.aws/configdoesn't.Closes #514
Closes #476
Closes #629