{-# 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-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.ExternalWorkflowExecutionCancelRequestedEventAttributes 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

-- | 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
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]
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
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.
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'
      { $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 :: Lens'
  ExternalWorkflowExecutionCancelRequestedEventAttributes
  WorkflowExecution
externalWorkflowExecutionCancelRequestedEventAttributes_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 :: Lens'
  ExternalWorkflowExecutionCancelRequestedEventAttributes Integer
externalWorkflowExecutionCancelRequestedEventAttributes_initiatedEventId = 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
  Data.FromJSON
    ExternalWorkflowExecutionCancelRequestedEventAttributes
  where
  parseJSON :: Value
-> Parser ExternalWorkflowExecutionCancelRequestedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExternalWorkflowExecutionCancelRequestedEventAttributes"
      ( \Object
x ->
          WorkflowExecution
-> Integer
-> ExternalWorkflowExecutionCancelRequestedEventAttributes
ExternalWorkflowExecutionCancelRequestedEventAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"workflowExecution")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"initiatedEventId")
      )

instance
  Prelude.Hashable
    ExternalWorkflowExecutionCancelRequestedEventAttributes
  where
  hashWithSalt :: Int
-> ExternalWorkflowExecutionCancelRequestedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ExternalWorkflowExecutionCancelRequestedEventAttributes' {Integer
WorkflowExecution
initiatedEventId :: Integer
workflowExecution :: WorkflowExecution
$sel:initiatedEventId:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> Integer
$sel:workflowExecution:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecution
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowExecution
workflowExecution
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
initiatedEventId

instance
  Prelude.NFData
    ExternalWorkflowExecutionCancelRequestedEventAttributes
  where
  rnf :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> ()
rnf
    ExternalWorkflowExecutionCancelRequestedEventAttributes' {Integer
WorkflowExecution
initiatedEventId :: Integer
workflowExecution :: WorkflowExecution
$sel:initiatedEventId:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes -> Integer
$sel:workflowExecution:ExternalWorkflowExecutionCancelRequestedEventAttributes' :: ExternalWorkflowExecutionCancelRequestedEventAttributes
-> WorkflowExecution
..} =
      forall a. NFData a => a -> ()
Prelude.rnf WorkflowExecution
workflowExecution
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
initiatedEventId