{-# 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.SignalExternalWorkflowExecutionDecisionAttributes
-- 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.SignalExternalWorkflowExecutionDecisionAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the details of the @SignalExternalWorkflowExecution@ decision.
--
-- __Access Control__
--
-- You can use IAM policies to control this decision\'s access to Amazon
-- SWF resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   You cannot use an IAM policy to constrain this action\'s parameters.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- /See:/ 'newSignalExternalWorkflowExecutionDecisionAttributes' smart constructor.
data SignalExternalWorkflowExecutionDecisionAttributes = SignalExternalWorkflowExecutionDecisionAttributes'
  { -- | The data attached to the event that can be used by the decider in
    -- subsequent decision tasks.
    SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
control :: Prelude.Maybe Prelude.Text,
    -- | The input data to be provided with the signal. The target workflow
    -- execution uses the signal name and input data to process the signal.
    SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
input :: Prelude.Maybe Prelude.Text,
    -- | The @runId@ of the workflow execution to be signaled.
    SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
runId :: Prelude.Maybe Prelude.Text,
    -- | The @workflowId@ of the workflow execution to be signaled.
    SignalExternalWorkflowExecutionDecisionAttributes -> Text
workflowId :: Prelude.Text,
    -- | The name of the signal.The target workflow execution uses the signal
    -- name and input to process the signal.
    SignalExternalWorkflowExecutionDecisionAttributes -> Text
signalName :: Prelude.Text
  }
  deriving (SignalExternalWorkflowExecutionDecisionAttributes
-> SignalExternalWorkflowExecutionDecisionAttributes -> Bool
(SignalExternalWorkflowExecutionDecisionAttributes
 -> SignalExternalWorkflowExecutionDecisionAttributes -> Bool)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> SignalExternalWorkflowExecutionDecisionAttributes -> Bool)
-> Eq SignalExternalWorkflowExecutionDecisionAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SignalExternalWorkflowExecutionDecisionAttributes
-> SignalExternalWorkflowExecutionDecisionAttributes -> Bool
$c/= :: SignalExternalWorkflowExecutionDecisionAttributes
-> SignalExternalWorkflowExecutionDecisionAttributes -> Bool
== :: SignalExternalWorkflowExecutionDecisionAttributes
-> SignalExternalWorkflowExecutionDecisionAttributes -> Bool
$c== :: SignalExternalWorkflowExecutionDecisionAttributes
-> SignalExternalWorkflowExecutionDecisionAttributes -> Bool
Prelude.Eq, ReadPrec [SignalExternalWorkflowExecutionDecisionAttributes]
ReadPrec SignalExternalWorkflowExecutionDecisionAttributes
Int -> ReadS SignalExternalWorkflowExecutionDecisionAttributes
ReadS [SignalExternalWorkflowExecutionDecisionAttributes]
(Int -> ReadS SignalExternalWorkflowExecutionDecisionAttributes)
-> ReadS [SignalExternalWorkflowExecutionDecisionAttributes]
-> ReadPrec SignalExternalWorkflowExecutionDecisionAttributes
-> ReadPrec [SignalExternalWorkflowExecutionDecisionAttributes]
-> Read SignalExternalWorkflowExecutionDecisionAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SignalExternalWorkflowExecutionDecisionAttributes]
$creadListPrec :: ReadPrec [SignalExternalWorkflowExecutionDecisionAttributes]
readPrec :: ReadPrec SignalExternalWorkflowExecutionDecisionAttributes
$creadPrec :: ReadPrec SignalExternalWorkflowExecutionDecisionAttributes
readList :: ReadS [SignalExternalWorkflowExecutionDecisionAttributes]
$creadList :: ReadS [SignalExternalWorkflowExecutionDecisionAttributes]
readsPrec :: Int -> ReadS SignalExternalWorkflowExecutionDecisionAttributes
$creadsPrec :: Int -> ReadS SignalExternalWorkflowExecutionDecisionAttributes
Prelude.Read, Int -> SignalExternalWorkflowExecutionDecisionAttributes -> ShowS
[SignalExternalWorkflowExecutionDecisionAttributes] -> ShowS
SignalExternalWorkflowExecutionDecisionAttributes -> String
(Int -> SignalExternalWorkflowExecutionDecisionAttributes -> ShowS)
-> (SignalExternalWorkflowExecutionDecisionAttributes -> String)
-> ([SignalExternalWorkflowExecutionDecisionAttributes] -> ShowS)
-> Show SignalExternalWorkflowExecutionDecisionAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SignalExternalWorkflowExecutionDecisionAttributes] -> ShowS
$cshowList :: [SignalExternalWorkflowExecutionDecisionAttributes] -> ShowS
show :: SignalExternalWorkflowExecutionDecisionAttributes -> String
$cshow :: SignalExternalWorkflowExecutionDecisionAttributes -> String
showsPrec :: Int -> SignalExternalWorkflowExecutionDecisionAttributes -> ShowS
$cshowsPrec :: Int -> SignalExternalWorkflowExecutionDecisionAttributes -> ShowS
Prelude.Show, (forall x.
 SignalExternalWorkflowExecutionDecisionAttributes
 -> Rep SignalExternalWorkflowExecutionDecisionAttributes x)
