{-# 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.OpsWorksCM.Types.ServerEvent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ServerEvent = ServerEvent'
{
ServerEvent -> Maybe Text
logUrl :: Prelude.Maybe Prelude.Text,
ServerEvent -> Maybe Text
serverName :: Prelude.Maybe Prelude.Text,
ServerEvent -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
ServerEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text
}
deriving (ServerEvent -> ServerEvent -> Bool
(ServerEvent -> ServerEvent -> Bool)
-> (ServerEvent -> ServerEvent -> Bool) -> Eq ServerEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerEvent -> ServerEvent -> Bool
$c/= :: ServerEvent -> ServerEvent -> Bool
== :: ServerEvent -> ServerEvent -> Bool
$c== :: ServerEvent -> ServerEvent -> Bool
Prelude.Eq, ReadPrec [ServerEvent]
ReadPrec ServerEvent
Int -> ReadS ServerEvent
ReadS [ServerEvent]
(Int -> ReadS ServerEvent)
-> ReadS [ServerEvent]
-> ReadPrec ServerEvent
-> ReadPrec [ServerEvent]
-> Read ServerEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerEvent]
$creadListPrec :: ReadPrec [ServerEvent]
readPrec :: ReadPrec ServerEvent
$creadPrec :: ReadPrec ServerEvent
readList :: ReadS [ServerEvent]
$creadList :: ReadS [ServerEvent]
readsPrec :: Int -> ReadS ServerEvent
$creadsPrec :: Int -> ReadS ServerEvent
Prelude.Read, Int -> ServerEvent -> ShowS
[ServerEvent] -> ShowS
ServerEvent -> String
(Int -> ServerEvent -> ShowS)
-> (ServerEvent -> String)
-> ([ServerEvent] -> ShowS)
-> Show ServerEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerEvent] -> ShowS
$cshowList :: [ServerEvent] -> ShowS
show :: ServerEvent -> String
$cshow :: ServerEvent -> String
showsPrec :: Int -> ServerEvent -> ShowS
$cshowsPrec :: Int -> ServerEvent -> ShowS
Prelude.Show, (forall x. ServerEvent -> Rep ServerEvent x)
-> (forall x. Rep ServerEvent x -> ServerEvent)
-> Generic ServerEvent
forall x. Rep ServerEvent x -> ServerEvent
forall x. ServerEvent -> Rep ServerEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServerEvent x -> ServerEvent
$cfrom :: forall x. ServerEvent -> Rep ServerEvent x
Prelude.Generic)
newServerEvent ::
ServerEvent
newServerEvent :: ServerEvent
newServerEvent =
ServerEvent' :: Maybe Text
-> Maybe Text -> Maybe POSIX -> Maybe Text -> ServerEvent
ServerEvent'
{ $sel:logUrl:ServerEvent' :: Maybe Text
logUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:serverName:ServerEvent' :: Maybe Text
serverName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createdAt:ServerEvent' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:message:ServerEvent' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
serverEvent_logUrl :: Lens.Lens' ServerEvent (Prelude.Maybe Prelude.Text)
serverEvent_logUrl :: (Maybe Text -> f (Maybe Text)) -> ServerEvent -> f ServerEvent
serverEvent_logUrl = (ServerEvent -> Maybe Text)
-> (ServerEvent -> Maybe Text -> ServerEvent)
-> Lens ServerEvent ServerEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerEvent' {Maybe Text
logUrl :: Maybe Text
$sel:logUrl:ServerEvent' :: ServerEvent -> Maybe Text
logUrl} -> Maybe Text
logUrl) (\s :: ServerEvent
s@ServerEvent' {} Maybe Text
a -> ServerEvent
s {$sel:logUrl:ServerEvent' :: Maybe Text
logUrl = Maybe Text
a} :: ServerEvent)
serverEvent_serverName :: Lens.Lens' ServerEvent (Prelude.Maybe Prelude.Text)
serverEvent_serverName :: (Maybe Text -> f (Maybe Text)) -> ServerEvent -> f ServerEvent
serverEvent_serverName = (ServerEvent -> Maybe Text)
-> (ServerEvent -> Maybe Text -> ServerEvent)
-> Lens ServerEvent ServerEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerEvent' {Maybe Text
serverName :: Maybe Text
$sel:serverName:ServerEvent' :: ServerEvent -> Maybe Text
serverName} -> Maybe Text
serverName) (\s :: ServerEvent
s@ServerEvent' {} Maybe Text
a -> ServerEvent
s {$sel:serverName:ServerEvent' :: Maybe Text
serverName = Maybe Text
a} :: ServerEvent)
serverEvent_createdAt :: Lens.Lens' ServerEvent (Prelude.Maybe Prelude.UTCTime)
serverEvent_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerEvent -> f ServerEvent
serverEvent_createdAt = (ServerEvent -> Maybe POSIX)
-> (ServerEvent -> Maybe POSIX -> ServerEvent)
-> Lens ServerEvent ServerEvent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerEvent' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ServerEvent' :: ServerEvent -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ServerEvent
s@ServerEvent' {} Maybe POSIX
a -> ServerEvent
s {$sel:createdAt:ServerEvent' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ServerEvent) ((Maybe POSIX -> f (Maybe POSIX)) -> ServerEvent -> f ServerEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerEvent
-> f ServerEvent
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
serverEvent_message :: Lens.Lens' ServerEvent (Prelude.Maybe Prelude.Text)
serverEvent_message :: (Maybe Text -> f (Maybe Text)) -> ServerEvent -> f ServerEvent
serverEvent_message = (ServerEvent -> Maybe Text)
-> (ServerEvent -> Maybe Text -> ServerEvent)
-> Lens ServerEvent ServerEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerEvent' {Maybe Text
message :: Maybe Text
$sel:message:ServerEvent' :: ServerEvent -> Maybe Text
message} -> Maybe Text
message) (\s :: ServerEvent
s@ServerEvent' {} Maybe Text
a -> ServerEvent
s {$sel:message:ServerEvent' :: Maybe Text
message = Maybe Text
a} :: ServerEvent)
instance Core.FromJSON ServerEvent where
parseJSON :: Value -> Parser ServerEvent
parseJSON =
String
-> (Object -> Parser ServerEvent) -> Value -> Parser ServerEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ServerEvent"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe POSIX -> Maybe Text -> ServerEvent
ServerEvent'
(Maybe Text
-> Maybe Text -> Maybe POSIX -> Maybe Text -> ServerEvent)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> ServerEvent)
forall (f :: * -> *) a b. Functor 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
"LogUrl")
Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> ServerEvent)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> ServerEvent)
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
"ServerName")
Parser (Maybe POSIX -> Maybe Text -> ServerEvent)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> ServerEvent)
forall (f :: * -> *) a b. Applicative f => 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 -> ServerEvent)
-> Parser (Maybe Text) -> Parser ServerEvent
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 ServerEvent
instance Prelude.NFData ServerEvent