{-# 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.IoT.Types.LoggingOptionsPayload where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.LogLevel
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LoggingOptionsPayload = LoggingOptionsPayload'
{
LoggingOptionsPayload -> Maybe LogLevel
logLevel :: Prelude.Maybe LogLevel,
LoggingOptionsPayload -> Text
roleArn :: Prelude.Text
}
deriving (LoggingOptionsPayload -> LoggingOptionsPayload -> Bool
(LoggingOptionsPayload -> LoggingOptionsPayload -> Bool)
-> (LoggingOptionsPayload -> LoggingOptionsPayload -> Bool)
-> Eq LoggingOptionsPayload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingOptionsPayload -> LoggingOptionsPayload -> Bool
$c/= :: LoggingOptionsPayload -> LoggingOptionsPayload -> Bool
== :: LoggingOptionsPayload -> LoggingOptionsPayload -> Bool
$c== :: LoggingOptionsPayload -> LoggingOptionsPayload -> Bool
Prelude.Eq, ReadPrec [LoggingOptionsPayload]
ReadPrec LoggingOptionsPayload
Int -> ReadS LoggingOptionsPayload
ReadS [LoggingOptionsPayload]
(Int -> ReadS LoggingOptionsPayload)
-> ReadS [LoggingOptionsPayload]
-> ReadPrec LoggingOptionsPayload
-> ReadPrec [LoggingOptionsPayload]
-> Read LoggingOptionsPayload
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingOptionsPayload]
$creadListPrec :: ReadPrec [LoggingOptionsPayload]
readPrec :: ReadPrec LoggingOptionsPayload
$creadPrec :: ReadPrec LoggingOptionsPayload
readList :: ReadS [LoggingOptionsPayload]
$creadList :: ReadS [LoggingOptionsPayload]
readsPrec :: Int -> ReadS LoggingOptionsPayload
$creadsPrec :: Int -> ReadS LoggingOptionsPayload
Prelude.Read, Int -> LoggingOptionsPayload -> ShowS
[LoggingOptionsPayload] -> ShowS
LoggingOptionsPayload -> String
(Int -> LoggingOptionsPayload -> ShowS)
-> (LoggingOptionsPayload -> String)
-> ([LoggingOptionsPayload] -> ShowS)
-> Show LoggingOptionsPayload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingOptionsPayload] -> ShowS
$cshowList :: [LoggingOptionsPayload] -> ShowS
show :: LoggingOptionsPayload -> String
$cshow :: LoggingOptionsPayload -> String
showsPrec :: Int -> LoggingOptionsPayload -> ShowS
$cshowsPrec :: Int -> LoggingOptionsPayload -> ShowS
Prelude.Show, (forall x. LoggingOptionsPayload -> Rep LoggingOptionsPayload x)
-> (forall x. Rep LoggingOptionsPayload x -> LoggingOptionsPayload)
-> Generic LoggingOptionsPayload
forall x. Rep LoggingOptionsPayload x -> LoggingOptionsPayload
forall x. LoggingOptionsPayload -> Rep LoggingOptionsPayload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingOptionsPayload x -> LoggingOptionsPayload
$cfrom :: forall x. LoggingOptionsPayload -> Rep LoggingOptionsPayload x
Prelude.Generic)
newLoggingOptionsPayload ::
Prelude.Text ->
LoggingOptionsPayload
newLoggingOptionsPayload :: Text -> LoggingOptionsPayload
newLoggingOptionsPayload Text
pRoleArn_ =
LoggingOptionsPayload' :: Maybe LogLevel -> Text -> LoggingOptionsPayload
LoggingOptionsPayload'
{ $sel:logLevel:LoggingOptionsPayload' :: Maybe LogLevel
logLevel = Maybe LogLevel
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:LoggingOptionsPayload' :: Text
roleArn = Text
pRoleArn_
}
loggingOptionsPayload_logLevel :: Lens.Lens' LoggingOptionsPayload (Prelude.Maybe LogLevel)
loggingOptionsPayload_logLevel :: (Maybe LogLevel -> f (Maybe LogLevel))
-> LoggingOptionsPayload -> f LoggingOptionsPayload
loggingOptionsPayload_logLevel = (LoggingOptionsPayload -> Maybe LogLevel)
-> (LoggingOptionsPayload
-> Maybe LogLevel -> LoggingOptionsPayload)
-> Lens
LoggingOptionsPayload
LoggingOptionsPayload
(Maybe LogLevel)
(Maybe LogLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptionsPayload' {Maybe LogLevel
logLevel :: Maybe LogLevel
$sel:logLevel:LoggingOptionsPayload' :: LoggingOptionsPayload -> Maybe LogLevel
logLevel} -> Maybe LogLevel
logLevel) (\s :: LoggingOptionsPayload
s@LoggingOptionsPayload' {} Maybe LogLevel
a -> LoggingOptionsPayload
s {$sel:logLevel:LoggingOptionsPayload' :: Maybe LogLevel
logLevel = Maybe LogLevel
a} :: LoggingOptionsPayload)
loggingOptionsPayload_roleArn :: Lens.Lens' LoggingOptionsPayload Prelude.Text
loggingOptionsPayload_roleArn :: (Text -> f Text)
-> LoggingOptionsPayload -> f LoggingOptionsPayload
loggingOptionsPayload_roleArn = (LoggingOptionsPayload -> Text)
-> (LoggingOptionsPayload -> Text -> LoggingOptionsPayload)
-> Lens LoggingOptionsPayload LoggingOptionsPayload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptionsPayload' {Text
roleArn :: Text
$sel:roleArn:LoggingOptionsPayload' :: LoggingOptionsPayload -> Text
roleArn} -> Text
roleArn) (\s :: LoggingOptionsPayload
s@LoggingOptionsPayload' {} Text
a -> LoggingOptionsPayload
s {$sel:roleArn:LoggingOptionsPayload' :: Text
roleArn = Text
a} :: LoggingOptionsPayload)
instance Prelude.Hashable LoggingOptionsPayload
instance Prelude.NFData LoggingOptionsPayload
instance Core.ToJSON LoggingOptionsPayload where
toJSON :: LoggingOptionsPayload -> Value
toJSON LoggingOptionsPayload' {Maybe LogLevel
Text
roleArn :: Text
logLevel :: Maybe LogLevel
$sel:roleArn:LoggingOptionsPayload' :: LoggingOptionsPayload -> Text
$sel:logLevel:LoggingOptionsPayload' :: LoggingOptionsPayload -> Maybe LogLevel
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"logLevel" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LogLevel -> Pair) -> Maybe LogLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LogLevel
logLevel,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)