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

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

-- | Provides the details of the @WorkflowExecutionCancelRequested@ event.
--
-- /See:/ 'newWorkflowExecutionCancelRequestedEventAttributes' smart constructor.
data WorkflowExecutionCancelRequestedEventAttributes = WorkflowExecutionCancelRequestedEventAttributes'
  { -- | The external workflow execution for which the cancellation was
    -- requested.
    WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecution
externalWorkflowExecution :: Prelude.Maybe WorkflowExecution,
    -- | The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
    -- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
    -- to cancel 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.
    WorkflowExecutionCancelRequestedEventAttributes -> Maybe Integer
externalInitiatedEventId :: Prelude.Maybe Prelude.Integer,
    -- | If set, indicates that the request to cancel the workflow execution was
    -- automatically generated, and specifies the cause. This happens if the
    -- parent workflow execution times out or is terminated, and the child
    -- policy is set to cancel child executions.
    WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecutionCancelRequestedCause
cause :: Prelude.Maybe WorkflowExecutionCancelRequestedCause
  }
  deriving (WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
(WorkflowExecutionCancelRequestedEventAttributes
 -> WorkflowExecutionCancelRequestedEventAttributes -> Bool)
-> (WorkflowExecutionCancelRequestedEventAttributes
    -> WorkflowExecutionCancelRequestedEventAttributes -> Bool)
-> Eq WorkflowExecutionCancelRequestedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
$c/= :: WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
== :: WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
$c== :: WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionCancelRequestedEventAttributes]
ReadPrec WorkflowExecutionCancelRequestedEventAttributes
Int -> ReadS WorkflowExecutionCancelRequestedEventAttributes
ReadS [WorkflowExecutionCancelRequestedEventAttributes]
(Int -> ReadS WorkflowExecutionCancelRequestedEventAttributes)
-> ReadS [WorkflowExecutionCancelRequestedEventAttributes]
-> ReadPrec WorkflowExecutionCancelRequestedEventAttributes
-> ReadPrec [WorkflowExecutionCancelRequestedEventAttributes]
-> Read WorkflowExecutionCancelRequestedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionCancelRequestedEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionCancelRequestedEventAttributes]
readPrec :: ReadPrec WorkflowExecutionCancelRequestedEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionCancelRequestedEventAttributes
readList :: ReadS [WorkflowExecutionCancelRequestedEventAttributes]
$creadList :: ReadS [WorkflowExecutionCancelRequestedEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionCancelRequestedEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionCancelRequestedEventAttributes
Prelude.Read, Int -> WorkflowExecutionCancelRequestedEventAttributes -> ShowS
[WorkflowExecutionCancelRequestedEventAttributes] -> ShowS
WorkflowExecutionCancelRequestedEventAttributes -> String
(Int -> WorkflowExecutionCancelRequestedEventAttributes -> ShowS)
-> (WorkflowExecutionCancelRequestedEventAttributes -> String)
-> ([WorkflowExecutionCancelRequestedEventAttributes] -> ShowS)
-> Show WorkflowExecutionCancelRequestedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionCancelRequestedEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionCancelRequestedEventAttributes] -> ShowS
show :: WorkflowExecutionCancelRequestedEventAttributes -> String
$cshow :: WorkflowExecutionCancelRequestedEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionCancelRequestedEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionCancelRequestedEventAttributes -> ShowS
Prelude.Show, (forall x.
 WorkflowExecutionCancelRequestedEventAttributes
 -> Rep WorkflowExecutionCancelRequestedEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionCancelRequestedEventAttributes x
    -> WorkflowExecutionCancelRequestedEventAttributes)
