{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SWF.Types.WorkflowExecutionCancelRequestedEventAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | 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,
    -- | The external workflow execution for which the cancellation was
    -- requested.
    WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecution
externalWorkflowExecution :: Prelude.Maybe WorkflowExecution
  }
  deriving (WorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecutionCancelRequestedEventAttributes -> Bool
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]
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
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.
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:
--
-- '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.
--
-- '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.
--
-- 'externalWorkflowExecution', 'workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution' - The external workflow execution for which the cancellation was
-- requested.
newWorkflowExecutionCancelRequestedEventAttributes ::
  WorkflowExecutionCancelRequestedEventAttributes
newWorkflowExecutionCancelRequestedEventAttributes :: WorkflowExecutionCancelRequestedEventAttributes
newWorkflowExecutionCancelRequestedEventAttributes =
  WorkflowExecutionCancelRequestedEventAttributes'
    { $sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecutionCancelRequestedCause
cause =
        forall a. Maybe a
Prelude.Nothing,
      $sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe Integer
externalInitiatedEventId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: Maybe WorkflowExecution
externalWorkflowExecution =
        forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens'
  WorkflowExecutionCancelRequestedEventAttributes
  (Maybe WorkflowExecutionCancelRequestedCause)
workflowExecutionCancelRequestedEventAttributes_cause = 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)

-- | 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 :: Lens'
  WorkflowExecutionCancelRequestedEventAttributes (Maybe Integer)
workflowExecutionCancelRequestedEventAttributes_externalInitiatedEventId = 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)

-- | The external workflow execution for which the cancellation was
-- requested.
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution :: Lens.Lens' WorkflowExecutionCancelRequestedEventAttributes (Prelude.Maybe WorkflowExecution)
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution :: Lens'
  WorkflowExecutionCancelRequestedEventAttributes
  (Maybe WorkflowExecution)
workflowExecutionCancelRequestedEventAttributes_externalWorkflowExecution = 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)

instance
  Data.FromJSON
    WorkflowExecutionCancelRequestedEventAttributes
  where
  parseJSON :: Value -> Parser WorkflowExecutionCancelRequestedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowExecutionCancelRequestedEventAttributes"
      ( \Object
x ->
          Maybe WorkflowExecutionCancelRequestedCause
-> Maybe Integer
-> Maybe WorkflowExecution
-> WorkflowExecutionCancelRequestedEventAttributes
WorkflowExecutionCancelRequestedEventAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cause")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"externalInitiatedEventId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"externalWorkflowExecution")
      )

instance
  Prelude.Hashable
    WorkflowExecutionCancelRequestedEventAttributes
  where
  hashWithSalt :: Int -> WorkflowExecutionCancelRequestedEventAttributes -> Int
hashWithSalt
    Int
_salt
    WorkflowExecutionCancelRequestedEventAttributes' {Maybe Integer
Maybe WorkflowExecution
Maybe WorkflowExecutionCancelRequestedCause
externalWorkflowExecution :: Maybe WorkflowExecution
externalInitiatedEventId :: Maybe Integer
cause :: Maybe WorkflowExecutionCancelRequestedCause
$sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecution
$sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes -> Maybe Integer
$sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecutionCancelRequestedCause
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WorkflowExecutionCancelRequestedCause
cause
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
externalInitiatedEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WorkflowExecution
externalWorkflowExecution

instance
  Prelude.NFData
    WorkflowExecutionCancelRequestedEventAttributes
  where
  rnf :: WorkflowExecutionCancelRequestedEventAttributes -> ()
rnf
    WorkflowExecutionCancelRequestedEventAttributes' {Maybe Integer
Maybe WorkflowExecution
Maybe WorkflowExecutionCancelRequestedCause
externalWorkflowExecution :: Maybe WorkflowExecution
externalInitiatedEventId :: Maybe Integer
cause :: Maybe WorkflowExecutionCancelRequestedCause
$sel:externalWorkflowExecution:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecution
$sel:externalInitiatedEventId:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes -> Maybe Integer
$sel:cause:WorkflowExecutionCancelRequestedEventAttributes' :: WorkflowExecutionCancelRequestedEventAttributes
-> Maybe WorkflowExecutionCancelRequestedCause
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe WorkflowExecutionCancelRequestedCause
cause
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
externalInitiatedEventId
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe WorkflowExecution
externalWorkflowExecution