{-# 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.LambdaFunctionStartFailedEventDetails
-- 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.LambdaFunctionStartFailedEventDetails 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 to start during an
-- execution.
--
-- /See:/ 'newLambdaFunctionStartFailedEventDetails' smart constructor.
data LambdaFunctionStartFailedEventDetails = LambdaFunctionStartFailedEventDetails'
  { -- | The error code of the failure.
    LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A more detailed explanation of the cause of the failure.
    LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (LambdaFunctionStartFailedEventDetails
-> LambdaFunctionStartFailedEventDetails -> Bool
(LambdaFunctionStartFailedEventDetails
 -> LambdaFunctionStartFailedEventDetails -> Bool)
-> (LambdaFunctionStartFailedEventDetails
    -> LambdaFunctionStartFailedEventDetails -> Bool)
-> Eq LambdaFunctionStartFailedEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionStartFailedEventDetails
-> LambdaFunctionStartFailedEventDetails -> Bool
$c/= :: LambdaFunctionStartFailedEventDetails
-> LambdaFunctionStartFailedEventDetails -> Bool
== :: LambdaFunctionStartFailedEventDetails
-> LambdaFunctionStartFailedEventDetails -> Bool
$c== :: LambdaFunctionStartFailedEventDetails
-> LambdaFunctionStartFailedEventDetails -> Bool
Prelude.Eq, Int -> LambdaFunctionStartFailedEventDetails -> ShowS
[LambdaFunctionStartFailedEventDetails] -> ShowS
LambdaFunctionStartFailedEventDetails -> String
(Int -> LambdaFunctionStartFailedEventDetails -> ShowS)
-> (LambdaFunctionStartFailedEventDetails -> String)
-> ([LambdaFunctionStartFailedEventDetails] -> ShowS)
-> Show LambdaFunctionStartFailedEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionStartFailedEventDetails] -> ShowS
$cshowList :: [LambdaFunctionStartFailedEventDetails] -> ShowS
show :: LambdaFunctionStartFailedEventDetails -> String
$cshow :: LambdaFunctionStartFailedEventDetails -> String
showsPrec :: Int -> LambdaFunctionStartFailedEventDetails -> ShowS
$cshowsPrec :: Int -> LambdaFunctionStartFailedEventDetails -> ShowS
Prelude.Show, (forall x.
 LambdaFunctionStartFailedEventDetails
 -> Rep LambdaFunctionStartFailedEventDetails x)
-> (forall x.
    Rep LambdaFunctionStartFailedEventDetails x
    -> LambdaFunctionStartFailedEventDetails)
-> Generic LambdaFunctionStartFailedEventDetails
forall x.
Rep LambdaFunctionStartFailedEventDetails x
-> LambdaFunctionStartFailedEventDetails
forall x.
LambdaFunctionStartFailedEventDetails
-> Rep LambdaFunctionStartFailedEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionStartFailedEventDetails x
-> LambdaFunctionStartFailedEventDetails
$cfrom :: forall x.
LambdaFunctionStartFailedEventDetails
-> Rep LambdaFunctionStartFailedEventDetails x
Prelude.Generic)

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

-- | The error code of the failure.
lambdaFunctionStartFailedEventDetails_error :: Lens.Lens' LambdaFunctionStartFailedEventDetails (Prelude.Maybe Prelude.Text)
lambdaFunctionStartFailedEventDetails_error :: (Maybe Text -> f (Maybe Text))
-> LambdaFunctionStartFailedEventDetails
-> f LambdaFunctionStartFailedEventDetails
lambdaFunctionStartFailedEventDetails_error = (LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text))
-> (LambdaFunctionStartFailedEventDetails
    -> Maybe (Sensitive Text) -> LambdaFunctionStartFailedEventDetails)
-> Lens
     LambdaFunctionStartFailedEventDetails
     LambdaFunctionStartFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionStartFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
$sel:error:LambdaFunctionStartFailedEventDetails' :: LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text)
error} -> Maybe (Sensitive Text)
error) (\s :: LambdaFunctionStartFailedEventDetails
s@LambdaFunctionStartFailedEventDetails' {} Maybe (Sensitive Text)
a -> LambdaFunctionStartFailedEventDetails
s {$sel:error:LambdaFunctionStartFailedEventDetails' :: Maybe (Sensitive Text)
error = Maybe (Sensitive Text)
a} :: LambdaFunctionStartFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> LambdaFunctionStartFailedEventDetails
 -> f LambdaFunctionStartFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> LambdaFunctionStartFailedEventDetails
-> f LambdaFunctionStartFailedEventDetails
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.
lambdaFunctionStartFailedEventDetails_cause :: Lens.Lens' LambdaFunctionStartFailedEventDetails (Prelude.Maybe Prelude.Text)
lambdaFunctionStartFailedEventDetails_cause :: (Maybe Text -> f (Maybe Text))
-> LambdaFunctionStartFailedEventDetails
-> f LambdaFunctionStartFailedEventDetails
lambdaFunctionStartFailedEventDetails_cause = (LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text))
-> (LambdaFunctionStartFailedEventDetails
    -> Maybe (Sensitive Text) -> LambdaFunctionStartFailedEventDetails)
-> Lens
     LambdaFunctionStartFailedEventDetails
     LambdaFunctionStartFailedEventDetails
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionStartFailedEventDetails' {Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:cause:LambdaFunctionStartFailedEventDetails' :: LambdaFunctionStartFailedEventDetails -> Maybe (Sensitive Text)
cause} -> Maybe (Sensitive Text)
cause) (\s :: LambdaFunctionStartFailedEventDetails
s@LambdaFunctionStartFailedEventDetails' {} Maybe (Sensitive Text)
a -> LambdaFunctionStartFailedEventDetails
s {$sel:cause:LambdaFunctionStartFailedEventDetails' :: Maybe (Sensitive Text)
cause = Maybe (Sensitive Text)
a} :: LambdaFunctionStartFailedEventDetails) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> LambdaFunctionStartFailedEventDetails
 -> f LambdaFunctionStartFailedEventDetails)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> LambdaFunctionStartFailedEventDetails
-> f LambdaFunctionStartFailedEventDetails
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
    LambdaFunctionStartFailedEventDetails
  where
  parseJSON :: Value -> Parser LambdaFunctionStartFailedEventDetails
parseJSON =
    String
-> (Object -> Parser LambdaFunctionStartFailedEventDetails)
-> Value
-> Parser LambdaFunctionStartFailedEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaFunctionStartFailedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> LambdaFunctionStartFailedEventDetails
LambdaFunctionStartFailedEventDetails'
            (Maybe (Sensitive Text)
 -> Maybe (Sensitive Text) -> LambdaFunctionStartFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text) -> LambdaFunctionStartFailedEventDetails)
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) -> LambdaFunctionStartFailedEventDetails)
-> Parser (Maybe (Sensitive Text))
-> Parser LambdaFunctionStartFailedEventDetails
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
    LambdaFunctionStartFailedEventDetails

instance
  Prelude.NFData
    LambdaFunctionStartFailedEventDetails