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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the details of the @WorkflowExecutionFailed@ event.
--
-- /See:/ 'newWorkflowExecutionFailedEventAttributes' smart constructor.
data WorkflowExecutionFailedEventAttributes = WorkflowExecutionFailedEventAttributes'
  { -- | The descriptive reason provided for the failure.
    WorkflowExecutionFailedEventAttributes -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The details of the failure.
    WorkflowExecutionFailedEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @FailWorkflowExecution@ decision to
    -- fail this execution. This information can be useful for diagnosing
    -- problems by tracing back the chain of events leading up to this event.
    WorkflowExecutionFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (WorkflowExecutionFailedEventAttributes
-> WorkflowExecutionFailedEventAttributes -> Bool
(WorkflowExecutionFailedEventAttributes
 -> WorkflowExecutionFailedEventAttributes -> Bool)
-> (WorkflowExecutionFailedEventAttributes
    -> WorkflowExecutionFailedEventAttributes -> Bool)
-> Eq WorkflowExecutionFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionFailedEventAttributes
-> WorkflowExecutionFailedEventAttributes -> Bool
$c/= :: WorkflowExecutionFailedEventAttributes
-> WorkflowExecutionFailedEventAttributes -> Bool
== :: WorkflowExecutionFailedEventAttributes
-> WorkflowExecutionFailedEventAttributes -> Bool
$c== :: WorkflowExecutionFailedEventAttributes
-> WorkflowExecutionFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionFailedEventAttributes]
ReadPrec WorkflowExecutionFailedEventAttributes
Int -> ReadS WorkflowExecutionFailedEventAttributes
ReadS [WorkflowExecutionFailedEventAttributes]
(Int -> ReadS WorkflowExecutionFailedEventAttributes)
-> ReadS [WorkflowExecutionFailedEventAttributes]
-> ReadPrec WorkflowExecutionFailedEventAttributes
-> ReadPrec [WorkflowExecutionFailedEventAttributes]
-> Read WorkflowExecutionFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionFailedEventAttributes]
$creadListPrec :: ReadPrec [WorkflowExecutionFailedEventAttributes]
readPrec :: ReadPrec WorkflowExecutionFailedEventAttributes
$creadPrec :: ReadPrec WorkflowExecutionFailedEventAttributes
readList :: ReadS [WorkflowExecutionFailedEventAttributes]
$creadList :: ReadS [WorkflowExecutionFailedEventAttributes]
readsPrec :: Int -> ReadS WorkflowExecutionFailedEventAttributes
$creadsPrec :: Int -> ReadS WorkflowExecutionFailedEventAttributes
Prelude.Read, Int -> WorkflowExecutionFailedEventAttributes -> ShowS
[WorkflowExecutionFailedEventAttributes] -> ShowS
WorkflowExecutionFailedEventAttributes -> String
(Int -> WorkflowExecutionFailedEventAttributes -> ShowS)
-> (WorkflowExecutionFailedEventAttributes -> String)
-> ([WorkflowExecutionFailedEventAttributes] -> ShowS)
-> Show WorkflowExecutionFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionFailedEventAttributes] -> ShowS
$cshowList :: [WorkflowExecutionFailedEventAttributes] -> ShowS
show :: WorkflowExecutionFailedEventAttributes -> String
$cshow :: WorkflowExecutionFailedEventAttributes -> String
showsPrec :: Int -> WorkflowExecutionFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 WorkflowExecutionFailedEventAttributes
 -> Rep WorkflowExecutionFailedEventAttributes x)
-> (forall x.
    Rep WorkflowExecutionFailedEventAttributes x
    -> WorkflowExecutionFailedEventAttributes)
-> Generic WorkflowExecutionFailedEventAttributes
forall x.
Rep WorkflowExecutionFailedEventAttributes x
-> WorkflowExecutionFailedEventAttributes
forall x.
WorkflowExecutionFailedEventAttributes
-> Rep WorkflowExecutionFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowExecutionFailedEventAttributes x
-> WorkflowExecutionFailedEventAttributes
$cfrom :: forall x.
WorkflowExecutionFailedEventAttributes
-> Rep WorkflowExecutionFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionFailedEventAttributes' 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:
--
-- 'reason', 'workflowExecutionFailedEventAttributes_reason' - The descriptive reason provided for the failure.
--
-- 'details', 'workflowExecutionFailedEventAttributes_details' - The details of the failure.
--
-- 'decisionTaskCompletedEventId', 'workflowExecutionFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @FailWorkflowExecution@ decision to
-- fail this execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
newWorkflowExecutionFailedEventAttributes ::
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  WorkflowExecutionFailedEventAttributes
newWorkflowExecutionFailedEventAttributes :: Integer -> WorkflowExecutionFailedEventAttributes
newWorkflowExecutionFailedEventAttributes
  Integer
pDecisionTaskCompletedEventId_ =
    WorkflowExecutionFailedEventAttributes' :: Maybe Text
-> Maybe Text -> Integer -> WorkflowExecutionFailedEventAttributes
WorkflowExecutionFailedEventAttributes'
      { $sel:reason:WorkflowExecutionFailedEventAttributes' :: Maybe Text
reason =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:details:WorkflowExecutionFailedEventAttributes' :: Maybe Text
details = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:decisionTaskCompletedEventId:WorkflowExecutionFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

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

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

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @FailWorkflowExecution@ decision to
-- fail this execution. This information can be useful for diagnosing
-- problems by tracing back the chain of events leading up to this event.
workflowExecutionFailedEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' WorkflowExecutionFailedEventAttributes Prelude.Integer
workflowExecutionFailedEventAttributes_decisionTaskCompletedEventId :: (Integer -> f Integer)
-> WorkflowExecutionFailedEventAttributes
-> f WorkflowExecutionFailedEventAttributes
workflowExecutionFailedEventAttributes_decisionTaskCompletedEventId = (WorkflowExecutionFailedEventAttributes -> Integer)
-> (WorkflowExecutionFailedEventAttributes
    -> Integer -> WorkflowExecutionFailedEventAttributes)
-> Lens
     WorkflowExecutionFailedEventAttributes
     WorkflowExecutionFailedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionFailedEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:WorkflowExecutionFailedEventAttributes' :: WorkflowExecutionFailedEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: WorkflowExecutionFailedEventAttributes
s@WorkflowExecutionFailedEventAttributes' {} Integer
a -> WorkflowExecutionFailedEventAttributes
s {$sel:decisionTaskCompletedEventId:WorkflowExecutionFailedEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: WorkflowExecutionFailedEventAttributes)

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

instance
  Prelude.Hashable
    WorkflowExecutionFailedEventAttributes

instance
  Prelude.NFData
    WorkflowExecutionFailedEventAttributes