{-# 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.ChildWorkflowExecutionCanceledEventAttributes
-- 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.ChildWorkflowExecutionCanceledEventAttributes 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.WorkflowType

-- | Provide details of the @ChildWorkflowExecutionCanceled@ event.
--
-- /See:/ 'newChildWorkflowExecutionCanceledEventAttributes' smart constructor.
data ChildWorkflowExecutionCanceledEventAttributes = ChildWorkflowExecutionCanceledEventAttributes'
  { -- | Details of the cancellation (if provided).
    ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The child workflow execution that was canceled.
    ChildWorkflowExecutionCanceledEventAttributes -> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The type of the child workflow execution.
    ChildWorkflowExecutionCanceledEventAttributes -> WorkflowType
workflowType :: WorkflowType,
    -- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
    -- to the @StartChildWorkflowExecution@ Decision to start this child
    -- workflow execution. This information can be useful for diagnosing
    -- problems by tracing back the chain of events leading up to this event.
    ChildWorkflowExecutionCanceledEventAttributes -> Integer
initiatedEventId :: Prelude.Integer,
    -- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
    -- child workflow execution was started. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    ChildWorkflowExecutionCanceledEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ChildWorkflowExecutionCanceledEventAttributes
-> ChildWorkflowExecutionCanceledEventAttributes -> Bool
(ChildWorkflowExecutionCanceledEventAttributes
 -> ChildWorkflowExecutionCanceledEventAttributes -> Bool)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> ChildWorkflowExecutionCanceledEventAttributes -> Bool)
-> Eq ChildWorkflowExecutionCanceledEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChildWorkflowExecutionCanceledEventAttributes
-> ChildWorkflowExecutionCanceledEventAttributes -> Bool
$c/= :: ChildWorkflowExecutionCanceledEventAttributes
-> ChildWorkflowExecutionCanceledEventAttributes -> Bool
== :: ChildWorkflowExecutionCanceledEventAttributes
-> ChildWorkflowExecutionCanceledEventAttributes -> Bool
$c== :: ChildWorkflowExecutionCanceledEventAttributes
-> ChildWorkflowExecutionCanceledEventAttributes -> Bool
Prelude.Eq, ReadPrec [ChildWorkflowExecutionCanceledEventAttributes]
ReadPrec ChildWorkflowExecutionCanceledEventAttributes
Int -> ReadS ChildWorkflowExecutionCanceledEventAttributes
ReadS [ChildWorkflowExecutionCanceledEventAttributes]
(Int -> ReadS ChildWorkflowExecutionCanceledEventAttributes)
-> ReadS [ChildWorkflowExecutionCanceledEventAttributes]
-> ReadPrec ChildWorkflowExecutionCanceledEventAttributes
-> ReadPrec [ChildWorkflowExecutionCanceledEventAttributes]
-> Read ChildWorkflowExecutionCanceledEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChildWorkflowExecutionCanceledEventAttributes]
$creadListPrec :: ReadPrec [ChildWorkflowExecutionCanceledEventAttributes]
readPrec :: ReadPrec ChildWorkflowExecutionCanceledEventAttributes
$creadPrec :: ReadPrec ChildWorkflowExecutionCanceledEventAttributes
readList :: ReadS [ChildWorkflowExecutionCanceledEventAttributes]
$creadList :: ReadS [ChildWorkflowExecutionCanceledEventAttributes]
readsPrec :: Int -> ReadS ChildWorkflowExecutionCanceledEventAttributes
$creadsPrec :: Int -> ReadS ChildWorkflowExecutionCanceledEventAttributes
Prelude.Read, Int -> ChildWorkflowExecutionCanceledEventAttributes -> ShowS
[ChildWorkflowExecutionCanceledEventAttributes] -> ShowS
ChildWorkflowExecutionCanceledEventAttributes -> String
(Int -> ChildWorkflowExecutionCanceledEventAttributes -> ShowS)
-> (ChildWorkflowExecutionCanceledEventAttributes -> String)
-> ([ChildWorkflowExecutionCanceledEventAttributes] -> ShowS)
-> Show ChildWorkflowExecutionCanceledEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChildWorkflowExecutionCanceledEventAttributes] -> ShowS
$cshowList :: [ChildWorkflowExecutionCanceledEventAttributes] -> ShowS
show :: ChildWorkflowExecutionCanceledEventAttributes -> String
$cshow :: ChildWorkflowExecutionCanceledEventAttributes -> String
showsPrec :: Int -> ChildWorkflowExecutionCanceledEventAttributes -> ShowS
$cshowsPrec :: Int -> ChildWorkflowExecutionCanceledEventAttributes -> ShowS
Prelude.Show, (forall x.
 ChildWorkflowExecutionCanceledEventAttributes
 -> Rep ChildWorkflowExecutionCanceledEventAttributes x)
