bloodhound-amazonka-auth-0.1.1.0: Adds convenient Amazon ElasticSearch Service authentication to Bloodhound.

Safe HaskellNone
LanguageHaskell2010

Database.Bloodhound.Auth.Amazonka

Synopsis

Documentation

amazonkaAuthHook :: AuthEnv -> Region -> Request -> IO (Either EsAmazonkaAuthError Request) Source

Request hook to install into your BHEnv. Does not handle streaming request bodies, which should not be an issue for Bloodhound. The exception cases handled by EsAmazonkaAuthError are truly exceptional and should probably be thrown.

   env <- newEnv region Discover
   let auth = env ^. envAuth
   let hook req = withAuth auth $ ae ->
                    either (liftIO . throwIO) return =<< amazonkaAuthHook ae region req
   mgr <- newManager tlsManagerSettings
   let bhe = (mkBHEnv server mgr) { bhRequestHook = hook }

data EsAmazonkaAuthError Source

These edge cases shouldn't come up in normal operation. The best course of action is probably to throw these as an exception.