{-# 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.LogDestinationConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types.LogDestinationType
import Amazonka.NetworkFirewall.Types.LogType
import qualified Amazonka.Prelude as Prelude
data LogDestinationConfig = LogDestinationConfig'
{
LogDestinationConfig -> LogType
logType :: LogType,
LogDestinationConfig -> LogDestinationType
logDestinationType :: LogDestinationType,
LogDestinationConfig -> HashMap Text Text
logDestination :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (LogDestinationConfig -> LogDestinationConfig -> Bool
(LogDestinationConfig -> LogDestinationConfig -> Bool)
-> (LogDestinationConfig -> LogDestinationConfig -> Bool)
-> Eq LogDestinationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogDestinationConfig -> LogDestinationConfig -> Bool
$c/= :: LogDestinationConfig -> LogDestinationConfig -> Bool
== :: LogDestinationConfig -> LogDestinationConfig -> Bool
$c== :: LogDestinationConfig -> LogDestinationConfig -> Bool
Prelude.Eq, ReadPrec [LogDestinationConfig]
ReadPrec LogDestinationConfig
Int -> ReadS LogDestinationConfig
ReadS [LogDestinationConfig]
(Int -> ReadS LogDestinationConfig)
-> ReadS [LogDestinationConfig]
-> ReadPrec LogDestinationConfig
-> ReadPrec [LogDestinationConfig]
-> Read LogDestinationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogDestinationConfig]
$creadListPrec :: ReadPrec [LogDestinationConfig]
readPrec :: ReadPrec LogDestinationConfig
$creadPrec :: ReadPrec LogDestinationConfig
readList :: ReadS [LogDestinationConfig]
$creadList :: ReadS [LogDestinationConfig]
readsPrec :: Int -> ReadS LogDestinationConfig
$creadsPrec :: Int -> ReadS LogDestinationConfig
Prelude.Read, Int -> LogDestinationConfig -> ShowS
[LogDestinationConfig] -> ShowS
LogDestinationConfig -> String
(Int -> LogDestinationConfig -> ShowS)
-> (LogDestinationConfig -> String)
-> ([LogDestinationConfig] -> ShowS)
-> Show LogDestinationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogDestinationConfig] -> ShowS
$cshowList :: [LogDestinationConfig] -> ShowS
show :: LogDestinationConfig -> String
$cshow :: LogDestinationConfig -> String
showsPrec :: Int -> LogDestinationConfig -> ShowS
$cshowsPrec :: Int -> LogDestinationConfig -> ShowS
Prelude.Show, (forall x. LogDestinationConfig -> Rep LogDestinationConfig x)
-> (forall x. Rep LogDestinationConfig x -> LogDestinationConfig)
-> Generic LogDestinationConfig
forall x. Rep LogDestinationConfig x -> LogDestinationConfig
forall x. LogDestinationConfig -> Rep LogDestinationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogDestinationConfig x -> LogDestinationConfig
$cfrom :: forall x. LogDestinationConfig -> Rep LogDestinationConfig x
Prelude.Generic)
newLogDestinationConfig ::
LogType ->
LogDestinationType ->
LogDestinationConfig
newLogDestinationConfig :: LogType -> LogDestinationType -> LogDestinationConfig
newLogDestinationConfig
LogType
pLogType_
LogDestinationType
pLogDestinationType_ =
LogDestinationConfig' :: LogType
-> LogDestinationType -> HashMap Text Text -> LogDestinationConfig
LogDestinationConfig'
{ $sel:logType:LogDestinationConfig' :: LogType
logType = LogType
pLogType_,
$sel:logDestinationType:LogDestinationConfig' :: LogDestinationType
logDestinationType = LogDestinationType
pLogDestinationType_,
$sel:logDestination:LogDestinationConfig' :: HashMap Text Text
logDestination = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
logDestinationConfig_logType :: Lens.Lens' LogDestinationConfig LogType
logDestinationConfig_logType :: (LogType -> f LogType)
-> LogDestinationConfig -> f LogDestinationConfig
logDestinationConfig_logType = (LogDestinationConfig -> LogType)
-> (LogDestinationConfig -> LogType -> LogDestinationConfig)
-> Lens LogDestinationConfig LogDestinationConfig LogType LogType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDestinationConfig' {LogType
logType :: LogType
$sel:logType:LogDestinationConfig' :: LogDestinationConfig -> LogType
logType} -> LogType
logType) (\s :: LogDestinationConfig
s@LogDestinationConfig' {} LogType
a -> LogDestinationConfig
s {$sel:logType:LogDestinationConfig' :: LogType
logType = LogType
a} :: LogDestinationConfig)
logDestinationConfig_logDestinationType :: Lens.Lens' LogDestinationConfig LogDestinationType
logDestinationConfig_logDestinationType :: (LogDestinationType -> f LogDestinationType)
-> LogDestinationConfig -> f LogDestinationConfig
logDestinationConfig_logDestinationType = (LogDestinationConfig -> LogDestinationType)
-> (LogDestinationConfig
-> LogDestinationType -> LogDestinationConfig)
-> Lens
LogDestinationConfig
LogDestinationConfig
LogDestinationType
LogDestinationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDestinationConfig' {LogDestinationType
logDestinationType :: LogDestinationType
$sel:logDestinationType:LogDestinationConfig' :: LogDestinationConfig -> LogDestinationType
logDestinationType} -> LogDestinationType
logDestinationType) (\s :: LogDestinationConfig
s@LogDestinationConfig' {} LogDestinationType
a -> LogDestinationConfig
s {$sel:logDestinationType:LogDestinationConfig' :: LogDestinationType
logDestinationType = LogDestinationType
a} :: LogDestinationConfig)
logDestinationConfig_logDestination :: Lens.Lens' LogDestinationConfig (Prelude.HashMap Prelude.Text Prelude.Text)
logDestinationConfig_logDestination :: (HashMap Text Text -> f (HashMap Text Text))
-> LogDestinationConfig -> f LogDestinationConfig
logDestinationConfig_logDestination = (LogDestinationConfig -> HashMap Text Text)
-> (LogDestinationConfig
-> HashMap Text Text -> LogDestinationConfig)
-> Lens
LogDestinationConfig
LogDestinationConfig
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDestinationConfig' {HashMap Text Text
logDestination :: HashMap Text Text
$sel:logDestination:LogDestinationConfig' :: LogDestinationConfig -> HashMap Text Text
logDestination} -> HashMap Text Text
logDestination) (\s :: LogDestinationConfig
s@LogDestinationConfig' {} HashMap Text Text
a -> LogDestinationConfig
s {$sel:logDestination:LogDestinationConfig' :: HashMap Text Text
logDestination = HashMap Text Text
a} :: LogDestinationConfig) ((HashMap Text Text -> f (HashMap Text Text))
-> LogDestinationConfig -> f LogDestinationConfig)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> LogDestinationConfig
-> f LogDestinationConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON LogDestinationConfig where
parseJSON :: Value -> Parser LogDestinationConfig
parseJSON =
String
-> (Object -> Parser LogDestinationConfig)
-> Value
-> Parser LogDestinationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LogDestinationConfig"
( \Object
x ->
LogType
-> LogDestinationType -> HashMap Text Text -> LogDestinationConfig
LogDestinationConfig'
(LogType
-> LogDestinationType -> HashMap Text Text -> LogDestinationConfig)
-> Parser LogType
-> Parser
(LogDestinationType -> HashMap Text Text -> LogDestinationConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser LogType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LogType")
Parser
(LogDestinationType -> HashMap Text Text -> LogDestinationConfig)
-> Parser LogDestinationType
-> Parser (HashMap Text Text -> LogDestinationConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LogDestinationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LogDestinationType")
Parser (HashMap Text Text -> LogDestinationConfig)
-> Parser (HashMap Text Text) -> Parser LogDestinationConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LogDestination"
Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable LogDestinationConfig
instance Prelude.NFData LogDestinationConfig
instance Core.ToJSON LogDestinationConfig where
toJSON :: LogDestinationConfig -> Value
toJSON LogDestinationConfig' {HashMap Text Text
LogDestinationType
LogType
logDestination :: HashMap Text Text
logDestinationType :: LogDestinationType
logType :: LogType
$sel:logDestination:LogDestinationConfig' :: LogDestinationConfig -> HashMap Text Text
$sel:logDestinationType:LogDestinationConfig' :: LogDestinationConfig -> LogDestinationType
$sel:logType:LogDestinationConfig' :: LogDestinationConfig -> LogType
..} =
[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
"LogType" Text -> LogType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogType
logType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"LogDestinationType" Text -> LogDestinationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogDestinationType
logDestinationType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"LogDestination" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
logDestination)
]
)