-> (forall x.
    Rep ChildWorkflowExecutionCanceledEventAttributes x
    -> ChildWorkflowExecutionCanceledEventAttributes)
-> Generic ChildWorkflowExecutionCanceledEventAttributes
forall x.
Rep ChildWorkflowExecutionCanceledEventAttributes x
-> ChildWorkflowExecutionCanceledEventAttributes
forall x.
ChildWorkflowExecutionCanceledEventAttributes
-> Rep ChildWorkflowExecutionCanceledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChildWorkflowExecutionCanceledEventAttributes x
-> ChildWorkflowExecutionCanceledEventAttributes
$cfrom :: forall x.
ChildWorkflowExecutionCanceledEventAttributes
-> Rep ChildWorkflowExecutionCanceledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ChildWorkflowExecutionCanceledEventAttributes' 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:
--
-- 'details', 'childWorkflowExecutionCanceledEventAttributes_details' - Details of the cancellation (if provided).
--
-- 'workflowExecution', 'childWorkflowExecutionCanceledEventAttributes_workflowExecution' - The child workflow execution that was canceled.
--
-- 'workflowType', 'childWorkflowExecutionCanceledEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionCanceledEventAttributes_initiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
-- to the @StartChildWorkflowExecution@ Decision to start this child
-- workflow execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
--
-- 'startedEventId', 'childWorkflowExecutionCanceledEventAttributes_startedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
-- child workflow execution was started. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newChildWorkflowExecutionCanceledEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionCanceledEventAttributes
newChildWorkflowExecutionCanceledEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCanceledEventAttributes
newChildWorkflowExecutionCanceledEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_
  Integer
pStartedEventId_ =
    ChildWorkflowExecutionCanceledEventAttributes' :: Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCanceledEventAttributes
ChildWorkflowExecutionCanceledEventAttributes'
      { $sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: Maybe Text
details =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowType
workflowType =
          WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_,
        $sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
startedEventId =
          Integer
pStartedEventId_
      }

-- | Details of the cancellation (if provided).
childWorkflowExecutionCanceledEventAttributes_details :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes (Prelude.Maybe Prelude.Text)
childWorkflowExecutionCanceledEventAttributes_details :: (Maybe Text -> f (Maybe Text))
-> ChildWorkflowExecutionCanceledEventAttributes
-> f ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes_details = (ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> Maybe Text -> ChildWorkflowExecutionCanceledEventAttributes)
-> Lens
     ChildWorkflowExecutionCanceledEventAttributes
     ChildWorkflowExecutionCanceledEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} Maybe Text
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:details:ChildWorkflowExecutionCanceledEventAttributes' :: Maybe Text
details = Maybe Text
a} :: ChildWorkflowExecutionCanceledEventAttributes)

-- | The child workflow execution that was canceled.
childWorkflowExecutionCanceledEventAttributes_workflowExecution :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes WorkflowExecution
childWorkflowExecutionCanceledEventAttributes_workflowExecution :: (WorkflowExecution -> f WorkflowExecution)
-> ChildWorkflowExecutionCanceledEventAttributes
-> f ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes_workflowExecution = (ChildWorkflowExecutionCanceledEventAttributes
 -> WorkflowExecution)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> WorkflowExecution
    -> ChildWorkflowExecutionCanceledEventAttributes)
-> Lens
     ChildWorkflowExecutionCanceledEventAttributes
     ChildWorkflowExecutionCanceledEventAttributes
     WorkflowExecution
     WorkflowExecution
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {WorkflowExecution
workflowExecution :: WorkflowExecution
$sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowExecution
workflowExecution} -> WorkflowExecution
workflowExecution) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} WorkflowExecution
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:workflowExecution:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowExecution
workflowExecution = WorkflowExecution
a} :: ChildWorkflowExecutionCanceledEventAttributes)

