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

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

-- | Provides the details of the @ScheduleLambdaFunctionFailed@ event. It
-- isn\'t set for other event types.
--
-- /See:/ 'newScheduleLambdaFunctionFailedEventAttributes' smart constructor.
data ScheduleLambdaFunctionFailedEventAttributes = ScheduleLambdaFunctionFailedEventAttributes'
  { -- | The ID provided in the @ScheduleLambdaFunction@ decision that failed.
    ScheduleLambdaFunctionFailedEventAttributes -> Text
id :: Prelude.Text,
    -- | The name of the Lambda function.
    ScheduleLambdaFunctionFailedEventAttributes -> Text
name :: Prelude.Text,
    -- | The cause of the failure. To help diagnose issues, use this information
    -- to trace back the chain of events leading up to this event.
    --
    -- 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/.
    ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedCause
cause :: ScheduleLambdaFunctionFailedCause,
    -- | The ID of the @LambdaFunctionCompleted@ event corresponding to the
    -- decision that resulted in scheduling this Lambda task. To help diagnose
    -- issues, use this information to trace back the chain of events leading
    -- up to this event.
    ScheduleLambdaFunctionFailedEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedEventAttributes -> Bool
(ScheduleLambdaFunctionFailedEventAttributes
 -> ScheduleLambdaFunctionFailedEventAttributes -> Bool)
-> (ScheduleLambdaFunctionFailedEventAttributes
    -> ScheduleLambdaFunctionFailedEventAttributes -> Bool)
-> Eq ScheduleLambdaFunctionFailedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedEventAttributes -> Bool
$c/= :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedEventAttributes -> Bool
== :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedEventAttributes -> Bool
$c== :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ScheduleLambdaFunctionFailedEventAttributes]
ReadPrec ScheduleLambdaFunctionFailedEventAttributes
Int -> ReadS ScheduleLambdaFunctionFailedEventAttributes
ReadS [ScheduleLambdaFunctionFailedEventAttributes]
(Int -> ReadS ScheduleLambdaFunctionFailedEventAttributes)
-> ReadS [ScheduleLambdaFunctionFailedEventAttributes]
-> ReadPrec ScheduleLambdaFunctionFailedEventAttributes
-> ReadPrec [ScheduleLambdaFunctionFailedEventAttributes]
-> Read ScheduleLambdaFunctionFailedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleLambdaFunctionFailedEventAttributes]
$creadListPrec :: ReadPrec [ScheduleLambdaFunctionFailedEventAttributes]
readPrec :: ReadPrec ScheduleLambdaFunctionFailedEventAttributes
$creadPrec :: ReadPrec ScheduleLambdaFunctionFailedEventAttributes
readList :: ReadS [ScheduleLambdaFunctionFailedEventAttributes]
$creadList :: ReadS [ScheduleLambdaFunctionFailedEventAttributes]
readsPrec :: Int -> ReadS ScheduleLambdaFunctionFailedEventAttributes
$creadsPrec :: Int -> ReadS ScheduleLambdaFunctionFailedEventAttributes
Prelude.Read, Int -> ScheduleLambdaFunctionFailedEventAttributes -> ShowS
[ScheduleLambdaFunctionFailedEventAttributes] -> ShowS
ScheduleLambdaFunctionFailedEventAttributes -> String
(Int -> ScheduleLambdaFunctionFailedEventAttributes -> ShowS)
-> (ScheduleLambdaFunctionFailedEventAttributes -> String)
-> ([ScheduleLambdaFunctionFailedEventAttributes] -> ShowS)
-> Show ScheduleLambdaFunctionFailedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleLambdaFunctionFailedEventAttributes] -> ShowS
$cshowList :: [ScheduleLambdaFunctionFailedEventAttributes] -> ShowS
show :: ScheduleLambdaFunctionFailedEventAttributes -> String
$cshow :: ScheduleLambdaFunctionFailedEventAttributes -> String
showsPrec :: Int -> ScheduleLambdaFunctionFailedEventAttributes -> ShowS
$cshowsPrec :: Int -> ScheduleLambdaFunctionFailedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ScheduleLambdaFunctionFailedEventAttributes
 -> Rep ScheduleLambdaFunctionFailedEventAttributes x)
-> (forall x.
    Rep ScheduleLambdaFunctionFailedEventAttributes x
    -> ScheduleLambdaFunctionFailedEventAttributes)
