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