-- | The type of the child workflow execution.
childWorkflowExecutionCanceledEventAttributes_workflowType :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes WorkflowType
childWorkflowExecutionCanceledEventAttributes_workflowType :: (WorkflowType -> f WorkflowType)
-> ChildWorkflowExecutionCanceledEventAttributes
-> f ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes_workflowType = (ChildWorkflowExecutionCanceledEventAttributes -> WorkflowType)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> WorkflowType -> ChildWorkflowExecutionCanceledEventAttributes)
-> Lens
     ChildWorkflowExecutionCanceledEventAttributes
     ChildWorkflowExecutionCanceledEventAttributes
     WorkflowType
     WorkflowType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {WorkflowType
workflowType :: WorkflowType
$sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> WorkflowType
workflowType} -> WorkflowType
workflowType) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} WorkflowType
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:workflowType:ChildWorkflowExecutionCanceledEventAttributes' :: WorkflowType
workflowType = WorkflowType
a} :: ChildWorkflowExecutionCanceledEventAttributes)

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding
-- to the @StartChildWorkflowExecution@ Decision to start this child
-- workflow execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionCanceledEventAttributes_initiatedEventId :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes Prelude.Integer
childWorkflowExecutionCanceledEventAttributes_initiatedEventId :: (Integer -> f Integer)
-> ChildWorkflowExecutionCanceledEventAttributes
-> f ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes_initiatedEventId = (ChildWorkflowExecutionCanceledEventAttributes -> Integer)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> Integer -> ChildWorkflowExecutionCanceledEventAttributes)
-> Lens
     ChildWorkflowExecutionCanceledEventAttributes
     ChildWorkflowExecutionCanceledEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} Integer
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:initiatedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ChildWorkflowExecutionCanceledEventAttributes)

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this
-- child workflow execution was started. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
childWorkflowExecutionCanceledEventAttributes_startedEventId :: Lens.Lens' ChildWorkflowExecutionCanceledEventAttributes Prelude.Integer
childWorkflowExecutionCanceledEventAttributes_startedEventId :: (Integer -> f Integer)
-> ChildWorkflowExecutionCanceledEventAttributes
-> f ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes_startedEventId = (ChildWorkflowExecutionCanceledEventAttributes -> Integer)
-> (ChildWorkflowExecutionCanceledEventAttributes
    -> Integer -> ChildWorkflowExecutionCanceledEventAttributes)
-> Lens
     ChildWorkflowExecutionCanceledEventAttributes
     ChildWorkflowExecutionCanceledEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionCanceledEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: ChildWorkflowExecutionCanceledEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: ChildWorkflowExecutionCanceledEventAttributes
s@ChildWorkflowExecutionCanceledEventAttributes' {} Integer
a -> ChildWorkflowExecutionCanceledEventAttributes
s {$sel:startedEventId:ChildWorkflowExecutionCanceledEventAttributes' :: Integer
startedEventId = Integer
a} :: ChildWorkflowExecutionCanceledEventAttributes)

instance
  Core.FromJSON
    ChildWorkflowExecutionCanceledEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionCanceledEventAttributes
parseJSON =
    String
-> (Object -> Parser ChildWorkflowExecutionCanceledEventAttributes)
-> Value
-> Parser ChildWorkflowExecutionCanceledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChildWorkflowExecutionCanceledEventAttributes"
      ( \Object
x ->
          Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionCanceledEventAttributes
ChildWorkflowExecutionCanceledEventAttributes'
            (Maybe Text
 -> WorkflowExecution
 -> WorkflowType
 -> Integer
 -> Integer
 -> ChildWorkflowExecutionCanceledEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (WorkflowExecution
      -> WorkflowType
      -> Integer
      -> Integer
      -> ChildWorkflowExecutionCanceledEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"details")
              Parser
  (WorkflowExecution
   -> WorkflowType
   -> Integer
   -> Integer
   -> ChildWorkflowExecutionCanceledEventAttributes)
-> Parser WorkflowExecution
-> Parser
     (WorkflowType
      -> Integer
      -> Integer
      -> ChildWorkflowExecutionCanceledEventAttributes)
forall (f :: * -> *) a b. Applicative f => 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
  (WorkflowType
   -> Integer
   -> Integer
   -> ChildWorkflowExecutionCanceledEventAttributes)
-> Parser WorkflowType
-> Parser
     (Integer
      -> Integer -> ChildWorkflowExecutionCanceledEventAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WorkflowType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workflowType")
              Parser
  (Integer
   -> Integer -> ChildWorkflowExecutionCanceledEventAttributes)
-> Parser Integer
-> Parser
     (Integer -> ChildWorkflowExecutionCanceledEventAttributes)
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")
              Parser (Integer -> ChildWorkflowExecutionCanceledEventAttributes)
-> Parser Integer
-> Parser ChildWorkflowExecutionCanceledEventAttributes
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
"startedEventId")
      )

instance
  Prelude.Hashable
    ChildWorkflowExecutionCanceledEventAttributes

instance
  Prelude.NFData
    ChildWorkflowExecutionCanceledEventAttributes