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