{-# 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.AppSync.Types.LogConfig where
import Amazonka.AppSync.Types.FieldLogLevel
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LogConfig = LogConfig'
{
LogConfig -> Maybe Bool
excludeVerboseContent :: Prelude.Maybe Prelude.Bool,
LogConfig -> FieldLogLevel
fieldLogLevel :: FieldLogLevel,
LogConfig -> Text
cloudWatchLogsRoleArn :: Prelude.Text
}
deriving (LogConfig -> LogConfig -> Bool
(LogConfig -> LogConfig -> Bool)
-> (LogConfig -> LogConfig -> Bool) -> Eq LogConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogConfig -> LogConfig -> Bool
$c/= :: LogConfig -> LogConfig -> Bool
== :: LogConfig -> LogConfig -> Bool
$c== :: LogConfig -> LogConfig -> Bool
Prelude.Eq, ReadPrec [LogConfig]
ReadPrec LogConfig
Int -> ReadS LogConfig
ReadS [LogConfig]
(Int -> ReadS LogConfig)
-> ReadS [LogConfig]
-> ReadPrec LogConfig
-> ReadPrec [LogConfig]
-> Read LogConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogConfig]
$creadListPrec :: ReadPrec [LogConfig]
readPrec :: ReadPrec LogConfig
$creadPrec :: ReadPrec LogConfig
readList :: ReadS [LogConfig]
$creadList :: ReadS [LogConfig]
readsPrec :: Int -> ReadS LogConfig
$creadsPrec :: Int -> ReadS LogConfig
Prelude.Read, Int -> LogConfig -> ShowS
[LogConfig] -> ShowS
LogConfig -> String
(Int -> LogConfig -> ShowS)
-> (LogConfig -> String)
-> ([LogConfig] -> ShowS)
-> Show LogConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogConfig] -> ShowS
$cshowList :: [LogConfig] -> ShowS
show :: LogConfig -> String
$cshow :: LogConfig -> String
showsPrec :: Int -> LogConfig -> ShowS
$cshowsPrec :: Int -> LogConfig -> ShowS
Prelude.Show, (forall x. LogConfig -> Rep LogConfig x)
-> (forall x. Rep LogConfig x -> LogConfig) -> Generic LogConfig
forall x. Rep LogConfig x -> LogConfig
forall x. LogConfig -> Rep LogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogConfig x -> LogConfig
$cfrom :: forall x. LogConfig -> Rep LogConfig x
Prelude.Generic)
newLogConfig ::
FieldLogLevel ->
Prelude.Text ->
LogConfig
newLogConfig :: FieldLogLevel -> Text -> LogConfig
newLogConfig FieldLogLevel
pFieldLogLevel_ Text
pCloudWatchLogsRoleArn_ =
LogConfig' :: Maybe Bool -> FieldLogLevel -> Text -> LogConfig
LogConfig'
{ $sel:excludeVerboseContent:LogConfig' :: Maybe Bool
excludeVerboseContent = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:fieldLogLevel:LogConfig' :: FieldLogLevel
fieldLogLevel = FieldLogLevel
pFieldLogLevel_,
$sel:cloudWatchLogsRoleArn:LogConfig' :: Text
cloudWatchLogsRoleArn = Text
pCloudWatchLogsRoleArn_
}
logConfig_excludeVerboseContent :: Lens.Lens' LogConfig (Prelude.Maybe Prelude.Bool)
logConfig_excludeVerboseContent :: (Maybe Bool -> f (Maybe Bool)) -> LogConfig -> f LogConfig
logConfig_excludeVerboseContent = (LogConfig -> Maybe Bool)
-> (LogConfig -> Maybe Bool -> LogConfig)
-> Lens LogConfig LogConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogConfig' {Maybe Bool
excludeVerboseContent :: Maybe Bool
$sel:excludeVerboseContent:LogConfig' :: LogConfig -> Maybe Bool
excludeVerboseContent} -> Maybe Bool
excludeVerboseContent) (\s :: LogConfig
s@LogConfig' {} Maybe Bool
a -> LogConfig
s {$sel:excludeVerboseContent:LogConfig' :: Maybe Bool
excludeVerboseContent = Maybe Bool
a} :: LogConfig)
logConfig_fieldLogLevel :: Lens.Lens' LogConfig FieldLogLevel
logConfig_fieldLogLevel :: (FieldLogLevel -> f FieldLogLevel) -> LogConfig -> f LogConfig
logConfig_fieldLogLevel = (LogConfig -> FieldLogLevel)
-> (LogConfig -> FieldLogLevel -> LogConfig)
-> Lens LogConfig LogConfig FieldLogLevel FieldLogLevel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogConfig' {FieldLogLevel
fieldLogLevel :: FieldLogLevel
$sel:fieldLogLevel:LogConfig' :: LogConfig -> FieldLogLevel
fieldLogLevel} -> FieldLogLevel
fieldLogLevel) (\s :: LogConfig
s@LogConfig' {} FieldLogLevel
a -> LogConfig
s {$sel:fieldLogLevel:LogConfig' :: FieldLogLevel
fieldLogLevel = FieldLogLevel
a} :: LogConfig)
logConfig_cloudWatchLogsRoleArn :: Lens.Lens' LogConfig Prelude.Text
logConfig_cloudWatchLogsRoleArn :: (Text -> f Text) -> LogConfig -> f LogConfig
logConfig_cloudWatchLogsRoleArn = (LogConfig -> Text)
-> (LogConfig -> Text -> LogConfig)
-> Lens LogConfig LogConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogConfig' {Text
cloudWatchLogsRoleArn :: Text
$sel:cloudWatchLogsRoleArn:LogConfig' :: LogConfig -> Text
cloudWatchLogsRoleArn} -> Text
cloudWatchLogsRoleArn) (\s :: LogConfig
s@LogConfig' {} Text
a -> LogConfig
s {$sel:cloudWatchLogsRoleArn:LogConfig' :: Text
cloudWatchLogsRoleArn = Text
a} :: LogConfig)
instance Core.FromJSON LogConfig where
parseJSON :: Value -> Parser LogConfig
parseJSON =
String -> (Object -> Parser LogConfig) -> Value -> Parser LogConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LogConfig"
( \Object
x ->
Maybe Bool -> FieldLogLevel -> Text -> LogConfig
LogConfig'
(Maybe Bool -> FieldLogLevel -> Text -> LogConfig)
-> Parser (Maybe Bool)
-> Parser (FieldLogLevel -> Text -> LogConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"excludeVerboseContent")
Parser (FieldLogLevel -> Text -> LogConfig)
-> Parser FieldLogLevel -> Parser (Text -> LogConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FieldLogLevel
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"fieldLogLevel")
Parser (Text -> LogConfig) -> Parser Text -> Parser LogConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cloudWatchLogsRoleArn")
)
instance Prelude.Hashable LogConfig
instance Prelude.NFData LogConfig
instance Core.ToJSON LogConfig where
toJSON :: LogConfig -> Value
toJSON LogConfig' {Maybe Bool
Text
FieldLogLevel
cloudWatchLogsRoleArn :: Text
fieldLogLevel :: FieldLogLevel
excludeVerboseContent :: Maybe Bool
$sel:cloudWatchLogsRoleArn:LogConfig' :: LogConfig -> Text
$sel:fieldLogLevel:LogConfig' :: LogConfig -> FieldLogLevel
$sel:excludeVerboseContent:LogConfig' :: LogConfig -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"excludeVerboseContent" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
excludeVerboseContent,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"fieldLogLevel" Text -> FieldLogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FieldLogLevel
fieldLogLevel),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"cloudWatchLogsRoleArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cloudWatchLogsRoleArn
)
]
)