{-# 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.IoTThingsGraph.Types.FlowExecutionMessage where
import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.Types.FlowExecutionEventType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FlowExecutionMessage = FlowExecutionMessage'
{
FlowExecutionMessage -> Maybe Text
payload :: Prelude.Maybe Prelude.Text,
FlowExecutionMessage -> Maybe FlowExecutionEventType
eventType :: Prelude.Maybe FlowExecutionEventType,
FlowExecutionMessage -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
FlowExecutionMessage -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text
}
deriving (FlowExecutionMessage -> FlowExecutionMessage -> Bool
(FlowExecutionMessage -> FlowExecutionMessage -> Bool)
-> (FlowExecutionMessage -> FlowExecutionMessage -> Bool)
-> Eq FlowExecutionMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowExecutionMessage -> FlowExecutionMessage -> Bool
$c/= :: FlowExecutionMessage -> FlowExecutionMessage -> Bool
== :: FlowExecutionMessage -> FlowExecutionMessage -> Bool
$c== :: FlowExecutionMessage -> FlowExecutionMessage -> Bool
Prelude.Eq, ReadPrec [FlowExecutionMessage]
ReadPrec FlowExecutionMessage
Int -> ReadS FlowExecutionMessage
ReadS [FlowExecutionMessage]
(Int -> ReadS FlowExecutionMessage)
-> ReadS [FlowExecutionMessage]
-> ReadPrec FlowExecutionMessage
-> ReadPrec [FlowExecutionMessage]
-> Read FlowExecutionMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowExecutionMessage]
$creadListPrec :: ReadPrec [FlowExecutionMessage]
readPrec :: ReadPrec FlowExecutionMessage
$creadPrec :: ReadPrec FlowExecutionMessage
readList :: ReadS [FlowExecutionMessage]
$creadList :: ReadS [FlowExecutionMessage]
readsPrec :: Int -> ReadS FlowExecutionMessage
$creadsPrec :: Int -> ReadS FlowExecutionMessage
Prelude.Read, Int -> FlowExecutionMessage -> ShowS
[FlowExecutionMessage] -> ShowS
FlowExecutionMessage -> String
(Int -> FlowExecutionMessage -> ShowS)
-> (FlowExecutionMessage -> String)
-> ([FlowExecutionMessage] -> ShowS)
-> Show FlowExecutionMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowExecutionMessage] -> ShowS
$cshowList :: [FlowExecutionMessage] -> ShowS
show :: FlowExecutionMessage -> String
$cshow :: FlowExecutionMessage -> String
showsPrec :: Int -> FlowExecutionMessage -> ShowS
$cshowsPrec :: Int -> FlowExecutionMessage -> ShowS
Prelude.Show, (forall x. FlowExecutionMessage -> Rep FlowExecutionMessage x)
-> (forall x. Rep FlowExecutionMessage x -> FlowExecutionMessage)
-> Generic FlowExecutionMessage
forall x. Rep FlowExecutionMessage x -> FlowExecutionMessage
forall x. FlowExecutionMessage -> Rep FlowExecutionMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlowExecutionMessage x -> FlowExecutionMessage
$cfrom :: forall x. FlowExecutionMessage -> Rep FlowExecutionMessage x
Prelude.Generic)
newFlowExecutionMessage ::
FlowExecutionMessage
newFlowExecutionMessage :: FlowExecutionMessage
newFlowExecutionMessage =
FlowExecutionMessage' :: Maybe Text
-> Maybe FlowExecutionEventType
-> Maybe POSIX
-> Maybe Text
-> FlowExecutionMessage
FlowExecutionMessage'
{ $sel:payload:FlowExecutionMessage' :: Maybe Text
payload = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventType:FlowExecutionMessage' :: Maybe FlowExecutionEventType
eventType = Maybe FlowExecutionEventType
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:FlowExecutionMessage' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:messageId:FlowExecutionMessage' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
flowExecutionMessage_payload :: Lens.Lens' FlowExecutionMessage (Prelude.Maybe Prelude.Text)
flowExecutionMessage_payload :: (Maybe Text -> f (Maybe Text))
-> FlowExecutionMessage -> f FlowExecutionMessage
flowExecutionMessage_payload = (FlowExecutionMessage -> Maybe Text)
-> (FlowExecutionMessage -> Maybe Text -> FlowExecutionMessage)
-> Lens
FlowExecutionMessage FlowExecutionMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionMessage' {Maybe Text
payload :: Maybe Text
$sel:payload:FlowExecutionMessage' :: FlowExecutionMessage -> Maybe Text
payload} -> Maybe Text
payload) (\s :: FlowExecutionMessage
s@FlowExecutionMessage' {} Maybe Text
a -> FlowExecutionMessage
s {$sel:payload:FlowExecutionMessage' :: Maybe Text
payload = Maybe Text
a} :: FlowExecutionMessage)
flowExecutionMessage_eventType :: Lens.Lens' FlowExecutionMessage (Prelude.Maybe FlowExecutionEventType)
flowExecutionMessage_eventType :: (Maybe FlowExecutionEventType -> f (Maybe FlowExecutionEventType))
-> FlowExecutionMessage -> f FlowExecutionMessage
flowExecutionMessage_eventType = (FlowExecutionMessage -> Maybe FlowExecutionEventType)
-> (FlowExecutionMessage
-> Maybe FlowExecutionEventType -> FlowExecutionMessage)
-> Lens
FlowExecutionMessage
FlowExecutionMessage
(Maybe FlowExecutionEventType)
(Maybe FlowExecutionEventType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionMessage' {Maybe FlowExecutionEventType
eventType :: Maybe FlowExecutionEventType
$sel:eventType:FlowExecutionMessage' :: FlowExecutionMessage -> Maybe FlowExecutionEventType
eventType} -> Maybe FlowExecutionEventType
eventType) (\s :: FlowExecutionMessage
s@FlowExecutionMessage' {} Maybe FlowExecutionEventType
a -> FlowExecutionMessage
s {$sel:eventType:FlowExecutionMessage' :: Maybe FlowExecutionEventType
eventType = Maybe FlowExecutionEventType
a} :: FlowExecutionMessage)
flowExecutionMessage_timestamp :: Lens.Lens' FlowExecutionMessage (Prelude.Maybe Prelude.UTCTime)
flowExecutionMessage_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionMessage -> f FlowExecutionMessage
flowExecutionMessage_timestamp = (FlowExecutionMessage -> Maybe POSIX)
-> (FlowExecutionMessage -> Maybe POSIX -> FlowExecutionMessage)
-> Lens
FlowExecutionMessage
FlowExecutionMessage
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionMessage' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:FlowExecutionMessage' :: FlowExecutionMessage -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: FlowExecutionMessage
s@FlowExecutionMessage' {} Maybe POSIX
a -> FlowExecutionMessage
s {$sel:timestamp:FlowExecutionMessage' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: FlowExecutionMessage) ((Maybe POSIX -> f (Maybe POSIX))
-> FlowExecutionMessage -> f FlowExecutionMessage)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FlowExecutionMessage
-> f FlowExecutionMessage
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
flowExecutionMessage_messageId :: Lens.Lens' FlowExecutionMessage (Prelude.Maybe Prelude.Text)
flowExecutionMessage_messageId :: (Maybe Text -> f (Maybe Text))
-> FlowExecutionMessage -> f FlowExecutionMessage
flowExecutionMessage_messageId = (FlowExecutionMessage -> Maybe Text)
-> (FlowExecutionMessage -> Maybe Text -> FlowExecutionMessage)
-> Lens
FlowExecutionMessage FlowExecutionMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowExecutionMessage' {Maybe Text
messageId :: Maybe Text
$sel:messageId:FlowExecutionMessage' :: FlowExecutionMessage -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: FlowExecutionMessage
s@FlowExecutionMessage' {} Maybe Text
a -> FlowExecutionMessage
s {$sel:messageId:FlowExecutionMessage' :: Maybe Text
messageId = Maybe Text
a} :: FlowExecutionMessage)
instance Core.FromJSON FlowExecutionMessage where
parseJSON :: Value -> Parser FlowExecutionMessage
parseJSON =
String
-> (Object -> Parser FlowExecutionMessage)
-> Value
-> Parser FlowExecutionMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FlowExecutionMessage"
( \Object
x ->
Maybe Text
-> Maybe FlowExecutionEventType
-> Maybe POSIX
-> Maybe Text
-> FlowExecutionMessage
FlowExecutionMessage'
(Maybe Text
-> Maybe FlowExecutionEventType
-> Maybe POSIX
-> Maybe Text
-> FlowExecutionMessage)
-> Parser (Maybe Text)
-> Parser
(Maybe FlowExecutionEventType
-> Maybe POSIX -> Maybe Text -> FlowExecutionMessage)
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
"payload")
Parser
(Maybe FlowExecutionEventType
-> Maybe POSIX -> Maybe Text -> FlowExecutionMessage)
-> Parser (Maybe FlowExecutionEventType)
-> Parser (Maybe POSIX -> Maybe Text -> FlowExecutionMessage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FlowExecutionEventType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventType")
Parser (Maybe POSIX -> Maybe Text -> FlowExecutionMessage)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> FlowExecutionMessage)
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
"timestamp")
Parser (Maybe Text -> FlowExecutionMessage)
-> Parser (Maybe Text) -> Parser FlowExecutionMessage
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
"messageId")
)
instance Prelude.Hashable FlowExecutionMessage
instance Prelude.NFData FlowExecutionMessage