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