{-# LANGUAGE RankNTypes #-}
module Log.Backend.ElasticSearch.V1.Lens (
I.ElasticSearchConfig
, esServer
, esIndex
, esShardCount
, esReplicaCount
, esMapping
, esLogin
, esLoginInsecure
, I.defaultElasticSearchConfig
, I.withElasticSearchLogger
) where
import Database.V1.Bloodhound hiding (Status)
import Prelude
import qualified Data.Text as T
import qualified Log.Backend.ElasticSearch.V1 as I
import qualified Log.Backend.ElasticSearch.V1.Internal ()
type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s
esServer :: Lens' I.ElasticSearchConfig T.Text
esServer f esc = fmap (\x -> esc { I.esServer = x }) $ f (I.esServer esc)
esIndex :: Lens' I.ElasticSearchConfig T.Text
esIndex f esc = fmap (\x -> esc { I.esIndex = x }) $ f (I.esIndex esc)
esShardCount :: Lens' I.ElasticSearchConfig Int
esShardCount f esc = fmap (\x -> esc { I.esShardCount = x }) $ f (I.esShardCount esc)
esReplicaCount :: Lens' I.ElasticSearchConfig Int
esReplicaCount f esc = fmap (\x -> esc { I.esReplicaCount = x }) $ f (I.esReplicaCount esc)
esMapping :: Lens' I.ElasticSearchConfig T.Text
esMapping f esc = fmap (\x -> esc { I.esMapping = x }) $ f (I.esMapping esc)
esLogin :: Lens' I.ElasticSearchConfig (Maybe (EsUsername, EsPassword))
esLogin f esc = fmap (\x -> esc { I.esLogin = x }) $ f (I.esLogin esc)
esLoginInsecure :: Lens' I.ElasticSearchConfig Bool
esLoginInsecure f esc = fmap (\x -> esc { I.esLoginInsecure = x }) $ f (I.esLoginInsecure esc)