-> Generic ScheduleLambdaFunctionFailedEventAttributes
forall x.
Rep ScheduleLambdaFunctionFailedEventAttributes x
-> ScheduleLambdaFunctionFailedEventAttributes
forall x.
ScheduleLambdaFunctionFailedEventAttributes
-> Rep ScheduleLambdaFunctionFailedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduleLambdaFunctionFailedEventAttributes x
-> ScheduleLambdaFunctionFailedEventAttributes
$cfrom :: forall x.
ScheduleLambdaFunctionFailedEventAttributes
-> Rep ScheduleLambdaFunctionFailedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleLambdaFunctionFailedEventAttributes' 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:
--
-- 'id', 'scheduleLambdaFunctionFailedEventAttributes_id' - The ID provided in the @ScheduleLambdaFunction@ decision that failed.
--
-- 'name', 'scheduleLambdaFunctionFailedEventAttributes_name' - The name of the Lambda function.
--
-- 'cause', 'scheduleLambdaFunctionFailedEventAttributes_cause' - The cause of the failure. To help diagnose issues, use this information
-- to trace back the chain of events leading up to this event.
--
-- 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', 'scheduleLambdaFunctionFailedEventAttributes_decisionTaskCompletedEventId' - The ID of the @LambdaFunctionCompleted@ event corresponding to the
-- decision that resulted in scheduling this Lambda task. To help diagnose
-- issues, use this information to trace back the chain of events leading
-- up to this event.
newScheduleLambdaFunctionFailedEventAttributes ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'cause'
  ScheduleLambdaFunctionFailedCause ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  ScheduleLambdaFunctionFailedEventAttributes
newScheduleLambdaFunctionFailedEventAttributes :: Text
-> Text
-> ScheduleLambdaFunctionFailedCause
-> Integer
-> ScheduleLambdaFunctionFailedEventAttributes
newScheduleLambdaFunctionFailedEventAttributes
  Text
pId_
  Text
pName_
  ScheduleLambdaFunctionFailedCause
pCause_
  Integer
pDecisionTaskCompletedEventId_ =
    ScheduleLambdaFunctionFailedEventAttributes' :: Text
-> Text
-> ScheduleLambdaFunctionFailedCause
-> Integer
-> ScheduleLambdaFunctionFailedEventAttributes
ScheduleLambdaFunctionFailedEventAttributes'
      { $sel:id:ScheduleLambdaFunctionFailedEventAttributes' :: Text
id =
          Text
pId_,
        $sel:name:ScheduleLambdaFunctionFailedEventAttributes' :: Text
name = Text
pName_,
        $sel:cause:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedCause
cause = ScheduleLambdaFunctionFailedCause
pCause_,
        $sel:decisionTaskCompletedEventId:ScheduleLambdaFunctionFailedEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

-- | The ID provided in the @ScheduleLambdaFunction@ decision that failed.
scheduleLambdaFunctionFailedEventAttributes_id :: Lens.Lens' ScheduleLambdaFunctionFailedEventAttributes Prelude.Text
scheduleLambdaFunctionFailedEventAttributes_id :: (Text -> f Text)
-> ScheduleLambdaFunctionFailedEventAttributes
-> f ScheduleLambdaFunctionFailedEventAttributes
scheduleLambdaFunctionFailedEventAttributes_id = (ScheduleLambdaFunctionFailedEventAttributes -> Text)
-> (ScheduleLambdaFunctionFailedEventAttributes
    -> Text -> ScheduleLambdaFunctionFailedEventAttributes)
-> Lens
     ScheduleLambdaFunctionFailedEventAttributes
     ScheduleLambdaFunctionFailedEventAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionFailedEventAttributes' {Text
id :: Text
$sel:id:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
id} -> Text
id) (\s :: ScheduleLambdaFunctionFailedEventAttributes
s@ScheduleLambdaFunctionFailedEventAttributes' {} Text
a -> ScheduleLambdaFunctionFailedEventAttributes
s {$sel:id:ScheduleLambdaFunctionFailedEventAttributes' :: Text
id = Text
a} :: ScheduleLambdaFunctionFailedEventAttributes)

