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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.ContinueAsNewWorkflowExecutionFailedCause

-- | Provides the details of the @ContinueAsNewWorkflowExecutionFailed@
-- event.
--
-- /See:/ 'newContinueAsNewWorkflowExecutionFailedEventAttributes' smart constructor.
data ContinueAsNewWorkflowExecutionFailedEventAttributes = ContinueAsNewWorkflowExecutionFailedEventAttributes'
  { -- | The cause of the failure. This information is generated by the system
    -- and can be useful for diagnostic purposes.
    --
    -- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
    -- because it lacked sufficient permissions. For details and example IAM
    -- policies, see
    -- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
    -- in the /Amazon SWF Developer Guide/.
    ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedCause
cause :: ContinueAsNewWorkflowExecutionFailedCause,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @ContinueAsNewWorkflowExecution@
    -- decision that started this execution. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    ContinueAsNewWorkflowExecutionFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool
(ContinueAsNewWorkflowExecutionFailedEventAttributes
 -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool)
-> (ContinueAsNewWorkflowExecutionFailedEventAttributes
    -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool)
-> Eq ContinueAsNewWorkflowExecutionFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool
$c/= :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool
== :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool
$c== :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ContinueAsNewWorkflowExecutionFailedEventAttributes]
ReadPrec ContinueAsNewWorkflowExecutionFailedEventAttributes
Int -> ReadS ContinueAsNewWorkflowExecutionFailedEventAttributes
ReadS [ContinueAsNewWorkflowExecutionFailedEventAttributes]
(Int -> ReadS ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> ReadS [ContinueAsNewWorkflowExecutionFailedEventAttributes]
-> ReadPrec ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ReadPrec [ContinueAsNewWorkflowExecutionFailedEventAttributes]
-> Read ContinueAsNewWorkflowExecutionFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinueAsNewWorkflowExecutionFailedEventAttributes]
$creadListPrec :: ReadPrec [ContinueAsNewWorkflowExecutionFailedEventAttributes]
readPrec :: ReadPrec ContinueAsNewWorkflowExecutionFailedEventAttributes
$creadPrec :: ReadPrec ContinueAsNewWorkflowExecutionFailedEventAttributes
readList :: ReadS [ContinueAsNewWorkflowExecutionFailedEventAttributes]
$creadList :: ReadS [ContinueAsNewWorkflowExecutionFailedEventAttributes]
readsPrec :: Int -> ReadS ContinueAsNewWorkflowExecutionFailedEventAttributes
$creadsPrec :: Int -> ReadS ContinueAsNewWorkflowExecutionFailedEventAttributes
Prelude.Read, Int -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> ShowS
[ContinueAsNewWorkflowExecutionFailedEventAttributes] -> ShowS
ContinueAsNewWorkflowExecutionFailedEventAttributes -> String
(Int
 -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> ShowS)
-> (ContinueAsNewWorkflowExecutionFailedEventAttributes -> String)
-> ([ContinueAsNewWorkflowExecutionFailedEventAttributes] -> ShowS)
-> Show ContinueAsNewWorkflowExecutionFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinueAsNewWorkflowExecutionFailedEventAttributes] -> ShowS
$cshowList :: [ContinueAsNewWorkflowExecutionFailedEventAttributes] -> ShowS
show :: ContinueAsNewWorkflowExecutionFailedEventAttributes -> String
$cshow :: ContinueAsNewWorkflowExecutionFailedEventAttributes -> String
showsPrec :: Int -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ContinueAsNewWorkflowExecutionFailedEventAttributes
 -> Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x)
