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

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

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

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

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

instance Prelude.NFData ExecutionAbortedEventDetails