{-# 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.CloudFront.Types.LoggingConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LoggingConfig = LoggingConfig'
{
LoggingConfig -> Bool
enabled :: Prelude.Bool,
LoggingConfig -> Bool
includeCookies :: Prelude.Bool,
LoggingConfig -> Text
bucket :: Prelude.Text,
LoggingConfig -> Text
prefix :: Prelude.Text
}
deriving (LoggingConfig -> LoggingConfig -> Bool
(LoggingConfig -> LoggingConfig -> Bool)
-> (LoggingConfig -> LoggingConfig -> Bool) -> Eq LoggingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingConfig -> LoggingConfig -> Bool
$c/= :: LoggingConfig -> LoggingConfig -> Bool
== :: LoggingConfig -> LoggingConfig -> Bool
$c== :: LoggingConfig -> LoggingConfig -> Bool
Prelude.Eq, ReadPrec [LoggingConfig]
ReadPrec LoggingConfig
Int -> ReadS LoggingConfig
ReadS [LoggingConfig]
(Int -> ReadS LoggingConfig)
-> ReadS [LoggingConfig]
-> ReadPrec LoggingConfig
-> ReadPrec [LoggingConfig]
-> Read LoggingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingConfig]
$creadListPrec :: ReadPrec [LoggingConfig]
readPrec :: ReadPrec LoggingConfig
$creadPrec :: ReadPrec LoggingConfig
readList :: ReadS [LoggingConfig]
$creadList :: ReadS [LoggingConfig]
readsPrec :: Int -> ReadS LoggingConfig
$creadsPrec :: Int -> ReadS LoggingConfig
Prelude.Read, Int -> LoggingConfig -> ShowS
[LoggingConfig] -> ShowS
LoggingConfig -> String
(Int -> LoggingConfig -> ShowS)
-> (LoggingConfig -> String)
-> ([LoggingConfig] -> ShowS)
-> Show LoggingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingConfig] -> ShowS
$cshowList :: [LoggingConfig] -> ShowS
show :: LoggingConfig -> String
$cshow :: LoggingConfig -> String
showsPrec :: Int -> LoggingConfig -> ShowS
$cshowsPrec :: Int -> LoggingConfig -> ShowS
Prelude.Show, (forall x. LoggingConfig -> Rep LoggingConfig x)
-> (forall x. Rep LoggingConfig x -> LoggingConfig)
-> Generic LoggingConfig
forall x. Rep LoggingConfig x -> LoggingConfig
forall x. LoggingConfig -> Rep LoggingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingConfig x -> LoggingConfig
$cfrom :: forall x. LoggingConfig -> Rep LoggingConfig x
Prelude.Generic)
newLoggingConfig ::
Prelude.Bool ->
Prelude.Bool ->
Prelude.Text ->
Prelude.Text ->
LoggingConfig
newLoggingConfig :: Bool -> Bool -> Text -> Text -> LoggingConfig
newLoggingConfig
Bool
pEnabled_
Bool
pIncludeCookies_
Text
pBucket_
Text
pPrefix_ =
LoggingConfig' :: Bool -> Bool -> Text -> Text -> LoggingConfig
LoggingConfig'
{ $sel:enabled:LoggingConfig' :: Bool
enabled = Bool
pEnabled_,
$sel:includeCookies:LoggingConfig' :: Bool
includeCookies = Bool
pIncludeCookies_,
$sel:bucket:LoggingConfig' :: Text
bucket = Text
pBucket_,
$sel:prefix:LoggingConfig' :: Text
prefix = Text
pPrefix_
}
loggingConfig_enabled :: Lens.Lens' LoggingConfig Prelude.Bool
loggingConfig_enabled :: (Bool -> f Bool) -> LoggingConfig -> f LoggingConfig
loggingConfig_enabled = (LoggingConfig -> Bool)
-> (LoggingConfig -> Bool -> LoggingConfig)
-> Lens LoggingConfig LoggingConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfig' {Bool
enabled :: Bool
$sel:enabled:LoggingConfig' :: LoggingConfig -> Bool
enabled} -> Bool
enabled) (\s :: LoggingConfig
s@LoggingConfig' {} Bool
a -> LoggingConfig
s {$sel:enabled:LoggingConfig' :: Bool
enabled = Bool
a} :: LoggingConfig)
loggingConfig_includeCookies :: Lens.Lens' LoggingConfig Prelude.Bool
loggingConfig_includeCookies :: (Bool -> f Bool) -> LoggingConfig -> f LoggingConfig
loggingConfig_includeCookies = (LoggingConfig -> Bool)
-> (LoggingConfig -> Bool -> LoggingConfig)
-> Lens LoggingConfig LoggingConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfig' {Bool
includeCookies :: Bool
$sel:includeCookies:LoggingConfig' :: LoggingConfig -> Bool
includeCookies} -> Bool
includeCookies) (\s :: LoggingConfig
s@LoggingConfig' {} Bool
a -> LoggingConfig
s {$sel:includeCookies:LoggingConfig' :: Bool
includeCookies = Bool
a} :: LoggingConfig)
loggingConfig_bucket :: Lens.Lens' LoggingConfig Prelude.Text
loggingConfig_bucket :: (Text -> f Text) -> LoggingConfig -> f LoggingConfig
loggingConfig_bucket = (LoggingConfig -> Text)
-> (LoggingConfig -> Text -> LoggingConfig)
-> Lens LoggingConfig LoggingConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfig' {Text
bucket :: Text
$sel:bucket:LoggingConfig' :: LoggingConfig -> Text
bucket} -> Text
bucket) (\s :: LoggingConfig
s@LoggingConfig' {} Text
a -> LoggingConfig
s {$sel:bucket:LoggingConfig' :: Text
bucket = Text
a} :: LoggingConfig)
loggingConfig_prefix :: Lens.Lens' LoggingConfig Prelude.Text
loggingConfig_prefix :: (Text -> f Text) -> LoggingConfig -> f LoggingConfig
loggingConfig_prefix = (LoggingConfig -> Text)
-> (LoggingConfig -> Text -> LoggingConfig)
-> Lens LoggingConfig LoggingConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfig' {Text
prefix :: Text
$sel:prefix:LoggingConfig' :: LoggingConfig -> Text
prefix} -> Text
prefix) (\s :: LoggingConfig
s@LoggingConfig' {} Text
a -> LoggingConfig
s {$sel:prefix:LoggingConfig' :: Text
prefix = Text
a} :: LoggingConfig)
instance Core.FromXML LoggingConfig where
parseXML :: [Node] -> Either String LoggingConfig
parseXML [Node]
x =
Bool -> Bool -> Text -> Text -> LoggingConfig
LoggingConfig'
(Bool -> Bool -> Text -> Text -> LoggingConfig)
-> Either String Bool
-> Either String (Bool -> Text -> Text -> LoggingConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Enabled")
Either String (Bool -> Text -> Text -> LoggingConfig)
-> Either String Bool
-> Either String (Text -> Text -> LoggingConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"IncludeCookies")
Either String (Text -> Text -> LoggingConfig)
-> Either String Text -> Either String (Text -> LoggingConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Bucket")
Either String (Text -> LoggingConfig)
-> Either String Text -> Either String LoggingConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Prefix")
instance Prelude.Hashable LoggingConfig
instance Prelude.NFData LoggingConfig
instance Core.ToXML LoggingConfig where
toXML :: LoggingConfig -> XML
toXML LoggingConfig' {Bool
Text
prefix :: Text
bucket :: Text
includeCookies :: Bool
enabled :: Bool
$sel:prefix:LoggingConfig' :: LoggingConfig -> Text
$sel:bucket:LoggingConfig' :: LoggingConfig -> Text
$sel:includeCookies:LoggingConfig' :: LoggingConfig -> Bool
$sel:enabled:LoggingConfig' :: LoggingConfig -> Bool
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Enabled" Name -> Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Bool
enabled,
Name
"IncludeCookies" Name -> Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Bool
includeCookies,
Name
"Bucket" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
bucket,
Name
"Prefix" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
prefix
]