{-# 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.Greengrass.Types.GreengrassLogger where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types.LoggerComponent
import Amazonka.Greengrass.Types.LoggerLevel
import Amazonka.Greengrass.Types.LoggerType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GreengrassLogger = GreengrassLogger'
{
GreengrassLogger -> Maybe Int
space :: Prelude.Maybe Prelude.Int,
GreengrassLogger -> LoggerType
type' :: LoggerType,
GreengrassLogger -> LoggerLevel
level :: LoggerLevel,
GreengrassLogger -> Text
id :: Prelude.Text,
GreengrassLogger -> LoggerComponent
component :: LoggerComponent
}
deriving (GreengrassLogger -> GreengrassLogger -> Bool
(GreengrassLogger -> GreengrassLogger -> Bool)
-> (GreengrassLogger -> GreengrassLogger -> Bool)
-> Eq GreengrassLogger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GreengrassLogger -> GreengrassLogger -> Bool
$c/= :: GreengrassLogger -> GreengrassLogger -> Bool
== :: GreengrassLogger -> GreengrassLogger -> Bool
$c== :: GreengrassLogger -> GreengrassLogger -> Bool
Prelude.Eq, ReadPrec [GreengrassLogger]
ReadPrec GreengrassLogger
Int -> ReadS GreengrassLogger
ReadS [GreengrassLogger]
(Int -> ReadS GreengrassLogger)
-> ReadS [GreengrassLogger]
-> ReadPrec GreengrassLogger
-> ReadPrec [GreengrassLogger]
-> Read GreengrassLogger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GreengrassLogger]
$creadListPrec :: ReadPrec [GreengrassLogger]
readPrec :: ReadPrec GreengrassLogger
$creadPrec :: ReadPrec GreengrassLogger
readList :: ReadS [GreengrassLogger]
$creadList :: ReadS [GreengrassLogger]
readsPrec :: Int -> ReadS GreengrassLogger
$creadsPrec :: Int -> ReadS GreengrassLogger
Prelude.Read, Int -> GreengrassLogger -> ShowS
[GreengrassLogger] -> ShowS
GreengrassLogger -> String
(Int -> GreengrassLogger -> ShowS)
-> (GreengrassLogger -> String)
-> ([GreengrassLogger] -> ShowS)
-> Show GreengrassLogger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GreengrassLogger] -> ShowS
$cshowList :: [GreengrassLogger] -> ShowS
show :: GreengrassLogger -> String
$cshow :: GreengrassLogger -> String
showsPrec :: Int -> GreengrassLogger -> ShowS
$cshowsPrec :: Int -> GreengrassLogger -> ShowS
Prelude.Show, (forall x. GreengrassLogger -> Rep GreengrassLogger x)
-> (forall x. Rep GreengrassLogger x -> GreengrassLogger)
-> Generic GreengrassLogger
forall x. Rep GreengrassLogger x -> GreengrassLogger
forall x. GreengrassLogger -> Rep GreengrassLogger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GreengrassLogger x -> GreengrassLogger
$cfrom :: forall x. GreengrassLogger -> Rep GreengrassLogger x
Prelude.Generic)
newGreengrassLogger ::
LoggerType ->
LoggerLevel ->
Prelude.Text ->
LoggerComponent ->
GreengrassLogger
newGreengrassLogger :: LoggerType
-> LoggerLevel -> Text -> LoggerComponent -> GreengrassLogger
newGreengrassLogger LoggerType
pType_ LoggerLevel
pLevel_ Text
pId_ LoggerComponent
pComponent_ =
GreengrassLogger' :: Maybe Int
-> LoggerType
-> LoggerLevel
-> Text
-> LoggerComponent
-> GreengrassLogger
GreengrassLogger'
{ $sel:space:GreengrassLogger' :: Maybe Int
space = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':GreengrassLogger' :: LoggerType
type' = LoggerType
pType_,
$sel:level:GreengrassLogger' :: LoggerLevel
level = LoggerLevel
pLevel_,
$sel:id:GreengrassLogger' :: Text
id = Text
pId_,
$sel:component:GreengrassLogger' :: LoggerComponent
component = LoggerComponent
pComponent_
}
greengrassLogger_space :: Lens.Lens' GreengrassLogger (Prelude.Maybe Prelude.Int)
greengrassLogger_space :: (Maybe Int -> f (Maybe Int))
-> GreengrassLogger -> f GreengrassLogger
greengrassLogger_space = (GreengrassLogger -> Maybe Int)
-> (GreengrassLogger -> Maybe Int -> GreengrassLogger)
-> Lens GreengrassLogger GreengrassLogger (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GreengrassLogger' {Maybe Int
space :: Maybe Int
$sel:space:GreengrassLogger' :: GreengrassLogger -> Maybe Int
space} -> Maybe Int
space) (\s :: GreengrassLogger
s@GreengrassLogger' {} Maybe Int
a -> GreengrassLogger
s {$sel:space:GreengrassLogger' :: Maybe Int
space = Maybe Int
a} :: GreengrassLogger)
greengrassLogger_type :: Lens.Lens' GreengrassLogger LoggerType
greengrassLogger_type :: (LoggerType -> f LoggerType)
-> GreengrassLogger -> f GreengrassLogger
greengrassLogger_type = (GreengrassLogger -> LoggerType)
-> (GreengrassLogger -> LoggerType -> GreengrassLogger)
-> Lens GreengrassLogger GreengrassLogger LoggerType LoggerType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GreengrassLogger' {LoggerType
type' :: LoggerType
$sel:type':GreengrassLogger' :: GreengrassLogger -> LoggerType
type'} -> LoggerType
type') (\s :: GreengrassLogger
s@GreengrassLogger' {} LoggerType
a -> GreengrassLogger
s {$sel:type':GreengrassLogger' :: LoggerType
type' = LoggerType
a} :: GreengrassLogger)
greengrassLogger_level :: Lens.Lens' GreengrassLogger LoggerLevel
greengrassLogger_level :: (LoggerLevel -> f LoggerLevel)
-> GreengrassLogger -> f GreengrassLogger
greengrassLogger_level = (GreengrassLogger -> LoggerLevel)
-> (GreengrassLogger -> LoggerLevel -> GreengrassLogger)
-> Lens GreengrassLogger GreengrassLogger LoggerLevel LoggerLevel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GreengrassLogger' {LoggerLevel
level :: LoggerLevel
$sel:level:GreengrassLogger' :: GreengrassLogger -> LoggerLevel
level} -> LoggerLevel
level) (\s :: GreengrassLogger
s@GreengrassLogger' {} LoggerLevel
a -> GreengrassLogger
s {$sel:level:GreengrassLogger' :: LoggerLevel
level = LoggerLevel
a} :: GreengrassLogger)
greengrassLogger_id :: Lens.Lens' GreengrassLogger Prelude.Text
greengrassLogger_id :: (Text -> f Text) -> GreengrassLogger -> f GreengrassLogger
greengrassLogger_id = (GreengrassLogger -> Text)
-> (GreengrassLogger -> Text -> GreengrassLogger)
-> Lens GreengrassLogger GreengrassLogger Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GreengrassLogger' {Text
id :: Text
$sel:id:GreengrassLogger' :: GreengrassLogger -> Text
id} -> Text
id) (\s :: GreengrassLogger
s@GreengrassLogger' {} Text
a -> GreengrassLogger
s {$sel:id:GreengrassLogger' :: Text
id = Text
a} :: GreengrassLogger)
greengrassLogger_component :: Lens.Lens' GreengrassLogger LoggerComponent
greengrassLogger_component :: (LoggerComponent -> f LoggerComponent)
-> GreengrassLogger -> f GreengrassLogger
greengrassLogger_component = (GreengrassLogger -> LoggerComponent)
-> (GreengrassLogger -> LoggerComponent -> GreengrassLogger)
-> Lens
GreengrassLogger GreengrassLogger LoggerComponent LoggerComponent
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GreengrassLogger' {LoggerComponent
component :: LoggerComponent
$sel:component:GreengrassLogger' :: GreengrassLogger -> LoggerComponent
component} -> LoggerComponent
component) (\s :: GreengrassLogger
s@GreengrassLogger' {} LoggerComponent
a -> GreengrassLogger
s {$sel:component:GreengrassLogger' :: LoggerComponent
component = LoggerComponent
a} :: GreengrassLogger)
instance Core.FromJSON GreengrassLogger where
parseJSON :: Value -> Parser GreengrassLogger
parseJSON =
String
-> (Object -> Parser GreengrassLogger)
-> Value
-> Parser GreengrassLogger
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GreengrassLogger"
( \Object
x ->
Maybe Int
-> LoggerType
-> LoggerLevel
-> Text
-> LoggerComponent
-> GreengrassLogger
GreengrassLogger'
(Maybe Int
-> LoggerType
-> LoggerLevel
-> Text
-> LoggerComponent
-> GreengrassLogger)
-> Parser (Maybe Int)
-> Parser
(LoggerType
-> LoggerLevel -> Text -> LoggerComponent -> GreengrassLogger)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Space")
Parser
(LoggerType
-> LoggerLevel -> Text -> LoggerComponent -> GreengrassLogger)
-> Parser LoggerType
-> Parser
(LoggerLevel -> Text -> LoggerComponent -> GreengrassLogger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LoggerType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
Parser (LoggerLevel -> Text -> LoggerComponent -> GreengrassLogger)
-> Parser LoggerLevel
-> Parser (Text -> LoggerComponent -> GreengrassLogger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LoggerLevel
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Level")
Parser (Text -> LoggerComponent -> GreengrassLogger)
-> Parser Text -> Parser (LoggerComponent -> GreengrassLogger)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
Parser (LoggerComponent -> GreengrassLogger)
-> Parser LoggerComponent -> Parser GreengrassLogger
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LoggerComponent
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Component")
)
instance Prelude.Hashable GreengrassLogger
instance Prelude.NFData GreengrassLogger
instance Core.ToJSON GreengrassLogger where
toJSON :: GreengrassLogger -> Value
toJSON GreengrassLogger' {Maybe Int
Text
LoggerComponent
LoggerLevel
LoggerType
component :: LoggerComponent
id :: Text
level :: LoggerLevel
type' :: LoggerType
space :: Maybe Int
$sel:component:GreengrassLogger' :: GreengrassLogger -> LoggerComponent
$sel:id:GreengrassLogger' :: GreengrassLogger -> Text
$sel:level:GreengrassLogger' :: GreengrassLogger -> LoggerLevel
$sel:type':GreengrassLogger' :: GreengrassLogger -> LoggerType
$sel:space:GreengrassLogger' :: GreengrassLogger -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Space" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
space,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> LoggerType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoggerType
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Level" Text -> LoggerLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoggerLevel
level),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Component" Text -> LoggerComponent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoggerComponent
component)
]
)