{-# 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.ImageBuilder.Types.Logging where
import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types.S3Logs
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Logging = Logging'
{
Logging -> Maybe S3Logs
s3Logs :: Prelude.Maybe S3Logs
}
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 S3Logs -> Logging
Logging' {$sel:s3Logs:Logging' :: Maybe S3Logs
s3Logs = Maybe S3Logs
forall a. Maybe a
Prelude.Nothing}
logging_s3Logs :: Lens.Lens' Logging (Prelude.Maybe S3Logs)
logging_s3Logs :: (Maybe S3Logs -> f (Maybe S3Logs)) -> Logging -> f Logging
logging_s3Logs = (Logging -> Maybe S3Logs)
-> (Logging -> Maybe S3Logs -> Logging)
-> Lens Logging Logging (Maybe S3Logs) (Maybe S3Logs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Logging' {Maybe S3Logs
s3Logs :: Maybe S3Logs
$sel:s3Logs:Logging' :: Logging -> Maybe S3Logs
s3Logs} -> Maybe S3Logs
s3Logs) (\s :: Logging
s@Logging' {} Maybe S3Logs
a -> Logging
s {$sel:s3Logs:Logging' :: Maybe S3Logs
s3Logs = Maybe S3Logs
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 S3Logs -> Logging
Logging' (Maybe S3Logs -> Logging)
-> Parser (Maybe S3Logs) -> Parser Logging
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3Logs)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3Logs"))
instance Prelude.Hashable Logging
instance Prelude.NFData Logging
instance Core.ToJSON Logging where
toJSON :: Logging -> Value
toJSON Logging' {Maybe S3Logs
s3Logs :: Maybe S3Logs
$sel:s3Logs:Logging' :: Logging -> Maybe S3Logs
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"s3Logs" Text -> S3Logs -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3Logs -> Pair) -> Maybe S3Logs -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Logs
s3Logs]
)