{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.LexV2Models.Types.TextLogSetting where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.TextLogDestination
import qualified Amazonka.Prelude as Prelude
data TextLogSetting = TextLogSetting'
{
TextLogSetting -> Bool
enabled :: Prelude.Bool,
TextLogSetting -> TextLogDestination
destination :: TextLogDestination
}
deriving (TextLogSetting -> TextLogSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextLogSetting -> TextLogSetting -> Bool
$c/= :: TextLogSetting -> TextLogSetting -> Bool
== :: TextLogSetting -> TextLogSetting -> Bool
$c== :: TextLogSetting -> TextLogSetting -> Bool
Prelude.Eq, ReadPrec [TextLogSetting]
ReadPrec TextLogSetting
Int -> ReadS TextLogSetting
ReadS [TextLogSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextLogSetting]
$creadListPrec :: ReadPrec [TextLogSetting]
readPrec :: ReadPrec TextLogSetting
$creadPrec :: ReadPrec TextLogSetting
readList :: ReadS [TextLogSetting]
$creadList :: ReadS [TextLogSetting]
readsPrec :: Int -> ReadS TextLogSetting
$creadsPrec :: Int -> ReadS TextLogSetting
Prelude.Read, Int -> TextLogSetting -> ShowS
[TextLogSetting] -> ShowS
TextLogSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextLogSetting] -> ShowS
$cshowList :: [TextLogSetting] -> ShowS
show :: TextLogSetting -> String
$cshow :: TextLogSetting -> String
showsPrec :: Int -> TextLogSetting -> ShowS
$cshowsPrec :: Int -> TextLogSetting -> ShowS
Prelude.Show, forall x. Rep TextLogSetting x -> TextLogSetting
forall x. TextLogSetting -> Rep TextLogSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextLogSetting x -> TextLogSetting
$cfrom :: forall x. TextLogSetting -> Rep TextLogSetting x
Prelude.Generic)
newTextLogSetting ::
Prelude.Bool ->
TextLogDestination ->
TextLogSetting
newTextLogSetting :: Bool -> TextLogDestination -> TextLogSetting
newTextLogSetting Bool
pEnabled_ TextLogDestination
pDestination_ =
TextLogSetting'
{ $sel:enabled:TextLogSetting' :: Bool
enabled = Bool
pEnabled_,
$sel:destination:TextLogSetting' :: TextLogDestination
destination = TextLogDestination
pDestination_
}
textLogSetting_enabled :: Lens.Lens' TextLogSetting Prelude.Bool
textLogSetting_enabled :: Lens' TextLogSetting Bool
textLogSetting_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextLogSetting' {Bool
enabled :: Bool
$sel:enabled:TextLogSetting' :: TextLogSetting -> Bool
enabled} -> Bool
enabled) (\s :: TextLogSetting
s@TextLogSetting' {} Bool
a -> TextLogSetting
s {$sel:enabled:TextLogSetting' :: Bool
enabled = Bool
a} :: TextLogSetting)
textLogSetting_destination :: Lens.Lens' TextLogSetting TextLogDestination
textLogSetting_destination :: Lens' TextLogSetting TextLogDestination
textLogSetting_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextLogSetting' {TextLogDestination
destination :: TextLogDestination
$sel:destination:TextLogSetting' :: TextLogSetting -> TextLogDestination
destination} -> TextLogDestination
destination) (\s :: TextLogSetting
s@TextLogSetting' {} TextLogDestination
a -> TextLogSetting
s {$sel:destination:TextLogSetting' :: TextLogDestination
destination = TextLogDestination
a} :: TextLogSetting)
instance Data.FromJSON TextLogSetting where
parseJSON :: Value -> Parser TextLogSetting
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TextLogSetting"
( \Object
x ->
Bool -> TextLogDestination -> TextLogSetting
TextLogSetting'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enabled")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destination")
)
instance Prelude.Hashable TextLogSetting where
hashWithSalt :: Int -> TextLogSetting -> Int
hashWithSalt Int
_salt TextLogSetting' {Bool
TextLogDestination
destination :: TextLogDestination
enabled :: Bool
$sel:destination:TextLogSetting' :: TextLogSetting -> TextLogDestination
$sel:enabled:TextLogSetting' :: TextLogSetting -> Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TextLogDestination
destination
instance Prelude.NFData TextLogSetting where
rnf :: TextLogSetting -> ()
rnf TextLogSetting' {Bool
TextLogDestination
destination :: TextLogDestination
enabled :: Bool
$sel:destination:TextLogSetting' :: TextLogSetting -> TextLogDestination
$sel:enabled:TextLogSetting' :: TextLogSetting -> Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TextLogDestination
destination
instance Data.ToJSON TextLogSetting where
toJSON :: TextLogSetting -> Value
toJSON TextLogSetting' {Bool
TextLogDestination
destination :: TextLogDestination
enabled :: Bool
$sel:destination:TextLogSetting' :: TextLogSetting -> TextLogDestination
$sel:enabled:TextLogSetting' :: TextLogSetting -> Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enabled),
forall a. a -> Maybe a
Prelude.Just (Key
"destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TextLogDestination
destination)
]
)