{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SWF.Types.WorkflowExecutionSignaledEventAttributes
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SWF.Types.WorkflowExecutionSignaledEventAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.WorkflowExecution

-- | Provides the details of the @WorkflowExecutionSignaled@ event.
--
-- /See:/ 'newWorkflowExecutionSignaledEventAttributes' smart constructor.
data WorkflowExecutionSignaledEventAttributes = WorkflowExecutionSignaledEventAttributes'
  { -- | The workflow execution that sent the signal. This is set only of the
    -- signal was sent by another workflow execution.
    WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
externalWorkflowExecution :: Prelude.Maybe WorkflowExecution,
    -- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
    -- corresponding to the @SignalExternalWorkflow@ decision to signal this
    -- workflow execution.The source event with this ID can be found in the
    -- history of the source workflow execution. This information can be useful
    -- for diagnosing problems by tracing back the chain of events leading up
    -- to this event. This field is set only if the signal was initiated by
    -- another workflow execution.
    WorkflowExecutionSignaledEventAttributes -> Maybe Integer
externalInitiatedEventId :: Prelude.Maybe Prelude.Integer,
    -- | The inputs provided with the signal. The decider can use the signal name
    -- and inputs to determine how to process the signal.
    WorkflowExecutionSignaledEventAttributes -> Maybe Text
input :: Prelude.Maybe Prelude.Text,
    -- | The name of the signal received. The decider can use the signal name and
    -- inputs to determine how to the process the signal.
    WorkflowExecutionSignaledEventAttributes -> Text
signalName :: Prelude.Text
  }
  deriving (WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
(WorkflowExecutionSignaledEventAttributes
 -> WorkflowExecutionSignaledEventAttributes -> Bool)
-> (WorkflowExecutionSignaledEventAttributes
    -> WorkflowExecutionSignaledEventAttributes -> Bool)
-> Eq WorkflowExecutionSignaledEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
$c/= :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
== :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
$c== :: WorkflowExecutionSignaledEventAttributes
-> WorkflowExecutionSignaledEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionSignaledEventAttributes]
ReadPrec WorkflowExecutionSignaledEventAttributes
Int -> ReadS WorkflowExecutionSignaledEventAttributes
ReadS [WorkflowExecutionSignaledEventAttributes]
(Int -> ReadS WorkflowExecutionSignaledEventAttributes)
-> ReadS [WorkflowExecutionSignaledEventAttributes]
-> ReadPrec WorkflowExecutionSignaledEventAttributes
-> ReadPrec [WorkflowExecutionSignaledEventAttributes]
-> Read WorkflowExecutionSignaledEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionSignaledEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionSignaledEventAttributes]
readPrec :: ReadPrec WorkflowExecutionSignaledEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionSignaledEventAttributes
readList :: ReadS [WorkflowExecutionSignaledEventAttributes]
$creadList :: ReadS [WorkflowExecutionSignaledEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionSignaledEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionSignaledEventAttributes
Prelude.Read, Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
[WorkflowExecutionSignaledEventAttributes] -> ShowS
WorkflowExecutionSignaledEventAttributes -> String
(Int -> WorkflowExecutionSignaledEventAttributes -> ShowS)
-> (WorkflowExecutionSignaledEventAttributes -> String)
-> ([WorkflowExecutionSignaledEventAttributes] -> ShowS)
-> Show WorkflowExecutionSignaledEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionSignaledEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionSignaledEventAttributes] -> ShowS
show :: WorkflowExecutionSignaledEventAttributes -> String
$cshow :: WorkflowExecutionSignaledEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionSignaledEventAttributes -> ShowS
Prelude.Show, (forall x.
 WorkflowExecutionSignaledEventAttributes
 -> Rep WorkflowExecutionSignaledEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionSignaledEventAttributes x
    -> WorkflowExecutionSignaledEventAttributes)