-> (forall x.
    Rep SignalExternalWorkflowExecutionDecisionAttributes x
    -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Generic SignalExternalWorkflowExecutionDecisionAttributes
forall x.
Rep SignalExternalWorkflowExecutionDecisionAttributes x
-> SignalExternalWorkflowExecutionDecisionAttributes
forall x.
SignalExternalWorkflowExecutionDecisionAttributes
-> Rep SignalExternalWorkflowExecutionDecisionAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SignalExternalWorkflowExecutionDecisionAttributes x
-> SignalExternalWorkflowExecutionDecisionAttributes
$cfrom :: forall x.
SignalExternalWorkflowExecutionDecisionAttributes
-> Rep SignalExternalWorkflowExecutionDecisionAttributes x
Prelude.Generic)

-- |
-- Create a value of 'SignalExternalWorkflowExecutionDecisionAttributes' 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:
--
-- 'control', 'signalExternalWorkflowExecutionDecisionAttributes_control' - The data attached to the event that can be used by the decider in
-- subsequent decision tasks.
--
-- 'input', 'signalExternalWorkflowExecutionDecisionAttributes_input' - The input data to be provided with the signal. The target workflow
-- execution uses the signal name and input data to process the signal.
--
-- 'runId', 'signalExternalWorkflowExecutionDecisionAttributes_runId' - The @runId@ of the workflow execution to be signaled.
--
-- 'workflowId', 'signalExternalWorkflowExecutionDecisionAttributes_workflowId' - The @workflowId@ of the workflow execution to be signaled.
--
-- 'signalName', 'signalExternalWorkflowExecutionDecisionAttributes_signalName' - The name of the signal.The target workflow execution uses the signal
-- name and input to process the signal.
newSignalExternalWorkflowExecutionDecisionAttributes ::
  -- | 'workflowId'
  Prelude.Text ->
  -- | 'signalName'
  Prelude.Text ->
  SignalExternalWorkflowExecutionDecisionAttributes
newSignalExternalWorkflowExecutionDecisionAttributes :: Text -> Text -> SignalExternalWorkflowExecutionDecisionAttributes
newSignalExternalWorkflowExecutionDecisionAttributes
  Text
pWorkflowId_
  Text
pSignalName_ =
    SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> SignalExternalWorkflowExecutionDecisionAttributes
SignalExternalWorkflowExecutionDecisionAttributes'
      { $sel:control:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
control =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:input:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
input = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:runId:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
runId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:workflowId:SignalExternalWorkflowExecutionDecisionAttributes' :: Text
workflowId =
          Text
pWorkflowId_,
        $sel:signalName:SignalExternalWorkflowExecutionDecisionAttributes' :: Text
signalName =
          Text
pSignalName_
      }

