{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.StepFunctions.Types.ActivityFailedEventDetails 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

-- | Contains details about an activity that failed during an execution.
--
-- /See:/ 'newActivityFailedEventDetails' smart constructor.
data ActivityFailedEventDetails = ActivityFailedEventDetails'
  { -- | A more detailed explanation of the cause of the failure.
    ActivityFailedEventDetails -> Maybe (Sensitive Text)
cause :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The error code of the failure.
    ActivityFailedEventDetails -> Maybe (Sensitive Text)
error :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (ActivityFailedEventDetails -> ActivityFailedEventDetails -> Bool
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
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.
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:
--
-- 'cause', 'activityFailedEventDetails_cause' - A more detailed explanation of the cause of the failure.
--
-- 'error', 'activityFailedEventDetails_error' - The error code of the failure.
newActivityFailedEventDetails ::
  ActivityFailedEventDetails
newActivityFailedEventDetails :: ActivityFailedEventDetails
newActivityFailedEventDetails =
  ActivityFailedEventDetails'
    { $sel:cause:ActivityFailedEventDetails' :: Maybe (Sensitive Text)
cause =
        forall a. Maybe a
Prelude.Nothing,
      $sel:error:ActivityFailedEventDetails' :: Maybe (Sensitive Text)
error = forall a. Maybe a
Prelude.Nothing
    }

-- | A more detailed explanation of the cause of the failure.
activityFailedEventDetails_cause :: Lens.Lens' ActivityFailedEventDetails (Prelude.Maybe Prelude.Text)
activityFailedEventDetails_cause :: Lens' ActivityFailedEventDetails (Maybe Text)
activityFailedEventDetails_cause = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The error code of the failure.
activityFailedEventDetails_error :: Lens.Lens' ActivityFailedEventDetails (Prelude.Maybe Prelude.Text)
activityFailedEventDetails_error :: Lens' ActivityFailedEventDetails (Maybe Text)
activityFailedEventDetails_error = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON ActivityFailedEventDetails where
  parseJSON :: Value -> Parser ActivityFailedEventDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActivityFailedEventDetails"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> ActivityFailedEventDetails
ActivityFailedEventDetails'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe 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 (Maybe a)
Data..:? Key
"error")
      )

instance Prelude.Hashable ActivityFailedEventDetails where
  hashWithSalt :: Int -> ActivityFailedEventDetails -> Int
hashWithSalt Int
_salt ActivityFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:error:ActivityFailedEventDetails' :: ActivityFailedEventDetails -> Maybe (Sensitive Text)
$sel:cause:ActivityFailedEventDetails' :: ActivityFailedEventDetails -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
cause
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
error

instance Prelude.NFData ActivityFailedEventDetails where
  rnf :: ActivityFailedEventDetails -> ()
rnf ActivityFailedEventDetails' {Maybe (Sensitive Text)
error :: Maybe (Sensitive Text)
cause :: Maybe (Sensitive Text)
$sel:error:ActivityFailedEventDetails' :: ActivityFailedEventDetails -> Maybe (Sensitive Text)
$sel:cause:ActivityFailedEventDetails' :: ActivityFailedEventDetails -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
cause seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
error