{-# 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.ExternalWorkflowExecutionCancelRequestedEventAttributes
-- 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.ExternalWorkflowExecutionCancelRequestedEventAttributes 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 @ExternalWorkflowExecutionCancelRequested@
-- event.
--
-- /See:/ 'newExternalWorkflowExecutionCancelRequestedEventAttributes' smart constructor.
data ExternalWorkflowExecutionCancelRequestedEventAttributes = ExternalWorkflowExecutionCancelRequestedEventAttributes'
  { -- | The external workflow execution to which the cancellation request was
    -- delivered.
    ExternalWorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
    -- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
    -- to cancel this external workflow execution. This information can be
    -- useful for diagnosing problems by tracing back the chain of events
    -- leading up to this event.
    ExternalWorkflowExecutionCancelRequestedEventAttributes -> Integer
initiatedEventId :: Prelude.Integer
  }
  deriving (ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool
(ExternalWorkflowExecutionCancelRequestedEventAttributes
 -> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool)
-> (ExternalWorkflowExecutionCancelRequestedEventAttributes
    -> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool)
-> Eq ExternalWorkflowExecutionCancelRequestedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool
$c/= :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool
== :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool
$c== :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ExternalWorkflowExecutionCancelRequestedEventAttributes]
ReadPrec ExternalWorkflowExecutionCancelRequestedEventAttributes
Int
-> ReadS ExternalWorkflowExecutionCancelRequestedEventAttributes
ReadS [ExternalWorkflowExecutionCancelRequestedEventAttributes]
(Int
 -> ReadS ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> ReadS [ExternalWorkflowExecutionCancelRequestedEventAttributes]
-> ReadPrec ExternalWorkflowExecutionCancelRequestedEventAttributes
-> ReadPrec
     [ExternalWorkflowExecutionCancelRequestedEventAttributes]
-> Read ExternalWorkflowExecutionCancelRequestedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExternalWorkflowExecutionCancelRequestedEventAttributes]
$creadListPrec :: ReadPrec [ExternalWorkflowExecutionCancelRequestedEventAttributes]
readPrec :: ReadPrec ExternalWorkflowExecutionCancelRequestedEventAttributes
$creadPrec :: ReadPrec ExternalWorkflowExecutionCancelRequestedEventAttributes
readList :: ReadS [ExternalWorkflowExecutionCancelRequestedEventAttributes]
$creadList :: ReadS [ExternalWorkflowExecutionCancelRequestedEventAttributes]
readsPrec :: Int
-> ReadS ExternalWorkflowExecutionCancelRequestedEventAttributes
$creadsPrec :: Int
-> ReadS ExternalWorkflowExecutionCancelRequestedEventAttributes
Prelude.Read, Int
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> ShowS
[ExternalWorkflowExecutionCancelRequestedEventAttributes] -> ShowS
ExternalWorkflowExecutionCancelRequestedEventAttributes -> String
(Int
 -> ExternalWorkflowExecutionCancelRequestedEventAttributes
 -> ShowS)
-> (ExternalWorkflowExecutionCancelRequestedEventAttributes
    -> String)
-> ([ExternalWorkflowExecutionCancelRequestedEventAttributes]
    -> ShowS)
-> Show ExternalWorkflowExecutionCancelRequestedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalWorkflowExecutionCancelRequestedEventAttributes] -> ShowS
$cshowList :: [ExternalWorkflowExecutionCancelRequestedEventAttributes] -> ShowS
show :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> String
$cshow :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> String
showsPrec :: Int
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> ShowS
$cshowsPrec :: Int
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ExternalWorkflowExecutionCancelRequestedEventAttributes
 -> Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x)
