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

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

-- | Provides the details of the @CancelWorkflowExecutionFailed@ event.
--
-- /See:/ 'newCancelWorkflowExecutionFailedEventAttributes' smart constructor.
data CancelWorkflowExecutionFailedEventAttributes = CancelWorkflowExecutionFailedEventAttributes'
  { -- | 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/.
    CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedCause
cause :: CancelWorkflowExecutionFailedCause,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @CancelWorkflowExecution@ decision
    -- for this cancellation request. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    CancelWorkflowExecutionFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedEventAttributes -> Bool
(CancelWorkflowExecutionFailedEventAttributes
 -> CancelWorkflowExecutionFailedEventAttributes -> Bool)
-> (CancelWorkflowExecutionFailedEventAttributes
    -> CancelWorkflowExecutionFailedEventAttributes -> Bool)
-> Eq CancelWorkflowExecutionFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedEventAttributes -> Bool
$c/= :: CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedEventAttributes -> Bool
== :: CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedEventAttributes -> Bool
$c== :: CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [CancelWorkflowExecutionFailedEventAttributes]
ReadPrec CancelWorkflowExecutionFailedEventAttributes
Int -> ReadS CancelWorkflowExecutionFailedEventAttributes
ReadS [CancelWorkflowExecutionFailedEventAttributes]
(Int -> ReadS CancelWorkflowExecutionFailedEventAttributes)
-> ReadS [CancelWorkflowExecutionFailedEventAttributes]
-> ReadPrec CancelWorkflowExecutionFailedEventAttributes
-> ReadPrec [CancelWorkflowExecutionFailedEventAttributes]
-> Read CancelWorkflowExecutionFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelWorkflowExecutionFailedEventAttributes]
$creadListPrec :: ReadPrec [CancelWorkflowExecutionFailedEventAttributes]
readPrec :: ReadPrec CancelWorkflowExecutionFailedEventAttributes
$creadPrec :: ReadPrec CancelWorkflowExecutionFailedEventAttributes
readList :: ReadS [CancelWorkflowExecutionFailedEventAttributes]
$creadList :: ReadS [CancelWorkflowExecutionFailedEventAttributes]
readsPrec :: Int -> ReadS CancelWorkflowExecutionFailedEventAttributes
$creadsPrec :: Int -> ReadS CancelWorkflowExecutionFailedEventAttributes
Prelude.Read, Int -> CancelWorkflowExecutionFailedEventAttributes -> ShowS
[CancelWorkflowExecutionFailedEventAttributes] -> ShowS
CancelWorkflowExecutionFailedEventAttributes -> String
(Int -> CancelWorkflowExecutionFailedEventAttributes -> ShowS)
-> (CancelWorkflowExecutionFailedEventAttributes -> String)
-> ([CancelWorkflowExecutionFailedEventAttributes] -> ShowS)
-> Show CancelWorkflowExecutionFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelWorkflowExecutionFailedEventAttributes] -> ShowS
$cshowList :: [CancelWorkflowExecutionFailedEventAttributes] -> ShowS
show :: CancelWorkflowExecutionFailedEventAttributes -> String
$cshow :: CancelWorkflowExecutionFailedEventAttributes -> String
showsPrec :: Int -> CancelWorkflowExecutionFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> CancelWorkflowExecutionFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 CancelWorkflowExecutionFailedEventAttributes
 -> Rep CancelWorkflowExecutionFailedEventAttributes x)
-> (forall x.
    Rep CancelWorkflowExecutionFailedEventAttributes x
    -> CancelWorkflowExecutionFailedEventAttributes)
-> Generic CancelWorkflowExecutionFailedEventAttributes
forall x.
Rep CancelWorkflowExecutionFailedEventAttributes x
-> CancelWorkflowExecutionFailedEventAttributes
forall x.
CancelWorkflowExecutionFailedEventAttributes
-> Rep CancelWorkflowExecutionFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelWorkflowExecutionFailedEventAttributes x
-> CancelWorkflowExecutionFailedEventAttributes
$cfrom :: forall x.
CancelWorkflowExecutionFailedEventAttributes
-> Rep CancelWorkflowExecutionFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'CancelWorkflowExecutionFailedEventAttributes' 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', 'cancelWorkflowExecutionFailedEventAttributes_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', 'cancelWorkflowExecutionFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelWorkflowExecution@ decision
-- for this cancellation request. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
newCancelWorkflowExecutionFailedEventAttributes ::
  -- | 'cause'
  CancelWorkflowExecutionFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  CancelWorkflowExecutionFailedEventAttributes
newCancelWorkflowExecutionFailedEventAttributes :: CancelWorkflowExecutionFailedCause
-> Integer -> CancelWorkflowExecutionFailedEventAttributes
newCancelWorkflowExecutionFailedEventAttributes
  CancelWorkflowExecutionFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    CancelWorkflowExecutionFailedEventAttributes' :: CancelWorkflowExecutionFailedCause
-> Integer -> CancelWorkflowExecutionFailedEventAttributes
CancelWorkflowExecutionFailedEventAttributes'
      { $sel:cause:CancelWorkflowExecutionFailedEventAttributes' :: CancelWorkflowExecutionFailedCause
cause =
          CancelWorkflowExecutionFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:CancelWorkflowExecutionFailedEventAttributes' :: 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/.
cancelWorkflowExecutionFailedEventAttributes_cause :: Lens.Lens' CancelWorkflowExecutionFailedEventAttributes CancelWorkflowExecutionFailedCause
cancelWorkflowExecutionFailedEventAttributes_cause :: (CancelWorkflowExecutionFailedCause
 -> f CancelWorkflowExecutionFailedCause)
-> CancelWorkflowExecutionFailedEventAttributes
-> f CancelWorkflowExecutionFailedEventAttributes
cancelWorkflowExecutionFailedEventAttributes_cause = (CancelWorkflowExecutionFailedEventAttributes
 -> CancelWorkflowExecutionFailedCause)
-> (CancelWorkflowExecutionFailedEventAttributes
    -> CancelWorkflowExecutionFailedCause
    -> CancelWorkflowExecutionFailedEventAttributes)
-> Lens
     CancelWorkflowExecutionFailedEventAttributes
     CancelWorkflowExecutionFailedEventAttributes
     CancelWorkflowExecutionFailedCause
     CancelWorkflowExecutionFailedCause
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelWorkflowExecutionFailedEventAttributes' {CancelWorkflowExecutionFailedCause
cause :: CancelWorkflowExecutionFailedCause
$sel:cause:CancelWorkflowExecutionFailedEventAttributes' :: CancelWorkflowExecutionFailedEventAttributes
-> CancelWorkflowExecutionFailedCause
cause} -> CancelWorkflowExecutionFailedCause
cause) (\s :: CancelWorkflowExecutionFailedEventAttributes
s@CancelWorkflowExecutionFailedEventAttributes' {} CancelWorkflowExecutionFailedCause
a -> CancelWorkflowExecutionFailedEventAttributes
s {$sel:cause:CancelWorkflowExecutionFailedEventAttributes' :: CancelWorkflowExecutionFailedCause
cause = CancelWorkflowExecutionFailedCause
a} :: CancelWorkflowExecutionFailedEventAttributes)

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

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

instance
  Prelude.NFData
    CancelWorkflowExecutionFailedEventAttributes