-> Generic WorkflowExecutionCancelRequestedEventAttributes
forall x.
Rep WorkflowExecutionCancelRequestedEventAttributes x
-> WorkflowExecutionCancelRequestedEventAttributes
forall x.
WorkflowExecutionCancelRequestedEventAttributes
-> Rep WorkflowExecutionCancelRequestedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionCancelRequestedEventAttributes x
-> WorkflowExecutionCancelRequestedEventAttributes
$cfrom :: forall x.
WorkflowExecutionCancelRequestedEventAttributes
-> Rep WorkflowExecutionCancelRequestedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionCancelRequestedEventAttributes' 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', 'workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution' - The external workflow execution for which the cancellation was
-- requested.
--
-- 'externalInitiatedEventId', 'workflowExecutionCancelRequestedEventAttributes_externalInitiatedEventId' - The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
-- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
-- to cancel 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.
--
-- 'cause', 'workflowExecutionCancelRequestedEventAttributes_cause' - If set, indicates that the request to cancel the workflow execution was
-- automatically generated, and specifies the cause. This happens if the
-- parent workflow execution times out or is terminated, and the child
-- policy is set to cancel child executions.
newWorkflowExecutionCancelRequestedEventAttributes ::
  WorkflowExecutionCancelRequestedEventAttributes
newWorkflowExecutionCancelRequestedEventAttributes :: WorkflowExecutionCancelRequestedEventAttributes
newWorkflowExecutionCancelRequestedEventAttributes =
  WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecution
-> Maybe Integer
-> Maybe WorkflowExecutionCancelRequestedCause
-> WorkflowExecutionCancelRequestedEventAttributes
WorkflowExecutionCancelRequestedEventAttributes'
    { $sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution =
        Maybe WorkflowExecution
forall a. Maybe a
Prelude.Nothing,
      $sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe Integer
externalInitiatedEventId =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecutionCancelRequestedCause
cause = Maybe WorkflowExecutionCancelRequestedCause
forall a. Maybe a
Prelude.Nothing
    }

-- | The external workflow execution for which the cancellation was
-- requested.
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution :: Lens.Lens' WorkflowExecutionCancelRequestedEventAttributes (Prelude.Maybe WorkflowExecution)
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution :: (Maybe WorkflowExecution -> f (Maybe WorkflowExecution))
-> WorkflowExecutionCancelRequestedEventAttributes
-> f WorkflowExecutionCancelRequestedEventAttributes
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution = (WorkflowExecutionCancelRequestedEventAttributes
 -> Maybe WorkflowExecution)
-> (WorkflowExecutionCancelRequestedEventAttributes
    -> Maybe WorkflowExecution
    -> WorkflowExecutionCancelRequestedEventAttributes)
-> Lens
     WorkflowExecutionCancelRequestedEventAttributes
     WorkflowExecutionCancelRequestedEventAttributes
     (Maybe WorkflowExecution)
     (Maybe WorkflowExecution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCancelRequestedEventAttributes' {Maybe WorkflowExecution
externalWorkflowExecution :: Maybe WorkflowExecution
$sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecution
externalWorkflowExecution} -> Maybe WorkflowExecution
externalWorkflowExecution) (\s :: WorkflowExecutionCancelRequestedEventAttributes
s@WorkflowExecutionCancelRequestedEventAttributes' {} Maybe WorkflowExecution
a -> WorkflowExecutionCancelRequestedEventAttributes
s {$sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution = Maybe WorkflowExecution
a} :: WorkflowExecutionCancelRequestedEventAttributes)

-- | The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event
-- corresponding to the @RequestCancelExternalWorkflowExecution@ decision
-- to cancel 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.
workflowExecutionCancelRequestedEventAttributes_externalInitiatedEventId :: Lens.Lens' WorkflowExecutionCancelRequestedEventAttributes (Prelude.Maybe Prelude.Integer)
workflowExecutionCancelRequestedEventAttributes_externalInitiatedEventId :: (Maybe Integer -> f (Maybe Integer))
-> WorkflowExecutionCancelRequestedEventAttributes
-> f WorkflowExecutionCancelRequestedEventAttributes
workflowExecutionCancelRequestedEventAttributes_externalInitiatedEventId = (WorkflowExecutionCancelRequestedEventAttributes -> Maybe Integer)
-> (WorkflowExecutionCancelRequestedEventAttributes
    -> Maybe Integer
    -> WorkflowExecutionCancelRequestedEventAttributes)
-> Lens
     WorkflowExecutionCancelRequestedEventAttributes
     WorkflowExecutionCancelRequestedEventAttributes
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCancelRequestedEventAttributes' {Maybe Integer
externalInitiatedEventId :: Maybe Integer
$sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes -> Maybe Integer
externalInitiatedEventId} -> Maybe Integer
externalInitiatedEventId) (\s :: WorkflowExecutionCancelRequestedEventAttributes
s@WorkflowExecutionCancelRequestedEventAttributes' {} Maybe Integer
a -> WorkflowExecutionCancelRequestedEventAttributes
s {$sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe Integer
externalInitiatedEventId = Maybe Integer
a} :: WorkflowExecutionCancelRequestedEventAttributes)

