{-# 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.Lightsail.Types.LogEvent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LogEvent = LogEvent'
{
LogEvent -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
LogEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text
}
deriving (LogEvent -> LogEvent -> Bool
(LogEvent -> LogEvent -> Bool)
-> (LogEvent -> LogEvent -> Bool) -> Eq LogEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogEvent -> LogEvent -> Bool
$c/= :: LogEvent -> LogEvent -> Bool
== :: LogEvent -> LogEvent -> Bool
$c== :: LogEvent -> LogEvent -> Bool
Prelude.Eq, ReadPrec [LogEvent]
ReadPrec LogEvent
Int -> ReadS LogEvent
ReadS [LogEvent]
(Int -> ReadS LogEvent)
-> ReadS [LogEvent]
-> ReadPrec LogEvent
-> ReadPrec [LogEvent]
-> Read LogEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogEvent]
$creadListPrec :: ReadPrec [LogEvent]
readPrec :: ReadPrec LogEvent
$creadPrec :: ReadPrec LogEvent
readList :: ReadS [LogEvent]
$creadList :: ReadS [LogEvent]
readsPrec :: Int -> ReadS LogEvent
$creadsPrec :: Int -> ReadS LogEvent
Prelude.Read, Int -> LogEvent -> ShowS
[LogEvent] -> ShowS
LogEvent -> String
(Int -> LogEvent -> ShowS)
-> (LogEvent -> String) -> ([LogEvent] -> ShowS) -> Show LogEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogEvent] -> ShowS
$cshowList :: [LogEvent] -> ShowS
show :: LogEvent -> String
$cshow :: LogEvent -> String
showsPrec :: Int -> LogEvent -> ShowS
$cshowsPrec :: Int -> LogEvent -> ShowS
Prelude.Show, (forall x. LogEvent -> Rep LogEvent x)
-> (forall x. Rep LogEvent x -> LogEvent) -> Generic LogEvent
forall x. Rep LogEvent x -> LogEvent
forall x. LogEvent -> Rep LogEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogEvent x -> LogEvent
$cfrom :: forall x. LogEvent -> Rep LogEvent x
Prelude.Generic)
newLogEvent ::
LogEvent
newLogEvent :: LogEvent
newLogEvent =
LogEvent' :: Maybe POSIX -> Maybe Text -> LogEvent
LogEvent'
{ $sel:createdAt:LogEvent' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:message:LogEvent' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
logEvent_createdAt :: Lens.Lens' LogEvent (Prelude.Maybe Prelude.UTCTime)
logEvent_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> LogEvent -> f LogEvent
logEvent_createdAt = (LogEvent -> Maybe POSIX)
-> (LogEvent -> Maybe POSIX -> LogEvent)
-> Lens LogEvent LogEvent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogEvent' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:LogEvent' :: LogEvent -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: LogEvent
s@LogEvent' {} Maybe POSIX
a -> LogEvent
s {$sel:createdAt:LogEvent' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: LogEvent) ((Maybe POSIX -> f (Maybe POSIX)) -> LogEvent -> f LogEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LogEvent
-> f LogEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
logEvent_message :: Lens.Lens' LogEvent (Prelude.Maybe Prelude.Text)
logEvent_message :: (Maybe Text -> f (Maybe Text)) -> LogEvent -> f LogEvent
logEvent_message = (LogEvent -> Maybe Text)
-> (LogEvent -> Maybe Text -> LogEvent)
-> Lens LogEvent LogEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogEvent' {Maybe Text
message :: Maybe Text
$sel:message:LogEvent' :: LogEvent -> Maybe Text
message} -> Maybe Text
message) (\s :: LogEvent
s@LogEvent' {} Maybe Text
a -> LogEvent
s {$sel:message:LogEvent' :: Maybe Text
message = Maybe Text
a} :: LogEvent)
instance Core.FromJSON LogEvent where
parseJSON :: Value -> Parser LogEvent
parseJSON =
String -> (Object -> Parser LogEvent) -> Value -> Parser LogEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LogEvent"
( \Object
x ->
Maybe POSIX -> Maybe Text -> LogEvent
LogEvent'
(Maybe POSIX -> Maybe Text -> LogEvent)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> LogEvent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
Parser (Maybe Text -> LogEvent)
-> Parser (Maybe Text) -> Parser LogEvent
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
"message")
)
instance Prelude.Hashable LogEvent
instance Prelude.NFData LogEvent