-> Generic WorkflowExecutionSignaledEventAttributes
forall x.
Rep WorkflowExecutionSignaledEventAttributes x
-> WorkflowExecutionSignaledEventAttributes
forall x.
WorkflowExecutionSignaledEventAttributes
-> Rep WorkflowExecutionSignaledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionSignaledEventAttributes x
-> WorkflowExecutionSignaledEventAttributes
$cfrom :: forall x.
WorkflowExecutionSignaledEventAttributes
-> Rep WorkflowExecutionSignaledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionSignaledEventAttributes' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'externalWorkflowExecution', 'workflowExecutionSignaledEventAttributes_externalWorkflowExecution' - The workflow execution that sent the signal. This is set only of the
-- signal was sent by another workflow execution.
--
-- 'externalInitiatedEventId', 'workflowExecutionSignaledEventAttributes_externalInitiatedEventId' - The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflow@ decision to signal this
-- workflow execution.The source event with this ID can be found in the
-- history of the source workflow execution. This information can be useful
-- for diagnosing problems by tracing back the chain of events leading up
-- to this event. This field is set only if the signal was initiated by
-- another workflow execution.
--
-- 'input', 'workflowExecutionSignaledEventAttributes_input' - The inputs provided with the signal. The decider can use the signal name
-- and inputs to determine how to process the signal.
--
-- 'signalName', 'workflowExecutionSignaledEventAttributes_signalName' - The name of the signal received. The decider can use the signal name and
-- inputs to determine how to the process the signal.
newWorkflowExecutionSignaledEventAttributes ::
  -- | 'signalName'
  Prelude.Text ->
  WorkflowExecutionSignaledEventAttributes
newWorkflowExecutionSignaledEventAttributes :: Text -> WorkflowExecutionSignaledEventAttributes
newWorkflowExecutionSignaledEventAttributes
  Text
pSignalName_ =
    WorkflowExecutionSignaledEventAttributes' :: Maybe WorkflowExecution
-> Maybe Integer
-> Maybe Text
-> Text
-> WorkflowExecutionSignaledEventAttributes
WorkflowExecutionSignaledEventAttributes'
      { $sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution =
          Maybe WorkflowExecution
forall a. Maybe a
Prelude.Nothing,
        $sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: Maybe Integer
externalInitiatedEventId =
          Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:input:WorkflowExecutionSignaledEventAttributes' :: Maybe Text
input = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:signalName:WorkflowExecutionSignaledEventAttributes' :: Text
signalName = Text
pSignalName_
      }

-- | The workflow execution that sent the signal. This is set only of the
-- signal was sent by another workflow execution.
workflowExecutionSignaledEventAttributes_externalWorkflowExecution :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe WorkflowExecution)
workflowExecutionSignaledEventAttributes_externalWorkflowExecution :: (Maybe WorkflowExecution -> f (Maybe WorkflowExecution))
-> WorkflowExecutionSignaledEventAttributes
-> f WorkflowExecutionSignaledEventAttributes
workflowExecutionSignaledEventAttributes_externalWorkflowExecution = (WorkflowExecutionSignaledEventAttributes
 -> Maybe WorkflowExecution)
-> (WorkflowExecutionSignaledEventAttributes
    -> Maybe WorkflowExecution
    -> WorkflowExecutionSignaledEventAttributes)
-> Lens
     WorkflowExecutionSignaledEventAttributes
     WorkflowExecutionSignaledEventAttributes
     (Maybe WorkflowExecution)
     (Maybe WorkflowExecution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe WorkflowExecution
externalWorkflowExecution :: Maybe WorkflowExecution
$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe WorkflowExecution
externalWorkflowExecution} -> Maybe WorkflowExecution
externalWorkflowExecution) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe WorkflowExecution
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:externalWorkflowExecution:WorkflowExecutionSignaledEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution = Maybe WorkflowExecution
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event
-- corresponding to the @SignalExternalWorkflow@ decision to signal this
-- workflow execution.The source event with this ID can be found in the
-- history of the source workflow execution. This information can be useful
-- for diagnosing problems by tracing back the chain of events leading up
-- to this event. This field is set only if the signal was initiated by
-- another workflow execution.
workflowExecutionSignaledEventAttributes_externalInitiatedEventId :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe Prelude.Integer)
workflowExecutionSignaledEventAttributes_externalInitiatedEventId :: (Maybe Integer -> f (Maybe Integer))
-> WorkflowExecutionSignaledEventAttributes
-> f WorkflowExecutionSignaledEventAttributes
workflowExecutionSignaledEventAttributes_externalInitiatedEventId = (WorkflowExecutionSignaledEventAttributes -> Maybe Integer)
-> (WorkflowExecutionSignaledEventAttributes
    -> Maybe Integer -> WorkflowExecutionSignaledEventAttributes)
