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

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

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

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

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

instance
  Prelude.NFData
    ActivityScheduleFailedEventDetails