-- | The data attached to the event that can be used by the decider in
-- subsequent decision tasks.
signalExternalWorkflowExecutionDecisionAttributes_control :: Lens.Lens' SignalExternalWorkflowExecutionDecisionAttributes (Prelude.Maybe Prelude.Text)
signalExternalWorkflowExecutionDecisionAttributes_control :: (Maybe Text -> f (Maybe Text))
-> SignalExternalWorkflowExecutionDecisionAttributes
-> f SignalExternalWorkflowExecutionDecisionAttributes
signalExternalWorkflowExecutionDecisionAttributes_control = (SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> Maybe Text -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Lens
     SignalExternalWorkflowExecutionDecisionAttributes
     SignalExternalWorkflowExecutionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SignalExternalWorkflowExecutionDecisionAttributes' {Maybe Text
control :: Maybe Text
$sel:control:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
control} -> Maybe Text
control) (\s :: SignalExternalWorkflowExecutionDecisionAttributes
s@SignalExternalWorkflowExecutionDecisionAttributes' {} Maybe Text
a -> SignalExternalWorkflowExecutionDecisionAttributes
s {$sel:control:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
control = Maybe Text
a} :: SignalExternalWorkflowExecutionDecisionAttributes)

-- | The input data to be provided with the signal. The target workflow
-- execution uses the signal name and input data to process the signal.
signalExternalWorkflowExecutionDecisionAttributes_input :: Lens.Lens' SignalExternalWorkflowExecutionDecisionAttributes (Prelude.Maybe Prelude.Text)
signalExternalWorkflowExecutionDecisionAttributes_input :: (Maybe Text -> f (Maybe Text))
-> SignalExternalWorkflowExecutionDecisionAttributes
-> f SignalExternalWorkflowExecutionDecisionAttributes
signalExternalWorkflowExecutionDecisionAttributes_input = (SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> Maybe Text -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Lens
     SignalExternalWorkflowExecutionDecisionAttributes
     SignalExternalWorkflowExecutionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SignalExternalWorkflowExecutionDecisionAttributes' {Maybe Text
input :: Maybe Text
$sel:input:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
input} -> Maybe Text
input) (\s :: SignalExternalWorkflowExecutionDecisionAttributes
s@SignalExternalWorkflowExecutionDecisionAttributes' {} Maybe Text
a -> SignalExternalWorkflowExecutionDecisionAttributes
s {$sel:input:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
input = Maybe Text
a} :: SignalExternalWorkflowExecutionDecisionAttributes)

-- | The @runId@ of the workflow execution to be signaled.
signalExternalWorkflowExecutionDecisionAttributes_runId :: Lens.Lens' SignalExternalWorkflowExecutionDecisionAttributes (Prelude.Maybe Prelude.Text)
signalExternalWorkflowExecutionDecisionAttributes_runId :: (Maybe Text -> f (Maybe Text))
-> SignalExternalWorkflowExecutionDecisionAttributes
-> f SignalExternalWorkflowExecutionDecisionAttributes
signalExternalWorkflowExecutionDecisionAttributes_runId = (SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> Maybe Text -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Lens
     SignalExternalWorkflowExecutionDecisionAttributes
     SignalExternalWorkflowExecutionDecisionAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SignalExternalWorkflowExecutionDecisionAttributes' {Maybe Text
runId :: Maybe Text
$sel:runId:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
runId} -> Maybe Text
runId) (\s :: SignalExternalWorkflowExecutionDecisionAttributes
s@SignalExternalWorkflowExecutionDecisionAttributes' {} Maybe Text
a -> SignalExternalWorkflowExecutionDecisionAttributes
s {$sel:runId:SignalExternalWorkflowExecutionDecisionAttributes' :: Maybe Text
runId = Maybe Text
a} :: SignalExternalWorkflowExecutionDecisionAttributes)

