{-# 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.DynamoDB.Types.FailureException
-- 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.DynamoDB.Types.FailureException where

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

-- | Represents a failure a contributor insights operation.
--
-- /See:/ 'newFailureException' smart constructor.
data FailureException = FailureException'
  { -- | Exception name.
    FailureException -> Maybe Text
exceptionName :: Prelude.Maybe Prelude.Text,
    -- | Description of the failure.
    FailureException -> Maybe Text
exceptionDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (FailureException -> FailureException -> Bool
(FailureException -> FailureException -> Bool)
-> (FailureException -> FailureException -> Bool)
-> Eq FailureException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailureException -> FailureException -> Bool
$c/= :: FailureException -> FailureException -> Bool
== :: FailureException -> FailureException -> Bool
$c== :: FailureException -> FailureException -> Bool
Prelude.Eq, ReadPrec [FailureException]
ReadPrec FailureException
Int -> ReadS FailureException
ReadS [FailureException]
(Int -> ReadS FailureException)
-> ReadS [FailureException]
-> ReadPrec FailureException
-> ReadPrec [FailureException]
-> Read FailureException
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailureException]
$creadListPrec :: ReadPrec [FailureException]
readPrec :: ReadPrec FailureException
$creadPrec :: ReadPrec FailureException
readList :: ReadS [FailureException]
$creadList :: ReadS [FailureException]
readsPrec :: Int -> ReadS FailureException
$creadsPrec :: Int -> ReadS FailureException
Prelude.Read, Int -> FailureException -> ShowS
[FailureException] -> ShowS
FailureException -> String
(Int -> FailureException -> ShowS)
-> (FailureException -> String)
-> ([FailureException] -> ShowS)
-> Show FailureException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailureException] -> ShowS
$cshowList :: [FailureException] -> ShowS
show :: FailureException -> String
$cshow :: FailureException -> String
showsPrec :: Int -> FailureException -> ShowS
$cshowsPrec :: Int -> FailureException -> ShowS
Prelude.Show, (forall x. FailureException -> Rep FailureException x)
-> (forall x. Rep FailureException x -> FailureException)
-> Generic FailureException
forall x. Rep FailureException x -> FailureException
forall x. FailureException -> Rep FailureException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailureException x -> FailureException
$cfrom :: forall x. FailureException -> Rep FailureException x
Prelude.Generic)

-- |
-- Create a value of 'FailureException' 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:
--
-- 'exceptionName', 'failureException_exceptionName' - Exception name.
--
-- 'exceptionDescription', 'failureException_exceptionDescription' - Description of the failure.
newFailureException ::
  FailureException
newFailureException :: FailureException
newFailureException =
  FailureException' :: Maybe Text -> Maybe Text -> FailureException
FailureException'
    { $sel:exceptionName:FailureException' :: Maybe Text
exceptionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:exceptionDescription:FailureException' :: Maybe Text
exceptionDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Exception name.
failureException_exceptionName :: Lens.Lens' FailureException (Prelude.Maybe Prelude.Text)
failureException_exceptionName :: (Maybe Text -> f (Maybe Text))
-> FailureException -> f FailureException
failureException_exceptionName = (FailureException -> Maybe Text)
-> (FailureException -> Maybe Text -> FailureException)
-> Lens FailureException FailureException (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailureException' {Maybe Text
exceptionName :: Maybe Text
$sel:exceptionName:FailureException' :: FailureException -> Maybe Text
exceptionName} -> Maybe Text
exceptionName) (\s :: FailureException
s@FailureException' {} Maybe Text
a -> FailureException
s {$sel:exceptionName:FailureException' :: Maybe Text
exceptionName = Maybe Text
a} :: FailureException)

-- | Description of the failure.
failureException_exceptionDescription :: Lens.Lens' FailureException (Prelude.Maybe Prelude.Text)
failureException_exceptionDescription :: (Maybe Text -> f (Maybe Text))
-> FailureException -> f FailureException
failureException_exceptionDescription = (FailureException -> Maybe Text)
-> (FailureException -> Maybe Text -> FailureException)
-> Lens FailureException FailureException (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailureException' {Maybe Text
exceptionDescription :: Maybe Text
$sel:exceptionDescription:FailureException' :: FailureException -> Maybe Text
exceptionDescription} -> Maybe Text
exceptionDescription) (\s :: FailureException
s@FailureException' {} Maybe Text
a -> FailureException
s {$sel:exceptionDescription:FailureException' :: Maybe Text
exceptionDescription = Maybe Text
a} :: FailureException)

instance Core.FromJSON FailureException where
  parseJSON :: Value -> Parser FailureException
parseJSON =
    String
-> (Object -> Parser FailureException)
-> Value
-> Parser FailureException
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FailureException"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> FailureException
FailureException'
            (Maybe Text -> Maybe Text -> FailureException)
-> Parser (Maybe Text) -> Parser (Maybe Text -> FailureException)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExceptionName")
            Parser (Maybe Text -> FailureException)
-> Parser (Maybe Text) -> Parser FailureException
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExceptionDescription")
      )

instance Prelude.Hashable FailureException

instance Prelude.NFData FailureException