bloodhound-amazonka-auth-0.1.2.1: 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 }