-> Lens
     WorkflowExecutionSignaledEventAttributes
     WorkflowExecutionSignaledEventAttributes
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe Integer
externalInitiatedEventId :: Maybe Integer
$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Integer
externalInitiatedEventId} -> Maybe Integer
externalInitiatedEventId) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe Integer
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:externalInitiatedEventId:WorkflowExecutionSignaledEventAttributes' :: Maybe Integer
externalInitiatedEventId = Maybe Integer
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The inputs provided with the signal. The decider can use the signal name
-- and inputs to determine how to process the signal.
workflowExecutionSignaledEventAttributes_input :: Lens.Lens' WorkflowExecutionSignaledEventAttributes (Prelude.Maybe Prelude.Text)
workflowExecutionSignaledEventAttributes_input :: (Maybe Text -> f (Maybe Text))
-> WorkflowExecutionSignaledEventAttributes
-> f WorkflowExecutionSignaledEventAttributes
workflowExecutionSignaledEventAttributes_input = (WorkflowExecutionSignaledEventAttributes -> Maybe Text)
-> (WorkflowExecutionSignaledEventAttributes
    -> Maybe Text -> WorkflowExecutionSignaledEventAttributes)
-> Lens
     WorkflowExecutionSignaledEventAttributes
     WorkflowExecutionSignaledEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Maybe Text
input :: Maybe Text
$sel:input:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Maybe Text
input} -> Maybe Text
input) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Maybe Text
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:input:WorkflowExecutionSignaledEventAttributes' :: Maybe Text
input = Maybe Text
a} :: WorkflowExecutionSignaledEventAttributes)

-- | The name of the signal received. The decider can use the signal name and
-- inputs to determine how to the process the signal.
workflowExecutionSignaledEventAttributes_signalName :: Lens.Lens' WorkflowExecutionSignaledEventAttributes Prelude.Text
workflowExecutionSignaledEventAttributes_signalName :: (Text -> f Text)
-> WorkflowExecutionSignaledEventAttributes
-> f WorkflowExecutionSignaledEventAttributes
workflowExecutionSignaledEventAttributes_signalName = (WorkflowExecutionSignaledEventAttributes -> Text)
-> (WorkflowExecutionSignaledEventAttributes
    -> Text -> WorkflowExecutionSignaledEventAttributes)
-> Lens
     WorkflowExecutionSignaledEventAttributes
     WorkflowExecutionSignaledEventAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionSignaledEventAttributes' {Text
signalName :: Text
$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: WorkflowExecutionSignaledEventAttributes -> Text
signalName} -> Text
signalName) (\s :: WorkflowExecutionSignaledEventAttributes
s@WorkflowExecutionSignaledEventAttributes' {} Text
a -> WorkflowExecutionSignaledEventAttributes
s {$sel:signalName:WorkflowExecutionSignaledEventAttributes' :: Text
signalName = Text
a} :: WorkflowExecutionSignaledEventAttributes)

instance
  Core.FromJSON
    WorkflowExecutionSignaledEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionSignaledEventAttributes
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionSignaledEventAttributes)
-> Value
-> Parser WorkflowExecutionSignaledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionSignaledEventAttributes"
      ( \Object
x ->
          Maybe WorkflowExecution
-> Maybe Integer
-> Maybe Text
-> Text
-> WorkflowExecutionSignaledEventAttributes
WorkflowExecutionSignaledEventAttributes'
            (Maybe WorkflowExecution
 -> Maybe Integer
 -> Maybe Text
 -> Text
 -> WorkflowExecutionSignaledEventAttributes)
-> Parser (Maybe WorkflowExecution)
-> Parser
     (Maybe Integer
      -> Maybe Text -> Text -> WorkflowExecutionSignaledEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe WorkflowExecution)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"externalWorkflowExecution")
            Parser
  (Maybe Integer
   -> Maybe Text -> Text -> WorkflowExecutionSignaledEventAttributes)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text -> Text -> WorkflowExecutionSignaledEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"externalInitiatedEventId")
            Parser
  (Maybe Text -> Text -> WorkflowExecutionSignaledEventAttributes)
-> Parser (Maybe Text)
-> Parser (Text -> WorkflowExecutionSignaledEventAttributes)
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
"input")
            Parser (Text -> WorkflowExecutionSignaledEventAttributes)
-> Parser Text -> Parser WorkflowExecutionSignaledEventAttributes
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
"signalName")
      )

instance
  Prelude.Hashable
    WorkflowExecutionSignaledEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionSignaledEventAttributes