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

-- | Provides the details of the @ChildWorkflowExecutionFailed@ event.
--
-- /See:/ 'newChildWorkflowExecutionFailedEventAttributes' smart constructor.
data ChildWorkflowExecutionFailedEventAttributes = ChildWorkflowExecutionFailedEventAttributes'
  { -- | The details of the failure (if provided).
    ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The reason for the failure (if provided).
    ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The child workflow execution that failed.
    ChildWorkflowExecutionFailedEventAttributes -> WorkflowExecution
workflowExecution :: WorkflowExecution,
    -- | The type of the child workflow execution.
    ChildWorkflowExecutionFailedEventAttributes -> 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.
    ChildWorkflowExecutionFailedEventAttributes -> 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.
    ChildWorkflowExecutionFailedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ChildWorkflowExecutionFailedEventAttributes
-> ChildWorkflowExecutionFailedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChildWorkflowExecutionFailedEventAttributes
-> ChildWorkflowExecutionFailedEventAttributes -> Bool
$c/= :: ChildWorkflowExecutionFailedEventAttributes
-> ChildWorkflowExecutionFailedEventAttributes -> Bool
== :: ChildWorkflowExecutionFailedEventAttributes
-> ChildWorkflowExecutionFailedEventAttributes -> Bool
$c== :: ChildWorkflowExecutionFailedEventAttributes
-> ChildWorkflowExecutionFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ChildWorkflowExecutionFailedEventAttributes]
ReadPrec ChildWorkflowExecutionFailedEventAttributes
Int -> ReadS ChildWorkflowExecutionFailedEventAttributes
ReadS [ChildWorkflowExecutionFailedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChildWorkflowExecutionFailedEventAttributes]
$creadListPrec :: ReadPrec [ChildWorkflowExecutionFailedEventAttributes]
readPrec :: ReadPrec ChildWorkflowExecutionFailedEventAttributes
$creadPrec :: ReadPrec ChildWorkflowExecutionFailedEventAttributes
readList :: ReadS [ChildWorkflowExecutionFailedEventAttributes]
$creadList :: ReadS [ChildWorkflowExecutionFailedEventAttributes]
readsPrec :: Int -> ReadS ChildWorkflowExecutionFailedEventAttributes
$creadsPrec :: Int -> ReadS ChildWorkflowExecutionFailedEventAttributes
Prelude.Read, Int -> ChildWorkflowExecutionFailedEventAttributes -> ShowS
[ChildWorkflowExecutionFailedEventAttributes] -> ShowS
ChildWorkflowExecutionFailedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChildWorkflowExecutionFailedEventAttributes] -> ShowS
$cshowList :: [ChildWorkflowExecutionFailedEventAttributes] -> ShowS
show :: ChildWorkflowExecutionFailedEventAttributes -> String
$cshow :: ChildWorkflowExecutionFailedEventAttributes -> String
showsPrec :: Int -> ChildWorkflowExecutionFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> ChildWorkflowExecutionFailedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep ChildWorkflowExecutionFailedEventAttributes x
-> ChildWorkflowExecutionFailedEventAttributes
forall x.
ChildWorkflowExecutionFailedEventAttributes
-> Rep ChildWorkflowExecutionFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChildWorkflowExecutionFailedEventAttributes x
-> ChildWorkflowExecutionFailedEventAttributes
$cfrom :: forall x.
ChildWorkflowExecutionFailedEventAttributes
-> Rep ChildWorkflowExecutionFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ChildWorkflowExecutionFailedEventAttributes' 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', 'childWorkflowExecutionFailedEventAttributes_details' - The details of the failure (if provided).
--
-- 'reason', 'childWorkflowExecutionFailedEventAttributes_reason' - The reason for the failure (if provided).
--
-- 'workflowExecution', 'childWorkflowExecutionFailedEventAttributes_workflowExecution' - The child workflow execution that failed.
--
-- 'workflowType', 'childWorkflowExecutionFailedEventAttributes_workflowType' - The type of the child workflow execution.
--
-- 'initiatedEventId', 'childWorkflowExecutionFailedEventAttributes_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', 'childWorkflowExecutionFailedEventAttributes_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.
newChildWorkflowExecutionFailedEventAttributes ::
  -- | 'workflowExecution'
  WorkflowExecution ->
  -- | 'workflowType'
  WorkflowType ->
  -- | 'initiatedEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ChildWorkflowExecutionFailedEventAttributes
newChildWorkflowExecutionFailedEventAttributes :: WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionFailedEventAttributes
newChildWorkflowExecutionFailedEventAttributes
  WorkflowExecution
pWorkflowExecution_
  WorkflowType
pWorkflowType_
  Integer
pInitiatedEventId_
  Integer
pStartedEventId_ =
    ChildWorkflowExecutionFailedEventAttributes'
      { $sel:details:ChildWorkflowExecutionFailedEventAttributes' :: Maybe Text
details =
          forall a. Maybe a
Prelude.Nothing,
        $sel:reason:ChildWorkflowExecutionFailedEventAttributes' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing,
        $sel:workflowExecution:ChildWorkflowExecutionFailedEventAttributes' :: WorkflowExecution
workflowExecution =
          WorkflowExecution
pWorkflowExecution_,
        $sel:workflowType:ChildWorkflowExecutionFailedEventAttributes' :: WorkflowType
workflowType = WorkflowType
pWorkflowType_,
        $sel:initiatedEventId:ChildWorkflowExecutionFailedEventAttributes' :: Integer
initiatedEventId =
          Integer
pInitiatedEventId_,
        $sel:startedEventId:ChildWorkflowExecutionFailedEventAttributes' :: Integer
startedEventId =
          Integer
pStartedEventId_
      }

-- | The details of the failure (if provided).
childWorkflowExecutionFailedEventAttributes_details :: Lens.Lens' ChildWorkflowExecutionFailedEventAttributes (Prelude.Maybe Prelude.Text)
childWorkflowExecutionFailedEventAttributes_details :: Lens' ChildWorkflowExecutionFailedEventAttributes (Maybe Text)
childWorkflowExecutionFailedEventAttributes_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionFailedEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: ChildWorkflowExecutionFailedEventAttributes
s@ChildWorkflowExecutionFailedEventAttributes' {} Maybe Text
a -> ChildWorkflowExecutionFailedEventAttributes
s {$sel:details:ChildWorkflowExecutionFailedEventAttributes' :: Maybe Text
details = Maybe Text
a} :: ChildWorkflowExecutionFailedEventAttributes)

-- | The reason for the failure (if provided).
childWorkflowExecutionFailedEventAttributes_reason :: Lens.Lens' ChildWorkflowExecutionFailedEventAttributes (Prelude.Maybe Prelude.Text)
childWorkflowExecutionFailedEventAttributes_reason :: Lens' ChildWorkflowExecutionFailedEventAttributes (Maybe Text)
childWorkflowExecutionFailedEventAttributes_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionFailedEventAttributes' {Maybe Text
reason :: Maybe Text
$sel:reason:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
reason} -> Maybe Text
reason) (\s :: ChildWorkflowExecutionFailedEventAttributes
s@ChildWorkflowExecutionFailedEventAttributes' {} Maybe Text
a -> ChildWorkflowExecutionFailedEventAttributes
s {$sel:reason:ChildWorkflowExecutionFailedEventAttributes' :: Maybe Text
reason = Maybe Text
a} :: ChildWorkflowExecutionFailedEventAttributes)

-- | The child workflow execution that failed.
childWorkflowExecutionFailedEventAttributes_workflowExecution :: Lens.Lens' ChildWorkflowExecutionFailedEventAttributes WorkflowExecution
childWorkflowExecutionFailedEventAttributes_workflowExecution :: Lens' ChildWorkflowExecutionFailedEventAttributes WorkflowExecution
childWorkflowExecutionFailedEventAttributes_workflowExecution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionFailedEventAttributes' {WorkflowExecution
workflowExecution :: WorkflowExecution
$sel:workflowExecution:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> WorkflowExecution
workflowExecution} -> WorkflowExecution
workflowExecution) (\s :: ChildWorkflowExecutionFailedEventAttributes
s@ChildWorkflowExecutionFailedEventAttributes' {} WorkflowExecution
a -> ChildWorkflowExecutionFailedEventAttributes
s {$sel:workflowExecution:ChildWorkflowExecutionFailedEventAttributes' :: WorkflowExecution
workflowExecution = WorkflowExecution
a} :: ChildWorkflowExecutionFailedEventAttributes)

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

