{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data LogPublishingOption = LogPublishingOption'
{ LogPublishingOption -> Maybe Text
cloudWatchLogsLogGroupArn :: Prelude.Maybe Prelude.Text,
LogPublishingOption -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
}
deriving (LogPublishingOption -> LogPublishingOption -> Bool
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]
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
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. 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'
{ $sel:cloudWatchLogsLogGroupArn:LogPublishingOption' :: Maybe Text
cloudWatchLogsLogGroupArn =
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:LogPublishingOption' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing
}
logPublishingOption_cloudWatchLogsLogGroupArn :: Lens.Lens' LogPublishingOption (Prelude.Maybe Prelude.Text)
logPublishingOption_cloudWatchLogsLogGroupArn :: Lens' LogPublishingOption (Maybe Text)
logPublishingOption_cloudWatchLogsLogGroupArn = 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)
logPublishingOption_enabled :: Lens.Lens' LogPublishingOption (Prelude.Maybe Prelude.Bool)
logPublishingOption_enabled :: Lens' LogPublishingOption (Maybe Bool)
logPublishingOption_enabled = 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)
instance Data.FromJSON LogPublishingOption where
parseJSON :: Value -> Parser LogPublishingOption
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LogPublishingOption"
( \Object
x ->
Maybe Text -> Maybe Bool -> LogPublishingOption
LogPublishingOption'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CloudWatchLogsLogGroupArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Enabled")
)
instance Prelude.Hashable LogPublishingOption where
hashWithSalt :: Int -> LogPublishingOption -> Int
hashWithSalt Int
_salt LogPublishingOption' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudWatchLogsLogGroupArn :: Maybe Text
$sel:enabled:LogPublishingOption' :: LogPublishingOption -> Maybe Bool
$sel:cloudWatchLogsLogGroupArn:LogPublishingOption' :: LogPublishingOption -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudWatchLogsLogGroupArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
instance Prelude.NFData LogPublishingOption where
rnf :: LogPublishingOption -> ()
rnf LogPublishingOption' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudWatchLogsLogGroupArn :: Maybe Text
$sel:enabled:LogPublishingOption' :: LogPublishingOption -> Maybe Bool
$sel:cloudWatchLogsLogGroupArn:LogPublishingOption' :: LogPublishingOption -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudWatchLogsLogGroupArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
instance Data.ToJSON LogPublishingOption where
toJSON :: LogPublishingOption -> Value
toJSON LogPublishingOption' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudWatchLogsLogGroupArn :: Maybe Text
$sel:enabled:LogPublishingOption' :: LogPublishingOption -> Maybe Bool
$sel:cloudWatchLogsLogGroupArn:LogPublishingOption' :: LogPublishingOption -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CloudWatchLogsLogGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cloudWatchLogsLogGroupArn,
(Key
"Enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled
]
)