{-# 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-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.ScheduleLambdaFunctionFailedEventAttributes 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.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
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]
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
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.
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'
      { $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 :: Lens' ScheduleLambdaFunctionFailedEventAttributes Text
scheduleLambdaFunctionFailedEventAttributes_id = 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 :: Lens' ScheduleLambdaFunctionFailedEventAttributes Text
scheduleLambdaFunctionFailedEventAttributes_name = 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 :: Lens'
  ScheduleLambdaFunctionFailedEventAttributes
  ScheduleLambdaFunctionFailedCause
scheduleLambdaFunctionFailedEventAttributes_cause = 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 :: Lens' ScheduleLambdaFunctionFailedEventAttributes Integer
scheduleLambdaFunctionFailedEventAttributes_decisionTaskCompletedEventId = 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
  Data.FromJSON
    ScheduleLambdaFunctionFailedEventAttributes
  where
  parseJSON :: Value -> Parser ScheduleLambdaFunctionFailedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScheduleLambdaFunctionFailedEventAttributes"
      ( \Object
x ->
          Text
-> Text
-> ScheduleLambdaFunctionFailedCause
-> Integer
-> ScheduleLambdaFunctionFailedEventAttributes
ScheduleLambdaFunctionFailedEventAttributes'
            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
"id")
            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
"name")
            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
"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
    ScheduleLambdaFunctionFailedEventAttributes
  where
  hashWithSalt :: Int -> ScheduleLambdaFunctionFailedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ScheduleLambdaFunctionFailedEventAttributes' {Integer
Text
ScheduleLambdaFunctionFailedCause
decisionTaskCompletedEventId :: Integer
cause :: ScheduleLambdaFunctionFailedCause
name :: Text
id :: Text
$sel:decisionTaskCompletedEventId:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Integer
$sel:cause:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedCause
$sel:name:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
$sel:id:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScheduleLambdaFunctionFailedCause
cause
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
decisionTaskCompletedEventId

instance
  Prelude.NFData
    ScheduleLambdaFunctionFailedEventAttributes
  where
  rnf :: ScheduleLambdaFunctionFailedEventAttributes -> ()
rnf ScheduleLambdaFunctionFailedEventAttributes' {Integer
Text
ScheduleLambdaFunctionFailedCause
decisionTaskCompletedEventId :: Integer
cause :: ScheduleLambdaFunctionFailedCause
name :: Text
id :: Text
$sel:decisionTaskCompletedEventId:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Integer
$sel:cause:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes
-> ScheduleLambdaFunctionFailedCause
$sel:name:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
$sel:id:ScheduleLambdaFunctionFailedEventAttributes' :: ScheduleLambdaFunctionFailedEventAttributes -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScheduleLambdaFunctionFailedCause
cause
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
decisionTaskCompletedEventId