{-# 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.WAFV2.Types.LoggingConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFV2.Types.FieldToMatch
import Amazonka.WAFV2.Types.LoggingFilter
data LoggingConfiguration = LoggingConfiguration'
{
LoggingConfiguration -> Maybe LoggingFilter
loggingFilter :: Prelude.Maybe LoggingFilter,
LoggingConfiguration -> Maybe Bool
managedByFirewallManager :: Prelude.Maybe Prelude.Bool,
LoggingConfiguration -> Maybe [FieldToMatch]
redactedFields :: Prelude.Maybe [FieldToMatch],
LoggingConfiguration -> Text
resourceArn :: Prelude.Text,
LoggingConfiguration -> NonEmpty Text
logDestinationConfigs :: Prelude.NonEmpty Prelude.Text
}
deriving (LoggingConfiguration -> LoggingConfiguration -> Bool
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]
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
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. 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 ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
LoggingConfiguration
newLoggingConfiguration :: Text -> NonEmpty Text -> LoggingConfiguration
newLoggingConfiguration
Text
pResourceArn_
NonEmpty Text
pLogDestinationConfigs_ =
LoggingConfiguration'
{ $sel:loggingFilter:LoggingConfiguration' :: Maybe LoggingFilter
loggingFilter =
forall a. Maybe a
Prelude.Nothing,
$sel:managedByFirewallManager:LoggingConfiguration' :: Maybe Bool
managedByFirewallManager = forall a. Maybe a
Prelude.Nothing,
$sel:redactedFields:LoggingConfiguration' :: Maybe [FieldToMatch]
redactedFields = forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:LoggingConfiguration' :: Text
resourceArn = Text
pResourceArn_,
$sel:logDestinationConfigs:LoggingConfiguration' :: NonEmpty Text
logDestinationConfigs =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pLogDestinationConfigs_
}
loggingConfiguration_loggingFilter :: Lens.Lens' LoggingConfiguration (Prelude.Maybe LoggingFilter)
loggingConfiguration_loggingFilter :: Lens' LoggingConfiguration (Maybe LoggingFilter)
loggingConfiguration_loggingFilter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe LoggingFilter
loggingFilter :: Maybe LoggingFilter
$sel:loggingFilter:LoggingConfiguration' :: LoggingConfiguration -> Maybe LoggingFilter
loggingFilter} -> Maybe LoggingFilter
loggingFilter) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe LoggingFilter
a -> LoggingConfiguration
s {$sel:loggingFilter:LoggingConfiguration' :: Maybe LoggingFilter
loggingFilter = Maybe LoggingFilter
a} :: LoggingConfiguration)
loggingConfiguration_managedByFirewallManager :: Lens.Lens' LoggingConfiguration (Prelude.Maybe Prelude.Bool)
loggingConfiguration_managedByFirewallManager :: Lens' LoggingConfiguration (Maybe Bool)
loggingConfiguration_managedByFirewallManager = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe Bool
managedByFirewallManager :: Maybe Bool
$sel:managedByFirewallManager:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
managedByFirewallManager} -> Maybe Bool
managedByFirewallManager) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe Bool
a -> LoggingConfiguration
s {$sel:managedByFirewallManager:LoggingConfiguration' :: Maybe Bool
managedByFirewallManager = Maybe Bool
a} :: LoggingConfiguration)
loggingConfiguration_redactedFields :: Lens.Lens' LoggingConfiguration (Prelude.Maybe [FieldToMatch])
loggingConfiguration_redactedFields :: Lens' LoggingConfiguration (Maybe [FieldToMatch])
loggingConfiguration_redactedFields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Maybe [FieldToMatch]
redactedFields :: Maybe [FieldToMatch]
$sel:redactedFields:LoggingConfiguration' :: LoggingConfiguration -> Maybe [FieldToMatch]
redactedFields} -> Maybe [FieldToMatch]
redactedFields) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Maybe [FieldToMatch]
a -> LoggingConfiguration
s {$sel:redactedFields:LoggingConfiguration' :: Maybe [FieldToMatch]
redactedFields = Maybe [FieldToMatch]
a} :: LoggingConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
loggingConfiguration_resourceArn :: Lens.Lens' LoggingConfiguration Prelude.Text
loggingConfiguration_resourceArn :: Lens' LoggingConfiguration Text
loggingConfiguration_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {Text
resourceArn :: Text
$sel:resourceArn:LoggingConfiguration' :: LoggingConfiguration -> Text
resourceArn} -> Text
resourceArn) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} Text
a -> LoggingConfiguration
s {$sel:resourceArn:LoggingConfiguration' :: Text
resourceArn = Text
a} :: LoggingConfiguration)
loggingConfiguration_logDestinationConfigs :: Lens.Lens' LoggingConfiguration (Prelude.NonEmpty Prelude.Text)
loggingConfiguration_logDestinationConfigs :: Lens' LoggingConfiguration (NonEmpty Text)
loggingConfiguration_logDestinationConfigs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfiguration' {NonEmpty Text
logDestinationConfigs :: NonEmpty Text
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> NonEmpty Text
logDestinationConfigs} -> NonEmpty Text
logDestinationConfigs) (\s :: LoggingConfiguration
s@LoggingConfiguration' {} NonEmpty Text
a -> LoggingConfiguration
s {$sel:logDestinationConfigs:LoggingConfiguration' :: NonEmpty Text
logDestinationConfigs = NonEmpty Text
a} :: LoggingConfiguration) 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 LoggingConfiguration where
parseJSON :: Value -> Parser LoggingConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LoggingConfiguration"
( \Object
x ->
Maybe LoggingFilter
-> Maybe Bool
-> Maybe [FieldToMatch]
-> Text
-> NonEmpty Text
-> LoggingConfiguration
LoggingConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LoggingFilter")
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
"ManagedByFirewallManager")
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
"RedactedFields" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"ResourceArn")
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
"LogDestinationConfigs")
)
instance Prelude.Hashable LoggingConfiguration where
hashWithSalt :: Int -> LoggingConfiguration -> Int
hashWithSalt Int
_salt LoggingConfiguration' {Maybe Bool
Maybe [FieldToMatch]
Maybe LoggingFilter
NonEmpty Text
Text
logDestinationConfigs :: NonEmpty Text
resourceArn :: Text
redactedFields :: Maybe [FieldToMatch]
managedByFirewallManager :: Maybe Bool
loggingFilter :: Maybe LoggingFilter
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> NonEmpty Text
$sel:resourceArn:LoggingConfiguration' :: LoggingConfiguration -> Text
$sel:redactedFields:LoggingConfiguration' :: LoggingConfiguration -> Maybe [FieldToMatch]
$sel:managedByFirewallManager:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
$sel:loggingFilter:LoggingConfiguration' :: LoggingConfiguration -> Maybe LoggingFilter
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LoggingFilter
loggingFilter
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
managedByFirewallManager
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FieldToMatch]
redactedFields
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
logDestinationConfigs
instance Prelude.NFData LoggingConfiguration where
rnf :: LoggingConfiguration -> ()
rnf LoggingConfiguration' {Maybe Bool
Maybe [FieldToMatch]
Maybe LoggingFilter
NonEmpty Text
Text
logDestinationConfigs :: NonEmpty Text
resourceArn :: Text
redactedFields :: Maybe [FieldToMatch]
managedByFirewallManager :: Maybe Bool
loggingFilter :: Maybe LoggingFilter
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> NonEmpty Text
$sel:resourceArn:LoggingConfiguration' :: LoggingConfiguration -> Text
$sel:redactedFields:LoggingConfiguration' :: LoggingConfiguration -> Maybe [FieldToMatch]
$sel:managedByFirewallManager:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
$sel:loggingFilter:LoggingConfiguration' :: LoggingConfiguration -> Maybe LoggingFilter
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe LoggingFilter
loggingFilter
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
managedByFirewallManager
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [FieldToMatch]
redactedFields
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
logDestinationConfigs
instance Data.ToJSON LoggingConfiguration where
toJSON :: LoggingConfiguration -> Value
toJSON LoggingConfiguration' {Maybe Bool
Maybe [FieldToMatch]
Maybe LoggingFilter
NonEmpty Text
Text
logDestinationConfigs :: NonEmpty Text
resourceArn :: Text
redactedFields :: Maybe [FieldToMatch]
managedByFirewallManager :: Maybe Bool
loggingFilter :: Maybe LoggingFilter
$sel:logDestinationConfigs:LoggingConfiguration' :: LoggingConfiguration -> NonEmpty Text
$sel:resourceArn:LoggingConfiguration' :: LoggingConfiguration -> Text
$sel:redactedFields:LoggingConfiguration' :: LoggingConfiguration -> Maybe [FieldToMatch]
$sel:managedByFirewallManager:LoggingConfiguration' :: LoggingConfiguration -> Maybe Bool
$sel:loggingFilter:LoggingConfiguration' :: LoggingConfiguration -> Maybe LoggingFilter
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"LoggingFilter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoggingFilter
loggingFilter,
(Key
"ManagedByFirewallManager" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
managedByFirewallManager,
(Key
"RedactedFields" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FieldToMatch]
redactedFields,
forall a. a -> Maybe a
Prelude.Just (Key
"ResourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceArn),
forall a. a -> Maybe a
Prelude.Just
( Key
"LogDestinationConfigs"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
logDestinationConfigs
)
]
)