{-# 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.StepFunctions.Types.LoggingConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.StepFunctions.Types.LogDestination
import Amazonka.StepFunctions.Types.LogLevel
data LoggingConfiguration = LoggingConfiguration'
{
LoggingConfiguration -> Maybe Bool
includeExecutionData :: Prelude.Maybe Prelude.Bool,
LoggingConfiguration -> Maybe [LogDestination]
destinations :: Prelude.Maybe [LogDestination],
LoggingConfiguration -> Maybe LogLevel
level :: Prelude.Maybe LogLevel
}
deriving (LoggingConfiguration -> LoggingConfiguration -> Bool
(LoggingConfiguration -> LoggingConfiguration -> Bool)
-> (LoggingConfiguration -> LoggingConfiguration -> Bool)
-> Eq LoggingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingConfiguration -> LoggingConfiguration -> Bool
$c/= :: LoggingConfiguration -> LoggingConfiguration -> Bool
== :: LoggingConfiguration -> LoggingConfiguration -> Bool
$c== :: LoggingConfiguration -> LoggingConfiguration -> Bool
Prelude.Eq, ReadPrec [LoggingConfiguration]
ReadPrec LoggingConfiguration
Int -> ReadS LoggingConfiguration
ReadS [LoggingConfiguration]
(Int -> ReadS LoggingConfiguration)
-> ReadS [LoggingConfiguration]
-> ReadPrec LoggingConfiguration
-> ReadPrec [LoggingConfiguration]
-> Read LoggingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingConfiguration]
$creadListPrec :: ReadPrec [LoggingConfiguration]
readPrec :: ReadPrec LoggingConfiguration
$creadPrec :: ReadPrec LoggingConfiguration
readList :: ReadS [LoggingConfiguration]
$creadList :: ReadS [LoggingConfiguration]
readsPrec :: Int -> ReadS LoggingConfiguration
$creadsPrec :: Int -> ReadS LoggingConfiguration
Prelude.Read, Int -> LoggingConfiguration -> ShowS
[LoggingConfiguration] -> ShowS
LoggingConfiguration -> String
(Int -> LoggingConfiguration -> ShowS)
-> (LoggingConfiguration -> String)
-> ([LoggingConfiguration] -> ShowS)
-> Show LoggingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingConfiguration] -> ShowS
$cshowList :: [LoggingConfiguration] -> ShowS
show :: LoggingConfiguration -> String
$cshow :: LoggingConfiguration -> String
showsPrec :: Int -> LoggingConfiguration -> ShowS
$cshowsPrec :: Int -> LoggingConfiguration -> ShowS
Prelude.Show, (forall x. LoggingConfiguration -> Rep LoggingConfiguration x)
-> (forall x. Rep LoggingConfiguration x -> LoggingConfiguration)
-> Generic LoggingConfiguration
forall x. Rep LoggingConfiguration x -> LoggingConfiguration
forall x. LoggingConfiguration -> Rep LoggingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingConfiguration x -> LoggingConfiguration
$cfrom :: forall x. LoggingConfiguration -> Rep LoggingConfiguration x
Prelude.Generic)
newLoggingConfiguration ::
LoggingConfiguration
newLoggingConfiguration :: LoggingConfiguration
newLoggingConfiguration =
LoggingConfiguration' :: Maybe Bool
-> Maybe [LogDestination] -> Maybe LogLevel -> LoggingConfiguration
LoggingConfiguration'
{ $sel:includeExecutionData:LoggingConfiguration' :: Maybe Bool
includeExecutionData =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:destinations:LoggingConfiguration' :: Maybe [LogDestination]
destinations = Maybe [LogDestination]
forall a. Maybe a
Prelude.Nothing,
$sel:level:LoggingConfiguration' :: Maybe LogLevel
level = Maybe LogLevel
forall a. Maybe a
Prelude.Nothing
}
loggingConfiguration_includeExecutionData :: Lens.Lens' LoggingConfiguration (Prelude.Maybe Prelude.Bool)
loggingConfiguration_includeExecutionData :: (Maybe Bool -> f (Maybe Bool))
-> LoggingConfiguration -> f LoggingConfiguration
loggingConfiguration_includeExecutionData = (LoggingConfiguration -> Maybe Bool)
-> (LoggingConfiguration -> Maybe Bool -> LoggingConfiguration)
-> Lens
LoggingConfiguration LoggingConfiguration (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe Bool
includeExecutionData :: Maybe Bool
$sel:includeExecutionData:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
includeExecutionData} -> Maybe Bool
includeExecutionData) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe Bool
a -> LoggingConfiguration
s {$sel:includeExecutionData:LoggingConfiguration' :: Maybe Bool
includeExecutionData = Maybe Bool
a} :: LoggingConfiguration)
loggingConfiguration_destinations :: Lens.Lens' LoggingConfiguration (Prelude.Maybe [LogDestination])
loggingConfiguration_destinations :: (Maybe [LogDestination] -> f (Maybe [LogDestination]))
-> LoggingConfiguration -> f LoggingConfiguration
loggingConfiguration_destinations = (LoggingConfiguration -> Maybe [LogDestination])
-> (LoggingConfiguration
-> Maybe [LogDestination] -> LoggingConfiguration)
-> Lens
LoggingConfiguration
LoggingConfiguration
(Maybe [LogDestination])
(Maybe [LogDestination])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe [LogDestination]
destinations :: Maybe [LogDestination]
$sel:destinations:LoggingConfiguration' :: LoggingConfiguration -> Maybe [LogDestination]
destinations} -> Maybe [LogDestination]
destinations) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe [LogDestination]
a -> LoggingConfiguration
s {$sel:destinations:LoggingConfiguration' :: Maybe [LogDestination]
destinations = Maybe [LogDestination]
a} :: LoggingConfiguration) ((Maybe [LogDestination] -> f (Maybe [LogDestination]))
-> LoggingConfiguration -> f LoggingConfiguration)
-> ((Maybe [LogDestination] -> f (Maybe [LogDestination]))
-> Maybe [LogDestination] -> f (Maybe [LogDestination]))
-> (Maybe [LogDestination] -> f (Maybe [LogDestination]))
-> LoggingConfiguration
-> f LoggingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LogDestination] [LogDestination] [LogDestination] [LogDestination]
-> Iso
(Maybe [LogDestination])
(Maybe [LogDestination])
(Maybe [LogDestination])
(Maybe [LogDestination])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[LogDestination] [LogDestination] [LogDestination] [LogDestination]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
loggingConfiguration_level :: Lens.Lens' LoggingConfiguration (Prelude.Maybe LogLevel)
loggingConfiguration_level :: (Maybe LogLevel -> f (Maybe LogLevel))
-> LoggingConfiguration -> f LoggingConfiguration
loggingConfiguration_level = (LoggingConfiguration -> Maybe LogLevel)
-> (LoggingConfiguration -> Maybe LogLevel -> LoggingConfiguration)
-> Lens
LoggingConfiguration
LoggingConfiguration
(Maybe LogLevel)
(Maybe LogLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe LogLevel
level :: Maybe LogLevel
$sel:level:LoggingConfiguration' :: LoggingConfiguration -> Maybe LogLevel
level} -> Maybe LogLevel
level) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe LogLevel
a -> LoggingConfiguration
s {$sel:level:LoggingConfiguration' :: Maybe LogLevel
level = Maybe LogLevel
a} :: LoggingConfiguration)
instance Core.FromJSON LoggingConfiguration where
parseJSON :: Value -> Parser LoggingConfiguration
parseJSON =
String
-> (Object -> Parser LoggingConfiguration)
-> Value
-> Parser LoggingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LoggingConfiguration"
( \Object
x ->
Maybe Bool
-> Maybe [LogDestination] -> Maybe LogLevel -> LoggingConfiguration
LoggingConfiguration'
(Maybe Bool
-> Maybe [LogDestination]
-> Maybe LogLevel
-> LoggingConfiguration)
-> Parser (Maybe Bool)
-> Parser
(Maybe [LogDestination] -> Maybe LogLevel -> LoggingConfiguration)
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
"includeExecutionData")
Parser
(Maybe [LogDestination] -> Maybe LogLevel -> LoggingConfiguration)
-> Parser (Maybe [LogDestination])
-> Parser (Maybe LogLevel -> LoggingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [LogDestination]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinations" Parser (Maybe (Maybe [LogDestination]))
-> Maybe [LogDestination] -> Parser (Maybe [LogDestination])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LogDestination]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe LogLevel -> LoggingConfiguration)
-> Parser (Maybe LogLevel) -> Parser LoggingConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LogLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"level")
)
instance Prelude.Hashable LoggingConfiguration
instance Prelude.NFData LoggingConfiguration
instance Core.ToJSON LoggingConfiguration where
toJSON :: LoggingConfiguration -> Value
toJSON LoggingConfiguration' {Maybe Bool
Maybe [LogDestination]
Maybe LogLevel
level :: Maybe LogLevel
destinations :: Maybe [LogDestination]
includeExecutionData :: Maybe Bool
$sel:level:LoggingConfiguration' :: LoggingConfiguration -> Maybe LogLevel
$sel:destinations:LoggingConfiguration' :: LoggingConfiguration -> Maybe [LogDestination]
$sel:includeExecutionData:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"includeExecutionData" 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
includeExecutionData,
(Text
"destinations" Text -> [LogDestination] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([LogDestination] -> Pair) -> Maybe [LogDestination] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [LogDestination]
destinations,
(Text
"level" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LogLevel -> Pair) -> Maybe LogLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LogLevel
level
]
)