{-# 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.AuditManager.Types.AssessmentReportEvidenceError
-- 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.AuditManager.Types.AssessmentReportEvidenceError where

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

-- | An error entity for the @AssessmentReportEvidence@ API. This is used to
-- provide more meaningful errors than a simple string message.
--
-- /See:/ 'newAssessmentReportEvidenceError' smart constructor.
data AssessmentReportEvidenceError = AssessmentReportEvidenceError'
  { -- | The error code returned by the @AssessmentReportEvidence@ API.
    AssessmentReportEvidenceError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message returned by the @AssessmentReportEvidence@ API.
    AssessmentReportEvidenceError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the evidence.
    AssessmentReportEvidenceError -> Maybe Text
evidenceId :: Prelude.Maybe Prelude.Text
  }
  deriving (AssessmentReportEvidenceError
-> AssessmentReportEvidenceError -> Bool
(AssessmentReportEvidenceError
 -> AssessmentReportEvidenceError -> Bool)
-> (AssessmentReportEvidenceError
    -> AssessmentReportEvidenceError -> Bool)
-> Eq AssessmentReportEvidenceError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssessmentReportEvidenceError
-> AssessmentReportEvidenceError -> Bool
$c/= :: AssessmentReportEvidenceError
-> AssessmentReportEvidenceError -> Bool
== :: AssessmentReportEvidenceError
-> AssessmentReportEvidenceError -> Bool
$c== :: AssessmentReportEvidenceError
-> AssessmentReportEvidenceError -> Bool
Prelude.Eq, ReadPrec [AssessmentReportEvidenceError]
ReadPrec AssessmentReportEvidenceError
Int -> ReadS AssessmentReportEvidenceError
ReadS [AssessmentReportEvidenceError]
(Int -> ReadS AssessmentReportEvidenceError)
-> ReadS [AssessmentReportEvidenceError]
-> ReadPrec AssessmentReportEvidenceError
-> ReadPrec [AssessmentReportEvidenceError]
-> Read AssessmentReportEvidenceError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssessmentReportEvidenceError]
$creadListPrec :: ReadPrec [AssessmentReportEvidenceError]
readPrec :: ReadPrec AssessmentReportEvidenceError
$creadPrec :: ReadPrec AssessmentReportEvidenceError
readList :: ReadS [AssessmentReportEvidenceError]
$creadList :: ReadS [AssessmentReportEvidenceError]
readsPrec :: Int -> ReadS AssessmentReportEvidenceError
$creadsPrec :: Int -> ReadS AssessmentReportEvidenceError
Prelude.Read, Int -> AssessmentReportEvidenceError -> ShowS
[AssessmentReportEvidenceError] -> ShowS
AssessmentReportEvidenceError -> String
(Int -> AssessmentReportEvidenceError -> ShowS)
-> (AssessmentReportEvidenceError -> String)
-> ([AssessmentReportEvidenceError] -> ShowS)
-> Show AssessmentReportEvidenceError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssessmentReportEvidenceError] -> ShowS
$cshowList :: [AssessmentReportEvidenceError] -> ShowS
show :: AssessmentReportEvidenceError -> String
$cshow :: AssessmentReportEvidenceError -> String
showsPrec :: Int -> AssessmentReportEvidenceError -> ShowS
$cshowsPrec :: Int -> AssessmentReportEvidenceError -> ShowS
Prelude.Show, (forall x.
 AssessmentReportEvidenceError
 -> Rep AssessmentReportEvidenceError x)
-> (forall x.
    Rep AssessmentReportEvidenceError x
    -> AssessmentReportEvidenceError)
-> Generic AssessmentReportEvidenceError
forall x.
Rep AssessmentReportEvidenceError x
-> AssessmentReportEvidenceError
forall x.
AssessmentReportEvidenceError
-> Rep AssessmentReportEvidenceError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssessmentReportEvidenceError x
-> AssessmentReportEvidenceError
$cfrom :: forall x.
AssessmentReportEvidenceError
-> Rep AssessmentReportEvidenceError x
Prelude.Generic)

-- |
-- Create a value of 'AssessmentReportEvidenceError' 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:
--
-- 'errorCode', 'assessmentReportEvidenceError_errorCode' - The error code returned by the @AssessmentReportEvidence@ API.
--
-- 'errorMessage', 'assessmentReportEvidenceError_errorMessage' - The error message returned by the @AssessmentReportEvidence@ API.
--
-- 'evidenceId', 'assessmentReportEvidenceError_evidenceId' - The identifier for the evidence.
newAssessmentReportEvidenceError ::
  AssessmentReportEvidenceError
newAssessmentReportEvidenceError :: AssessmentReportEvidenceError
newAssessmentReportEvidenceError =
  AssessmentReportEvidenceError' :: Maybe Text
