{-# 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.AppMesh.Types.Logging where
import Amazonka.AppMesh.Types.AccessLog
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Logging = Logging'
{
Logging -> Maybe AccessLog
accessLog :: Prelude.Maybe AccessLog
}
deriving (Logging -> Logging -> Bool
(Logging -> Logging -> Bool)
-> (Logging -> Logging -> Bool) -> Eq Logging
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Logging -> Logging -> Bool
$c/= :: Logging -> Logging -> Bool
== :: Logging -> Logging -> Bool
$c== :: Logging -> Logging -> Bool
Prelude.Eq, ReadPrec [Logging]
ReadPrec Logging
Int -> ReadS Logging
ReadS [Logging]
(Int -> ReadS Logging)
-> ReadS [Logging]
-> ReadPrec Logging
-> ReadPrec [Logging]
-> Read Logging
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Logging]
$creadListPrec :: ReadPrec [Logging]
readPrec :: ReadPrec Logging
$creadPrec :: ReadPrec Logging
readList :: ReadS [Logging]
$creadList :: ReadS [Logging]
readsPrec :: Int -> ReadS Logging
$creadsPrec :: Int -> ReadS Logging
Prelude.Read, Int -> Logging -> ShowS
[Logging] -> ShowS
Logging -> String
(Int -> Logging -> ShowS)
-> (Logging -> String) -> ([Logging] -> ShowS) -> Show Logging
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Logging] -> ShowS
$cshowList :: [Logging] -> ShowS
show :: Logging -> String
$cshow :: Logging -> String
showsPrec :: Int -> Logging -> ShowS
$cshowsPrec :: Int -> Logging -> ShowS
Prelude.Show, (forall x. Logging -> Rep Logging x)
-> (forall x. Rep Logging x -> Logging) -> Generic Logging
forall x. Rep Logging x -> Logging
forall x. Logging -> Rep Logging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Logging x -> Logging
$cfrom :: forall x. Logging -> Rep Logging x
Prelude.Generic)
newLogging ::
Logging
newLogging :: Logging
newLogging = Logging' :: Maybe AccessLog -> Logging
Logging' {$sel:accessLog:Logging' :: Maybe AccessLog
accessLog = Maybe AccessLog
forall a. Maybe a
Prelude.Nothing}
logging_accessLog :: Lens.Lens' Logging (Prelude.Maybe AccessLog)
logging_accessLog :: (Maybe AccessLog -> f (Maybe AccessLog)) -> Logging -> f Logging
logging_accessLog = (Logging -> Maybe AccessLog)
-> (Logging -> Maybe AccessLog -> Logging)
-> Lens Logging Logging (Maybe AccessLog) (Maybe AccessLog)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Logging' {Maybe AccessLog
accessLog :: Maybe AccessLog
$sel:accessLog:Logging' :: Logging -> Maybe AccessLog
accessLog} -> Maybe AccessLog
accessLog) (\s :: Logging
s@Logging' {} Maybe AccessLog
a -> Logging
s {$sel:accessLog:Logging' :: Maybe AccessLog
accessLog = Maybe AccessLog
a} :: Logging)
instance Core.FromJSON Logging where
parseJSON :: Value -> Parser Logging
parseJSON =
String -> (Object -> Parser Logging) -> Value -> Parser Logging
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Logging"
( \Object
x ->
Maybe AccessLog -> Logging
Logging' (Maybe AccessLog -> Logging)
-> Parser (Maybe AccessLog) -> Parser Logging
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AccessLog)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accessLog")
)
instance Prelude.Hashable Logging
instance Prelude.NFData Logging
instance Core.ToJSON Logging where
toJSON :: Logging -> Value
toJSON Logging' {Maybe AccessLog
accessLog :: Maybe AccessLog
$sel:accessLog:Logging' :: Logging -> Maybe AccessLog
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"accessLog" Text -> AccessLog -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AccessLog -> Pair) -> Maybe AccessLog -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AccessLog
accessLog]
)