-- | The name of the Lambda function.
scheduleLambdaFunctionFailedEventAttributes_name :: Lens.Lens' ScheduleLambdaFunctionFailedEventAttributes Prelude.Text
scheduleLambdaFunctionFailedEventAttributes_name :: (Text -> f Text)
-> ScheduleLambdaFunctionFailedEventAttributes
-> f ScheduleLambdaFunctionFailedEventAttributes
scheduleLambdaFunctionFailedEventAttributes_name = (ScheduleLambdaFunctionFailedEventAttributes -> Text)
-> (ScheduleLambdaFunctionFailedEventAttributes
    -> Text -> ScheduleLambdaFunctionFailedEventAttributes)
-> Lens
     ScheduleLambdaFunctionFailedEventAttributes
     ScheduleLambdaFunctionFailedEventAttributes
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionFailedEventAttributes' {Text
name :: Text
$sel:name:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
name} -> Text
name) (\s :: ScheduleLambdaFunctionFailedEventAttributes
s@ScheduleLambdaFunctionFailedEventAttributes' {} Text
a -> ScheduleLambdaFunctionFailedEventAttributes
s {$sel:name:ScheduleLambdaFunctionFailedEventAttributes' :: Text
name = Text
a} :: ScheduleLambdaFunctionFailedEventAttributes)

-- | The cause of the failure. To help diagnose issues, use this information
-- to trace back the chain of events leading up to this event.
--
-- 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/.
scheduleLambdaFunctionFailedEventAttributes_cause :: Lens.Lens' ScheduleLambdaFunctionFailedEventAttributes ScheduleLambdaFunctionFailedCause
scheduleLambdaFunctionFailedEventAttributes_cause :: (ScheduleLambdaFunctionFailedCause
 -> f ScheduleLambdaFunctionFailedCause)
-> ScheduleLambdaFunctionFailedEventAttributes
-> f ScheduleLambdaFunctionFailedEventAttributes
scheduleLambdaFunctionFailedEventAttributes_cause = (ScheduleLambdaFunctionFailedEventAttributes
 -> ScheduleLambdaFunctionFailedCause)
-> (ScheduleLambdaFunctionFailedEventAttributes
    -> ScheduleLambdaFunctionFailedCause
    -> ScheduleLambdaFunctionFailedEventAttributes)
-> Lens
     ScheduleLambdaFunctionFailedEventAttributes
     ScheduleLambdaFunctionFailedEventAttributes
     ScheduleLambdaFunctionFailedCause
     ScheduleLambdaFunctionFailedCause
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionFailedEventAttributes' {ScheduleLambdaFunctionFailedCause
cause :: ScheduleLambdaFunctionFailedCause
$sel:cause:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedCause
cause} -> ScheduleLambdaFunctionFailedCause
cause) (\s :: ScheduleLambdaFunctionFailedEventAttributes
s@ScheduleLambdaFunctionFailedEventAttributes' {} ScheduleLambdaFunctionFailedCause
a -> ScheduleLambdaFunctionFailedEventAttributes
s {$sel:cause:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedCause
cause = ScheduleLambdaFunctionFailedCause
a} :: ScheduleLambdaFunctionFailedEventAttributes)

-- | The ID of the @LambdaFunctionCompleted@ event corresponding to the
-- decision that resulted in scheduling this Lambda task. To help diagnose
-- issues, use this information to trace back the chain of events leading
-- up to this event.
scheduleLambdaFunctionFailedEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' ScheduleLambdaFunctionFailedEventAttributes Prelude.Integer
scheduleLambdaFunctionFailedEventAttributes_decisionTaskCompletedEventId :: (Integer -> f Integer)
-> ScheduleLambdaFunctionFailedEventAttributes
-> f ScheduleLambdaFunctionFailedEventAttributes
scheduleLambdaFunctionFailedEventAttributes_decisionTaskCompletedEventId = (ScheduleLambdaFunctionFailedEventAttributes -> Integer)
-> (ScheduleLambdaFunctionFailedEventAttributes
    -> Integer -> ScheduleLambdaFunctionFailedEventAttributes)
-> Lens
     ScheduleLambdaFunctionFailedEventAttributes
     ScheduleLambdaFunctionFailedEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleLambdaFunctionFailedEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: ScheduleLambdaFunctionFailedEventAttributes
s@ScheduleLambdaFunctionFailedEventAttributes' {} Integer
a -> ScheduleLambdaFunctionFailedEventAttributes
s {$sel:decisionTaskCompletedEventId:ScheduleLambdaFunctionFailedEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: ScheduleLambdaFunctionFailedEventAttributes)

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

instance
  Prelude.NFData
    ScheduleLambdaFunctionFailedEventAttributes