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