-- | If set, indicates that the request to cancel the workflow execution was
-- automatically generated, and specifies the cause. This happens if the
-- parent workflow execution times out or is terminated, and the child
-- policy is set to cancel child executions.
workflowExecutionCancelRequestedEventAttributes_cause :: Lens.Lens' WorkflowExecutionCancelRequestedEventAttributes (Prelude.Maybe WorkflowExecutionCancelRequestedCause)
workflowExecutionCancelRequestedEventAttributes_cause :: (Maybe WorkflowExecutionCancelRequestedCause
 -> f (Maybe WorkflowExecutionCancelRequestedCause))
-> WorkflowExecutionCancelRequestedEventAttributes
-> f WorkflowExecutionCancelRequestedEventAttributes
workflowExecutionCancelRequestedEventAttributes_cause = (WorkflowExecutionCancelRequestedEventAttributes
 -> Maybe WorkflowExecutionCancelRequestedCause)
-> (WorkflowExecutionCancelRequestedEventAttributes
    -> Maybe WorkflowExecutionCancelRequestedCause
    -> WorkflowExecutionCancelRequestedEventAttributes)
-> Lens
     WorkflowExecutionCancelRequestedEventAttributes
     WorkflowExecutionCancelRequestedEventAttributes
     (Maybe WorkflowExecutionCancelRequestedCause)
     (Maybe WorkflowExecutionCancelRequestedCause)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionCancelRequestedEventAttributes' {Maybe WorkflowExecutionCancelRequestedCause
cause :: Maybe WorkflowExecutionCancelRequestedCause
$sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecutionCancelRequestedCause
cause} -> Maybe WorkflowExecutionCancelRequestedCause
cause) (\s :: WorkflowExecutionCancelRequestedEventAttributes
s@WorkflowExecutionCancelRequestedEventAttributes' {} Maybe WorkflowExecutionCancelRequestedCause
a -> WorkflowExecutionCancelRequestedEventAttributes
s {$sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecutionCancelRequestedCause
cause = Maybe WorkflowExecutionCancelRequestedCause
a} :: WorkflowExecutionCancelRequestedEventAttributes)

instance
  Core.FromJSON
    WorkflowExecutionCancelRequestedEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCancelRequestedEventAttributes
parseJSON =
    String
-> (Object
    -> Parser WorkflowExecutionCancelRequestedEventAttributes)
-> Value
-> Parser WorkflowExecutionCancelRequestedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionCancelRequestedEventAttributes"
      ( \Object
x ->
          Maybe WorkflowExecution
-> Maybe Integer
-> Maybe WorkflowExecutionCancelRequestedCause
-> WorkflowExecutionCancelRequestedEventAttributes
WorkflowExecutionCancelRequestedEventAttributes'
            (Maybe WorkflowExecution
 -> Maybe Integer
 -> Maybe WorkflowExecutionCancelRequestedCause
 -> WorkflowExecutionCancelRequestedEventAttributes)
-> Parser (Maybe WorkflowExecution)
-> Parser
     (Maybe Integer
      -> Maybe WorkflowExecutionCancelRequestedCause
      -> WorkflowExecutionCancelRequestedEventAttributes)
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 WorkflowExecutionCancelRequestedCause
   -> WorkflowExecutionCancelRequestedEventAttributes)
-> Parser (Maybe Integer)
-> Parser
     (Maybe WorkflowExecutionCancelRequestedCause
      -> WorkflowExecutionCancelRequestedEventAttributes)
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 WorkflowExecutionCancelRequestedCause
   -> WorkflowExecutionCancelRequestedEventAttributes)
-> Parser (Maybe WorkflowExecutionCancelRequestedCause)
-> Parser WorkflowExecutionCancelRequestedEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe WorkflowExecutionCancelRequestedCause)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cause")
      )

instance
  Prelude.Hashable
    WorkflowExecutionCancelRequestedEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionCancelRequestedEventAttributes