{-# 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.StepFunctions.Types.LambdaFunctionFailedEventDetails
-- 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.StepFunctions.Types.LambdaFunctionFailedEventDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains details about a lambda function that failed during an
-- execution.
--
-- /See:/ 'newLambdaFunctionFailedEventDetails' smart constructor.
data LambdaFunctionFailedEventDetails = LambdaFunctionFailedEventDetails'
  { -- | The error code of the failure.
    LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A more detailed explanation of the cause of the failure.
    LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (LambdaFunctionFailedEventDetails
-> LambdaFunctionFailedEventDetails -> Bool
(LambdaFunctionFailedEventDetails
 -> LambdaFunctionFailedEventDetails -> Bool)
-> (LambdaFunctionFailedEventDetails
    -> LambdaFunctionFailedEventDetails -> Bool)
-> Eq LambdaFunctionFailedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionFailedEventDetails
-> LambdaFunctionFailedEventDetails -> Bool
$c/= :: LambdaFunctionFailedEventDetails
-> LambdaFunctionFailedEventDetails -> Bool
== :: LambdaFunctionFailedEventDetails
-> LambdaFunctionFailedEventDetails -> Bool
$c== :: LambdaFunctionFailedEventDetails
-> LambdaFunctionFailedEventDetails -> Bool
Prelude.Eq, Int -> LambdaFunctionFailedEventDetails -> ShowS
[LambdaFunctionFailedEventDetails] -> ShowS
LambdaFunctionFailedEventDetails -> String
(Int -> LambdaFunctionFailedEventDetails -> ShowS)
-> (LambdaFunctionFailedEventDetails -> String)
-> ([LambdaFunctionFailedEventDetails] -> ShowS)
-> Show LambdaFunctionFailedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionFailedEventDetails] -> ShowS
$cshowList :: [LambdaFunctionFailedEventDetails] -> ShowS
show :: LambdaFunctionFailedEventDetails -> String
$cshow :: LambdaFunctionFailedEventDetails -> String
showsPrec :: Int -> LambdaFunctionFailedEventDetails -> ShowS
$cshowsPrec :: Int -> LambdaFunctionFailedEventDetails -> ShowS
Prelude.Show, (forall x.
 LambdaFunctionFailedEventDetails
 -> Rep LambdaFunctionFailedEventDetails x)
-> (forall x.
    Rep LambdaFunctionFailedEventDetails x
    -> LambdaFunctionFailedEventDetails)
-> Generic LambdaFunctionFailedEventDetails
forall x.
Rep LambdaFunctionFailedEventDetails x
-> LambdaFunctionFailedEventDetails
forall x.
LambdaFunctionFailedEventDetails
-> Rep LambdaFunctionFailedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionFailedEventDetails x
-> LambdaFunctionFailedEventDetails
$cfrom :: forall x.
LambdaFunctionFailedEventDetails
-> Rep LambdaFunctionFailedEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionFailedEventDetails' 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:
--
-- 'error', 'lambdaFunctionFailedEventDetails_error' - The error code of the failure.
--
-- 'cause', 'lambdaFunctionFailedEventDetails_cause' - A more detailed explanation of the cause of the failure.
newLambdaFunctionFailedEventDetails ::
  LambdaFunctionFailedEventDetails
newLambdaFunctionFailedEventDetails :: LambdaFunctionFailedEventDetails
newLambdaFunctionFailedEventDetails =
  LambdaFunctionFailedEventDetails' :: Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails
LambdaFunctionFailedEventDetails'
    { $sel:error:LambdaFunctionFailedEventDetails' :: Maybe (Sensitive Text)
error =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:cause:LambdaFunctionFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code of the failure.
lambdaFunctionFailedEventDetails_error :: Lens.Lens' LambdaFunctionFailedEventDetails (Prelude.Maybe Prelude.Text)
lambdaFunctionFailedEventDetails_error :: (Maybe Text -> f (Maybe Text))
-> LambdaFunctionFailedEventDetails
-> f LambdaFunctionFailedEventDetails
lambdaFunctionFailedEventDetails_error = (LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text))
-> (LambdaFunctionFailedEventDetails
    -> Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails)
-> Lens
     LambdaFunctionFailedEventDetails
     LambdaFunctionFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:error:LambdaFunctionFailedEventDetails' :: LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text)
error} -> Maybe (Sensitive Text)
error) (\s :: LambdaFunctionFailedEventDetails
s@LambdaFunctionFailedEventDetails' {} Maybe (Sensitive Text)
a -> LambdaFunctionFailedEventDetails
s {$sel:error:LambdaFunctionFailedEventDetails' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
a} :: LambdaFunctionFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> LambdaFunctionFailedEventDetails
 -> f LambdaFunctionFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> LambdaFunctionFailedEventDetails
-> f LambdaFunctionFailedEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A more detailed explanation of the cause of the failure.
lambdaFunctionFailedEventDetails_cause :: Lens.Lens' LambdaFunctionFailedEventDetails (Prelude.Maybe Prelude.Text)
lambdaFunctionFailedEventDetails_cause :: (Maybe Text -> f (Maybe Text))
-> LambdaFunctionFailedEventDetails
-> f LambdaFunctionFailedEventDetails
lambdaFunctionFailedEventDetails_cause = (LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text))
-> (LambdaFunctionFailedEventDetails
    -> Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails)
-> Lens
     LambdaFunctionFailedEventDetails
     LambdaFunctionFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionFailedEventDetails' {Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:cause:LambdaFunctionFailedEventDetails' :: LambdaFunctionFailedEventDetails -> Maybe (Sensitive Text)
cause} -> Maybe (Sensitive Text)
cause) (\s :: LambdaFunctionFailedEventDetails
s@LambdaFunctionFailedEventDetails' {} Maybe (Sensitive Text)
a -> LambdaFunctionFailedEventDetails
s {$sel:cause:LambdaFunctionFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
a} :: LambdaFunctionFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> LambdaFunctionFailedEventDetails
 -> f LambdaFunctionFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> LambdaFunctionFailedEventDetails
-> f LambdaFunctionFailedEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance
  Core.FromJSON
    LambdaFunctionFailedEventDetails
  where
  parseJSON :: Value -> Parser LambdaFunctionFailedEventDetails
parseJSON =
    String
-> (Object -> Parser LambdaFunctionFailedEventDetails)
-> Value
-> Parser LambdaFunctionFailedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaFunctionFailedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails
LambdaFunctionFailedEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"error")
            Parser (Maybe (Sensitive Text) -> LambdaFunctionFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser LambdaFunctionFailedEventDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cause")
      )

instance
  Prelude.Hashable
    LambdaFunctionFailedEventDetails

instance
  Prelude.NFData
    LambdaFunctionFailedEventDetails