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

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

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

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

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

instance Prelude.NFData ActivityFailedEventDetails