-- | 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.
childWorkflowExecutionFailedEventAttributes_initiatedEventId :: Lens.Lens' ChildWorkflowExecutionFailedEventAttributes Prelude.Integer
childWorkflowExecutionFailedEventAttributes_initiatedEventId :: Lens' ChildWorkflowExecutionFailedEventAttributes Integer
childWorkflowExecutionFailedEventAttributes_initiatedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionFailedEventAttributes' {Integer
initiatedEventId :: Integer
$sel:initiatedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
initiatedEventId} -> Integer
initiatedEventId) (\s :: ChildWorkflowExecutionFailedEventAttributes
s@ChildWorkflowExecutionFailedEventAttributes' {} Integer
a -> ChildWorkflowExecutionFailedEventAttributes
s {$sel:initiatedEventId:ChildWorkflowExecutionFailedEventAttributes' :: Integer
initiatedEventId = Integer
a} :: ChildWorkflowExecutionFailedEventAttributes)

-- | 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.
childWorkflowExecutionFailedEventAttributes_startedEventId :: Lens.Lens' ChildWorkflowExecutionFailedEventAttributes Prelude.Integer
childWorkflowExecutionFailedEventAttributes_startedEventId :: Lens' ChildWorkflowExecutionFailedEventAttributes Integer
childWorkflowExecutionFailedEventAttributes_startedEventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildWorkflowExecutionFailedEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: ChildWorkflowExecutionFailedEventAttributes
s@ChildWorkflowExecutionFailedEventAttributes' {} Integer
a -> ChildWorkflowExecutionFailedEventAttributes
s {$sel:startedEventId:ChildWorkflowExecutionFailedEventAttributes' :: Integer
startedEventId = Integer
a} :: ChildWorkflowExecutionFailedEventAttributes)

instance
  Data.FromJSON
    ChildWorkflowExecutionFailedEventAttributes
  where
  parseJSON :: Value -> Parser ChildWorkflowExecutionFailedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChildWorkflowExecutionFailedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> WorkflowExecution
-> WorkflowType
-> Integer
-> Integer
-> ChildWorkflowExecutionFailedEventAttributes
ChildWorkflowExecutionFailedEventAttributes'
            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
"details")
            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
"reason")
            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
"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
"workflowType")
            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")
            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
"startedEventId")
      )

instance
  Prelude.Hashable
    ChildWorkflowExecutionFailedEventAttributes
  where
  hashWithSalt :: Int -> ChildWorkflowExecutionFailedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ChildWorkflowExecutionFailedEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
reason :: Maybe Text
details :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> WorkflowExecution
$sel:reason:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
$sel:details:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
details
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowExecution
workflowExecution
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WorkflowType
workflowType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
initiatedEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
startedEventId

instance
  Prelude.NFData
    ChildWorkflowExecutionFailedEventAttributes
  where
  rnf :: ChildWorkflowExecutionFailedEventAttributes -> ()
rnf ChildWorkflowExecutionFailedEventAttributes' {Integer
Maybe Text
WorkflowExecution
WorkflowType
startedEventId :: Integer
initiatedEventId :: Integer
workflowType :: WorkflowType
workflowExecution :: WorkflowExecution
reason :: Maybe Text
details :: Maybe Text
$sel:startedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
$sel:initiatedEventId:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Integer
$sel:workflowType:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> WorkflowType
$sel:workflowExecution:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> WorkflowExecution
$sel:reason:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
$sel:details:ChildWorkflowExecutionFailedEventAttributes' :: ChildWorkflowExecutionFailedEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
details
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 WorkflowType
workflowType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
initiatedEventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
startedEventId