{-# 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.NetworkFirewall.Types.LoggingConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types.LogDestinationConfig
import qualified Amazonka.Prelude as Prelude
data LoggingConfiguration = LoggingConfiguration'
{
LoggingConfiguration -> [LogDestinationConfig]
logDestinationConfigs :: [LogDestinationConfig]
}
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' :: [LogDestinationConfig] -> LoggingConfiguration
LoggingConfiguration'
{ $sel:logDestinationConfigs:LoggingConfiguration' :: [LogDestinationConfig]
logDestinationConfigs =
[LogDestinationConfig]
forall a. Monoid a => a
Prelude.mempty
}
loggingConfiguration_logDestinationConfigs :: Lens.Lens' LoggingConfiguration [LogDestinationConfig]
loggingConfiguration_logDestinationConfigs :: ([LogDestinationConfig] -> f [LogDestinationConfig])
-> LoggingConfiguration -> f LoggingConfiguration
loggingConfiguration_logDestinationConfigs = (LoggingConfiguration -> [LogDestinationConfig])
-> (LoggingConfiguration
-> [LogDestinationConfig] -> LoggingConfiguration)
-> Lens
LoggingConfiguration
LoggingConfiguration
[LogDestinationConfig]
[LogDestinationConfig]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {[LogDestinationConfig]
logDestinationConfigs :: [LogDestinationConfig]
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> [LogDestinationConfig]
logDestinationConfigs} -> [LogDestinationConfig]
logDestinationConfigs) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} [LogDestinationConfig]
a -> LoggingConfiguration
s {$sel:logDestinationConfigs:LoggingConfiguration' :: [LogDestinationConfig]
logDestinationConfigs = [LogDestinationConfig]
a} :: LoggingConfiguration) (([LogDestinationConfig] -> f [LogDestinationConfig])
-> LoggingConfiguration -> f LoggingConfiguration)
-> (([LogDestinationConfig] -> f [LogDestinationConfig])
-> [LogDestinationConfig] -> f [LogDestinationConfig])
-> ([LogDestinationConfig] -> f [LogDestinationConfig])
-> LoggingConfiguration
-> f LoggingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LogDestinationConfig] -> f [LogDestinationConfig])
-> [LogDestinationConfig] -> f [LogDestinationConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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 ->
[LogDestinationConfig] -> LoggingConfiguration
LoggingConfiguration'
([LogDestinationConfig] -> LoggingConfiguration)
-> Parser [LogDestinationConfig] -> Parser LoggingConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [LogDestinationConfig])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LogDestinationConfigs"
Parser (Maybe [LogDestinationConfig])
-> [LogDestinationConfig] -> Parser [LogDestinationConfig]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [LogDestinationConfig]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable LoggingConfiguration
instance Prelude.NFData LoggingConfiguration
instance Core.ToJSON LoggingConfiguration where
toJSON :: LoggingConfiguration -> Value
toJSON LoggingConfiguration' {[LogDestinationConfig]
logDestinationConfigs :: [LogDestinationConfig]
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> [LogDestinationConfig]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"LogDestinationConfigs"
Text -> [LogDestinationConfig] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [LogDestinationConfig]
logDestinationConfigs
)
]
)