-> (forall x.
    Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x
    -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Generic ExternalWorkflowExecutionCancelRequestedEventAttributes
forall x.
Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
forall x.
ExternalWorkflowExecutionCancelRequestedEventAttributes
-> Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
$cfrom :: forall x.
ExternalWorkflowExecutionCancelRequestedEventAttributes
-> Rep ExternalWorkflowExecutionCancelRequestedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ExternalWorkflowExecutionCancelRequestedEventAttributes' 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:
--
-- 'workflowExecution', 'externalWorkflowExecutionCancelRequestedEventAttributes_workflowExecution' - The external workflow execution to which the cancellation request was
-- delivered.
--
-- 'initiatedEventId', 'externalWorkflowExecutionCancelRequestedEventAttributes_initiatedEventId' - The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
-- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
-- to cancel this external workflow execution. This information can be
-- useful for diagnosing problems by tracing back the chain of events
-- leading up to this event.
newExternalWorkflowExecutionCancelRequestedEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  ExternalWorkflowExecutionCancelRequestedEventAttributes
newExternalWorkflowExecutionCancelRequestedEventAttributes :: WorkflowExecution
-> Integer
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
newExternalWorkflowExecutionCancelRequestedEventAttributes
  WorkflowExecution
pWorkflowExecution_
  Integer
pInitiatedEventId_ =
    ExternalWorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecution
-> Integer
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
ExternalWorkflowExecutionCancelRequestedEventAttributes'
      { $sel:workflowExecution:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:initiatedEventId:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_
      }

-- | The external workflow execution to which the cancellation request was
-- delivered.
externalWorkflowExecutionCancelRequestedEventAttributes_workflowExecution :: Lens.Lens' ExternalWorkflowExecutionCancelRequestedEventAttributes WorkflowExecution
externalWorkflowExecutionCancelRequestedEventAttributes_workflowExecution :: (WorkflowExecution -> f WorkflowExecution)
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
-> f ExternalWorkflowExecutionCancelRequestedEventAttributes
externalWorkflowExecutionCancelRequestedEventAttributes_workflowExecution = (ExternalWorkflowExecutionCancelRequestedEventAttributes
 -> WorkflowExecution)
-> (ExternalWorkflowExecutionCancelRequestedEventAttributes
    -> WorkflowExecution
    -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Lens
     ExternalWorkflowExecutionCancelRequestedEventAttributes
     ExternalWorkflowExecutionCancelRequestedEventAttributes
     WorkflowExecution
     WorkflowExecution
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalWorkflowExecutionCancelRequestedEventAttributes' {WorkflowExecution
workflowExecution :: WorkflowExecution
$sel:workflowExecution:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecution
workflowExecution} -> WorkflowExecution
workflowExecution) (\s :: ExternalWorkflowExecutionCancelRequestedEventAttributes
s@ExternalWorkflowExecutionCancelRequestedEventAttributes' {} WorkflowExecution
a -> ExternalWorkflowExecutionCancelRequestedEventAttributes
s {$sel:workflowExecution:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecution
workflowExecution = WorkflowExecution
a} :: ExternalWorkflowExecutionCancelRequestedEventAttributes)

-- | The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
-- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
-- to cancel this external workflow execution. This information can be
-- useful for diagnosing problems by tracing back the chain of events
-- leading up to this event.
externalWorkflowExecutionCancelRequestedEventAttributes_initiatedEventId :: Lens.Lens' ExternalWorkflowExecutionCancelRequestedEventAttributes Prelude.Integer
externalWorkflowExecutionCancelRequestedEventAttributes_initiatedEventId :: (Integer -> f Integer)
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
-> f ExternalWorkflowExecutionCancelRequestedEventAttributes
externalWorkflowExecutionCancelRequestedEventAttributes_initiatedEventId = (ExternalWorkflowExecutionCancelRequestedEventAttributes
 -> Integer)
-> (ExternalWorkflowExecutionCancelRequestedEventAttributes
    -> Integer
    -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Lens
     ExternalWorkflowExecutionCancelRequestedEventAttributes
     ExternalWorkflowExecutionCancelRequestedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalWorkflowExecutionCancelRequestedEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ExternalWorkflowExecutionCancelRequestedEventAttributes
s@ExternalWorkflowExecutionCancelRequestedEventAttributes' {} Integer
a -> ExternalWorkflowExecutionCancelRequestedEventAttributes
s {$sel:initiatedEventId:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ExternalWorkflowExecutionCancelRequestedEventAttributes)

instance
  Core.FromJSON
    ExternalWorkflowExecutionCancelRequestedEventAttributes
  where
  parseJSON :: Value
-> Parser ExternalWorkflowExecutionCancelRequestedEventAttributes
parseJSON =
    String
-> (Object
    -> Parser ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Value
-> Parser ExternalWorkflowExecutionCancelRequestedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExternalWorkflowExecutionCancelRequestedEventAttributes"
      ( \Object
x ->
          WorkflowExecution
-> Integer
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
ExternalWorkflowExecutionCancelRequestedEventAttributes'
            (WorkflowExecution
 -> Integer
 -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Parser WorkflowExecution
-> Parser
     (Integer
      -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser WorkflowExecution
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowExecution")
              Parser
  (Integer
   -> ExternalWorkflowExecutionCancelRequestedEventAttributes)
-> Parser Integer
-> Parser ExternalWorkflowExecutionCancelRequestedEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"initiatedEventId")
      )

instance
  Prelude.Hashable
    ExternalWorkflowExecutionCancelRequestedEventAttributes

instance
  Prelude.NFData
    ExternalWorkflowExecutionCancelRequestedEventAttributes