-- | The @workflowId@ of the workflow execution to be signaled.
signalExternalWorkflowExecutionDecisionAttributes_workflowId :: Lens.Lens' SignalExternalWorkflowExecutionDecisionAttributes Prelude.Text
signalExternalWorkflowExecutionDecisionAttributes_workflowId :: (Text -> f Text)
-> SignalExternalWorkflowExecutionDecisionAttributes
-> f SignalExternalWorkflowExecutionDecisionAttributes
signalExternalWorkflowExecutionDecisionAttributes_workflowId = (SignalExternalWorkflowExecutionDecisionAttributes -> Text)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> Text -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Lens
     SignalExternalWorkflowExecutionDecisionAttributes
     SignalExternalWorkflowExecutionDecisionAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SignalExternalWorkflowExecutionDecisionAttributes' {Text
workflowId :: Text
$sel:workflowId:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Text
workflowId} -> Text
workflowId) (\s :: SignalExternalWorkflowExecutionDecisionAttributes
s@SignalExternalWorkflowExecutionDecisionAttributes' {} Text
a -> SignalExternalWorkflowExecutionDecisionAttributes
s {$sel:workflowId:SignalExternalWorkflowExecutionDecisionAttributes' :: Text
workflowId = Text
a} :: SignalExternalWorkflowExecutionDecisionAttributes)

-- | The name of the signal.The target workflow execution uses the signal
-- name and input to process the signal.
signalExternalWorkflowExecutionDecisionAttributes_signalName :: Lens.Lens' SignalExternalWorkflowExecutionDecisionAttributes Prelude.Text
signalExternalWorkflowExecutionDecisionAttributes_signalName :: (Text -> f Text)
-> SignalExternalWorkflowExecutionDecisionAttributes
-> f SignalExternalWorkflowExecutionDecisionAttributes
signalExternalWorkflowExecutionDecisionAttributes_signalName = (SignalExternalWorkflowExecutionDecisionAttributes -> Text)
-> (SignalExternalWorkflowExecutionDecisionAttributes
    -> Text -> SignalExternalWorkflowExecutionDecisionAttributes)
-> Lens
     SignalExternalWorkflowExecutionDecisionAttributes
     SignalExternalWorkflowExecutionDecisionAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SignalExternalWorkflowExecutionDecisionAttributes' {Text
signalName :: Text
$sel:signalName:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Text
signalName} -> Text
signalName) (\s :: SignalExternalWorkflowExecutionDecisionAttributes
s@SignalExternalWorkflowExecutionDecisionAttributes' {} Text
a -> SignalExternalWorkflowExecutionDecisionAttributes
s {$sel:signalName:SignalExternalWorkflowExecutionDecisionAttributes' :: Text
signalName = Text
a} :: SignalExternalWorkflowExecutionDecisionAttributes)

instance
  Prelude.Hashable
    SignalExternalWorkflowExecutionDecisionAttributes

instance
  Prelude.NFData
    SignalExternalWorkflowExecutionDecisionAttributes

instance
  Core.ToJSON
    SignalExternalWorkflowExecutionDecisionAttributes
  where
  toJSON :: SignalExternalWorkflowExecutionDecisionAttributes -> Value
toJSON
    SignalExternalWorkflowExecutionDecisionAttributes' {Maybe Text
Text
signalName :: Text
workflowId :: Text
runId :: Maybe Text
input :: Maybe Text
control :: Maybe Text
$sel:signalName:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Text
$sel:workflowId:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Text
$sel:runId:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
$sel:input:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
$sel:control:SignalExternalWorkflowExecutionDecisionAttributes' :: SignalExternalWorkflowExecutionDecisionAttributes -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"control" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
control,
              (Text
"input" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
input,
              (Text
"runId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
runId,
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"workflowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workflowId),
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"signalName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
signalName)
            ]
        )