{-# 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.IoTAnalytics.Types.LoggingOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTAnalytics.Types.LoggingLevel
import qualified Amazonka.Prelude as Prelude
data LoggingOptions = LoggingOptions'
{
LoggingOptions -> Text
roleArn :: Prelude.Text,
LoggingOptions -> LoggingLevel
level :: LoggingLevel,
LoggingOptions -> Bool
enabled :: Prelude.Bool
}
deriving (LoggingOptions -> LoggingOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingOptions -> LoggingOptions -> Bool
$c/= :: LoggingOptions -> LoggingOptions -> Bool
== :: LoggingOptions -> LoggingOptions -> Bool
$c== :: LoggingOptions -> LoggingOptions -> Bool
Prelude.Eq, ReadPrec [LoggingOptions]
ReadPrec LoggingOptions
Int -> ReadS LoggingOptions
ReadS [LoggingOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingOptions]
$creadListPrec :: ReadPrec [LoggingOptions]
readPrec :: ReadPrec LoggingOptions
$creadPrec :: ReadPrec LoggingOptions
readList :: ReadS [LoggingOptions]
$creadList :: ReadS [LoggingOptions]
readsPrec :: Int -> ReadS LoggingOptions
$creadsPrec :: Int -> ReadS LoggingOptions
Prelude.Read, Int -> LoggingOptions -> ShowS
[LoggingOptions] -> ShowS
LoggingOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingOptions] -> ShowS
$cshowList :: [LoggingOptions] -> ShowS
show :: LoggingOptions -> String
$cshow :: LoggingOptions -> String
showsPrec :: Int -> LoggingOptions -> ShowS
$cshowsPrec :: Int -> LoggingOptions -> ShowS
Prelude.Show, forall x. Rep LoggingOptions x -> LoggingOptions
forall x. LoggingOptions -> Rep LoggingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingOptions x -> LoggingOptions
$cfrom :: forall x. LoggingOptions -> Rep LoggingOptions x
Prelude.Generic)
newLoggingOptions ::
Prelude.Text ->
LoggingLevel ->
Prelude.Bool ->
LoggingOptions
newLoggingOptions :: Text -> LoggingLevel -> Bool -> LoggingOptions
newLoggingOptions Text
pRoleArn_ LoggingLevel
pLevel_ Bool
pEnabled_ =
LoggingOptions'
{ $sel:roleArn:LoggingOptions' :: Text
roleArn = Text
pRoleArn_,
$sel:level:LoggingOptions' :: LoggingLevel
level = LoggingLevel
pLevel_,
$sel:enabled:LoggingOptions' :: Bool
enabled = Bool
pEnabled_
}
loggingOptions_roleArn :: Lens.Lens' LoggingOptions Prelude.Text
loggingOptions_roleArn :: Lens' LoggingOptions Text
loggingOptions_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptions' {Text
roleArn :: Text
$sel:roleArn:LoggingOptions' :: LoggingOptions -> Text
roleArn} -> Text
roleArn) (\s :: LoggingOptions
s@LoggingOptions' {} Text
a -> LoggingOptions
s {$sel:roleArn:LoggingOptions' :: Text
roleArn = Text
a} :: LoggingOptions)
loggingOptions_level :: Lens.Lens' LoggingOptions LoggingLevel
loggingOptions_level :: Lens' LoggingOptions LoggingLevel
loggingOptions_level = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptions' {LoggingLevel
level :: LoggingLevel
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
level} -> LoggingLevel
level) (\s :: LoggingOptions
s@LoggingOptions' {} LoggingLevel
a -> LoggingOptions
s {$sel:level:LoggingOptions' :: LoggingLevel
level = LoggingLevel
a} :: LoggingOptions)
loggingOptions_enabled :: Lens.Lens' LoggingOptions Prelude.Bool
loggingOptions_enabled :: Lens' LoggingOptions Bool
loggingOptions_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptions' {Bool
enabled :: Bool
$sel:enabled:LoggingOptions' :: LoggingOptions -> Bool
enabled} -> Bool
enabled) (\s :: LoggingOptions
s@LoggingOptions' {} Bool
a -> LoggingOptions
s {$sel:enabled:LoggingOptions' :: Bool
enabled = Bool
a} :: LoggingOptions)
instance Data.FromJSON LoggingOptions where
parseJSON :: Value -> Parser LoggingOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LoggingOptions"
( \Object
x ->
Text -> LoggingLevel -> Bool -> LoggingOptions
LoggingOptions'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"level")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enabled")
)
instance Prelude.Hashable LoggingOptions where
hashWithSalt :: Int -> LoggingOptions -> Int
hashWithSalt Int
_salt LoggingOptions' {Bool
Text
LoggingLevel
enabled :: Bool
level :: LoggingLevel
roleArn :: Text
$sel:enabled:LoggingOptions' :: LoggingOptions -> Bool
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
$sel:roleArn:LoggingOptions' :: LoggingOptions -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LoggingLevel
level
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled
instance Prelude.NFData LoggingOptions where
rnf :: LoggingOptions -> ()
rnf LoggingOptions' {Bool
Text
LoggingLevel
enabled :: Bool
level :: LoggingLevel
roleArn :: Text
$sel:enabled:LoggingOptions' :: LoggingOptions -> Bool
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
$sel:roleArn:LoggingOptions' :: LoggingOptions -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LoggingLevel
level
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled
instance Data.ToJSON LoggingOptions where
toJSON :: LoggingOptions -> Value
toJSON LoggingOptions' {Bool
Text
LoggingLevel
enabled :: Bool
level :: LoggingLevel
roleArn :: Text
$sel:enabled:LoggingOptions' :: LoggingOptions -> Bool
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
$sel:roleArn:LoggingOptions' :: LoggingOptions -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
forall a. a -> Maybe a
Prelude.Just (Key
"level" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LoggingLevel
level),
forall a. a -> Maybe a
Prelude.Just (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enabled)
]
)