-> (forall x.
    Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x
    -> ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> Generic ContinueAsNewWorkflowExecutionFailedEventAttributes
forall x.
Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x
-> ContinueAsNewWorkflowExecutionFailedEventAttributes
forall x.
ContinueAsNewWorkflowExecutionFailedEventAttributes
-> Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x
-> ContinueAsNewWorkflowExecutionFailedEventAttributes
$cfrom :: forall x.
ContinueAsNewWorkflowExecutionFailedEventAttributes
-> Rep ContinueAsNewWorkflowExecutionFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ContinueAsNewWorkflowExecutionFailedEventAttributes' 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', 'continueAsNewWorkflowExecutionFailedEventAttributes_cause' - The cause of the failure. This information is generated by the system
-- and can be useful for diagnostic purposes.
--
-- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
-- because it lacked sufficient permissions. For details and example IAM
-- policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- 'decisionTaskCompletedEventId', 'continueAsNewWorkflowExecutionFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @ContinueAsNewWorkflowExecution@
-- decision that started this execution. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newContinueAsNewWorkflowExecutionFailedEventAttributes ::
  -- | 'cause'
  ContinueAsNewWorkflowExecutionFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  ContinueAsNewWorkflowExecutionFailedEventAttributes
newContinueAsNewWorkflowExecutionFailedEventAttributes :: ContinueAsNewWorkflowExecutionFailedCause
-> Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes
newContinueAsNewWorkflowExecutionFailedEventAttributes
  ContinueAsNewWorkflowExecutionFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedCause
-> Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes
ContinueAsNewWorkflowExecutionFailedEventAttributes'
      { $sel:cause:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedCause
cause =
          ContinueAsNewWorkflowExecutionFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The cause of the failure. This information is generated by the system
-- and can be useful for diagnostic purposes.
--
-- If @cause@ is set to @OPERATION_NOT_PERMITTED@, the decision failed
-- because it lacked sufficient permissions. For details and example IAM
-- policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
continueAsNewWorkflowExecutionFailedEventAttributes_cause :: Lens.Lens' ContinueAsNewWorkflowExecutionFailedEventAttributes ContinueAsNewWorkflowExecutionFailedCause
continueAsNewWorkflowExecutionFailedEventAttributes_cause :: (ContinueAsNewWorkflowExecutionFailedCause
 -> f ContinueAsNewWorkflowExecutionFailedCause)
-> ContinueAsNewWorkflowExecutionFailedEventAttributes
-> f ContinueAsNewWorkflowExecutionFailedEventAttributes
continueAsNewWorkflowExecutionFailedEventAttributes_cause = (ContinueAsNewWorkflowExecutionFailedEventAttributes
 -> ContinueAsNewWorkflowExecutionFailedCause)
-> (ContinueAsNewWorkflowExecutionFailedEventAttributes
    -> ContinueAsNewWorkflowExecutionFailedCause
    -> ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> Lens
     ContinueAsNewWorkflowExecutionFailedEventAttributes
     ContinueAsNewWorkflowExecutionFailedEventAttributes
     ContinueAsNewWorkflowExecutionFailedCause
     ContinueAsNewWorkflowExecutionFailedCause
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinueAsNewWorkflowExecutionFailedEventAttributes' {ContinueAsNewWorkflowExecutionFailedCause
cause :: ContinueAsNewWorkflowExecutionFailedCause
$sel:cause:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedCause
cause} -> ContinueAsNewWorkflowExecutionFailedCause
cause) (\s :: ContinueAsNewWorkflowExecutionFailedEventAttributes
s@ContinueAsNewWorkflowExecutionFailedEventAttributes' {} ContinueAsNewWorkflowExecutionFailedCause
a -> ContinueAsNewWorkflowExecutionFailedEventAttributes
s {$sel:cause:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedCause
cause = ContinueAsNewWorkflowExecutionFailedCause
a} :: ContinueAsNewWorkflowExecutionFailedEventAttributes)

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

instance
  Core.FromJSON
    ContinueAsNewWorkflowExecutionFailedEventAttributes
  where
  parseJSON :: Value -> Parser ContinueAsNewWorkflowExecutionFailedEventAttributes
parseJSON =
    String
-> (Object
    -> Parser ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> Value
-> Parser ContinueAsNewWorkflowExecutionFailedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContinueAsNewWorkflowExecutionFailedEventAttributes"
      ( \Object
x ->
          ContinueAsNewWorkflowExecutionFailedCause
-> Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes
ContinueAsNewWorkflowExecutionFailedEventAttributes'
            (ContinueAsNewWorkflowExecutionFailedCause
 -> Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> Parser ContinueAsNewWorkflowExecutionFailedCause
-> Parser
     (Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ContinueAsNewWorkflowExecutionFailedCause
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cause")
              Parser
  (Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes)
-> Parser Integer
-> Parser ContinueAsNewWorkflowExecutionFailedEventAttributes
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
    ContinueAsNewWorkflowExecutionFailedEventAttributes

instance
  Prelude.NFData
    ContinueAsNewWorkflowExecutionFailedEventAttributes