-> Maybe Text -> Maybe Text -> AssessmentReportEvidenceError
AssessmentReportEvidenceError'
    { $sel:errorCode:AssessmentReportEvidenceError' :: Maybe Text
errorCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:AssessmentReportEvidenceError' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:evidenceId:AssessmentReportEvidenceError' :: Maybe Text
evidenceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code returned by the @AssessmentReportEvidence@ API.
assessmentReportEvidenceError_errorCode :: Lens.Lens' AssessmentReportEvidenceError (Prelude.Maybe Prelude.Text)
assessmentReportEvidenceError_errorCode :: (Maybe Text -> f (Maybe Text))
-> AssessmentReportEvidenceError -> f AssessmentReportEvidenceError
assessmentReportEvidenceError_errorCode = (AssessmentReportEvidenceError -> Maybe Text)
-> (AssessmentReportEvidenceError
    -> Maybe Text -> AssessmentReportEvidenceError)
-> Lens
     AssessmentReportEvidenceError
     AssessmentReportEvidenceError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentReportEvidenceError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:AssessmentReportEvidenceError' :: AssessmentReportEvidenceError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: AssessmentReportEvidenceError
s@AssessmentReportEvidenceError' {} Maybe Text
a -> AssessmentReportEvidenceError
s {$sel:errorCode:AssessmentReportEvidenceError' :: Maybe Text
errorCode = Maybe Text
a} :: AssessmentReportEvidenceError)

-- | The error message returned by the @AssessmentReportEvidence@ API.
assessmentReportEvidenceError_errorMessage :: Lens.Lens' AssessmentReportEvidenceError (Prelude.Maybe Prelude.Text)
assessmentReportEvidenceError_errorMessage :: (Maybe Text -> f (Maybe Text))
-> AssessmentReportEvidenceError -> f AssessmentReportEvidenceError
assessmentReportEvidenceError_errorMessage = (AssessmentReportEvidenceError -> Maybe Text)
-> (AssessmentReportEvidenceError
    -> Maybe Text -> AssessmentReportEvidenceError)
-> Lens
     AssessmentReportEvidenceError
     AssessmentReportEvidenceError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentReportEvidenceError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:AssessmentReportEvidenceError' :: AssessmentReportEvidenceError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: AssessmentReportEvidenceError
s@AssessmentReportEvidenceError' {} Maybe Text
a -> AssessmentReportEvidenceError
s {$sel:errorMessage:AssessmentReportEvidenceError' :: Maybe Text
errorMessage = Maybe Text
a} :: AssessmentReportEvidenceError)

-- | The identifier for the evidence.
assessmentReportEvidenceError_evidenceId :: Lens.Lens' AssessmentReportEvidenceError (Prelude.Maybe Prelude.Text)
assessmentReportEvidenceError_evidenceId :: (Maybe Text -> f (Maybe Text))
-> AssessmentReportEvidenceError -> f AssessmentReportEvidenceError
assessmentReportEvidenceError_evidenceId = (AssessmentReportEvidenceError -> Maybe Text)
-> (AssessmentReportEvidenceError
    -> Maybe Text -> AssessmentReportEvidenceError)
-> Lens
     AssessmentReportEvidenceError
     AssessmentReportEvidenceError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssessmentReportEvidenceError' {Maybe Text
evidenceId :: Maybe Text
$sel:evidenceId:AssessmentReportEvidenceError' :: AssessmentReportEvidenceError -> Maybe Text
evidenceId} -> Maybe Text
evidenceId) (\s :: AssessmentReportEvidenceError
s@AssessmentReportEvidenceError' {} Maybe Text
a -> AssessmentReportEvidenceError
s {$sel:evidenceId:AssessmentReportEvidenceError' :: Maybe Text
evidenceId = Maybe Text
a} :: AssessmentReportEvidenceError)

instance Core.FromJSON AssessmentReportEvidenceError where
  parseJSON :: Value -> Parser AssessmentReportEvidenceError
parseJSON =
    String
-> (Object -> Parser AssessmentReportEvidenceError)
-> Value
-> Parser AssessmentReportEvidenceError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssessmentReportEvidenceError"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> AssessmentReportEvidenceError
AssessmentReportEvidenceError'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> AssessmentReportEvidenceError)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AssessmentReportEvidenceError)
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
"errorCode")
            Parser (Maybe Text -> Maybe Text -> AssessmentReportEvidenceError)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AssessmentReportEvidenceError)
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
"errorMessage")
            Parser (Maybe Text -> AssessmentReportEvidenceError)
-> Parser (Maybe Text) -> Parser AssessmentReportEvidenceError
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
"evidenceId")
      )

instance
  Prelude.Hashable
    AssessmentReportEvidenceError

instance Prelude.NFData AssessmentReportEvidenceError