{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:logType:LogDestinationConfig' :: LogType
logType = LogType
pLogType_,
$sel:logDestinationType:LogDestinationConfig' :: LogDestinationType
logDestinationType = LogDestinationType
pLogDestinationType_,
$sel:logDestination:LogDestinationConfig' :: HashMap Text Text
logDestination = forall a. Monoid a => a
Prelude.mempty
}
logDestinationConfig_logType :: Lens.Lens' LogDestinationConfig LogType
logDestinationConfig_logType :: Lens' LogDestinationConfig LogType
logDestinationConfig_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 :: Lens' LogDestinationConfig LogDestinationType
logDestinationConfig_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 :: Lens' LogDestinationConfig (HashMap Text Text)
logDestinationConfig_logDestination = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON LogDestinationConfig where
parseJSON :: Value -> Parser LogDestinationConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LogDestinationConfig"
( \Object
x ->
LogType
-> LogDestinationType -> HashMap Text Text -> LogDestinationConfig
LogDestinationConfig'
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
"LogType")
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
"LogDestinationType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LogDestination"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable LogDestinationConfig where
hashWithSalt :: Int -> LogDestinationConfig -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LogType
logType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LogDestinationType
logDestinationType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Text
logDestination
instance Prelude.NFData LogDestinationConfig where
rnf :: LogDestinationConfig -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf LogType
logType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LogDestinationType
logDestinationType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Text
logDestination
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"LogType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LogType
logType),
forall a. a -> Maybe a
Prelude.Just
(Key
"LogDestinationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LogDestinationType
logDestinationType),
forall a. a -> Maybe a
Prelude.Just
(Key
"LogDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text Text
logDestination)
]
)