{-# 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-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.ContinueAsNewWorkflowExecutionFailedEventAttributes 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.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
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]
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
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.
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'
      { $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 :: Lens'
  ContinueAsNewWorkflowExecutionFailedEventAttributes
  ContinueAsNewWorkflowExecutionFailedCause
continueAsNewWorkflowExecutionFailedEventAttributes_cause = 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 :: Lens' ContinueAsNewWorkflowExecutionFailedEventAttributes Integer
continueAsNewWorkflowExecutionFailedEventAttributes_decisionTaskCompletedEventId = 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
  Data.FromJSON
    ContinueAsNewWorkflowExecutionFailedEventAttributes
  where
  parseJSON :: Value -> Parser ContinueAsNewWorkflowExecutionFailedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContinueAsNewWorkflowExecutionFailedEventAttributes"
      ( \Object
x ->
          ContinueAsNewWorkflowExecutionFailedCause
-> Integer -> ContinueAsNewWorkflowExecutionFailedEventAttributes
ContinueAsNewWorkflowExecutionFailedEventAttributes'
            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
"cause")
            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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    ContinueAsNewWorkflowExecutionFailedEventAttributes
  where
  hashWithSalt :: Int -> ContinueAsNewWorkflowExecutionFailedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ContinueAsNewWorkflowExecutionFailedEventAttributes' {Integer
ContinueAsNewWorkflowExecutionFailedCause
decisionTaskCompletedEventId :: Integer
cause :: ContinueAsNewWorkflowExecutionFailedCause
$sel:decisionTaskCompletedEventId:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedEventAttributes -> Integer
$sel:cause:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedCause
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ContinueAsNewWorkflowExecutionFailedCause
cause
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
decisionTaskCompletedEventId

instance
  Prelude.NFData
    ContinueAsNewWorkflowExecutionFailedEventAttributes
  where
  rnf :: ContinueAsNewWorkflowExecutionFailedEventAttributes -> ()
rnf
    ContinueAsNewWorkflowExecutionFailedEventAttributes' {Integer
ContinueAsNewWorkflowExecutionFailedCause
decisionTaskCompletedEventId :: Integer
cause :: ContinueAsNewWorkflowExecutionFailedCause
$sel:decisionTaskCompletedEventId:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedEventAttributes -> Integer
$sel:cause:ContinueAsNewWorkflowExecutionFailedEventAttributes' :: ContinueAsNewWorkflowExecutionFailedEventAttributes
-> ContinueAsNewWorkflowExecutionFailedCause
..} =
      forall a. NFData a => a -> ()
Prelude.rnf ContinueAsNewWorkflowExecutionFailedCause
cause
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
decisionTaskCompletedEventId