{-# 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.SecretsManager.Types.ValidationErrorsEntry
-- 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.SecretsManager.Types.ValidationErrorsEntry where

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

-- | Displays errors that occurred during validation of the resource policy.
--
-- /See:/ 'newValidationErrorsEntry' smart constructor.
data ValidationErrorsEntry = ValidationErrorsEntry'
  { -- | Checks the name of the policy.
    ValidationErrorsEntry -> Maybe Text
checkName :: Prelude.Maybe Prelude.Text,
    -- | Displays error messages if validation encounters problems during
    -- validation of the resource policy.
    ValidationErrorsEntry -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (ValidationErrorsEntry -> ValidationErrorsEntry -> Bool
(ValidationErrorsEntry -> ValidationErrorsEntry -> Bool)
-> (ValidationErrorsEntry -> ValidationErrorsEntry -> Bool)
-> Eq ValidationErrorsEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationErrorsEntry -> ValidationErrorsEntry -> Bool
$c/= :: ValidationErrorsEntry -> ValidationErrorsEntry -> Bool
== :: ValidationErrorsEntry -> ValidationErrorsEntry -> Bool
$c== :: ValidationErrorsEntry -> ValidationErrorsEntry -> Bool
Prelude.Eq, ReadPrec [ValidationErrorsEntry]
ReadPrec ValidationErrorsEntry
Int -> ReadS ValidationErrorsEntry
ReadS [ValidationErrorsEntry]
(Int -> ReadS ValidationErrorsEntry)
-> ReadS [ValidationErrorsEntry]
-> ReadPrec ValidationErrorsEntry
-> ReadPrec [ValidationErrorsEntry]
-> Read ValidationErrorsEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidationErrorsEntry]
$creadListPrec :: ReadPrec [ValidationErrorsEntry]
readPrec :: ReadPrec ValidationErrorsEntry
$creadPrec :: ReadPrec ValidationErrorsEntry
readList :: ReadS [ValidationErrorsEntry]
$creadList :: ReadS [ValidationErrorsEntry]
readsPrec :: Int -> ReadS ValidationErrorsEntry
$creadsPrec :: Int -> ReadS ValidationErrorsEntry
Prelude.Read, Int -> ValidationErrorsEntry -> ShowS
[ValidationErrorsEntry] -> ShowS
ValidationErrorsEntry -> String
(Int -> ValidationErrorsEntry -> ShowS)
-> (ValidationErrorsEntry -> String)
-> ([ValidationErrorsEntry] -> ShowS)
-> Show ValidationErrorsEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidationErrorsEntry] -> ShowS
$cshowList :: [ValidationErrorsEntry] -> ShowS
show :: ValidationErrorsEntry -> String
$cshow :: ValidationErrorsEntry -> String
showsPrec :: Int -> ValidationErrorsEntry -> ShowS
$cshowsPrec :: Int -> ValidationErrorsEntry -> ShowS
Prelude.Show, (forall x. ValidationErrorsEntry -> Rep ValidationErrorsEntry x)
-> (forall x. Rep ValidationErrorsEntry x -> ValidationErrorsEntry)
-> Generic ValidationErrorsEntry
forall x. Rep ValidationErrorsEntry x -> ValidationErrorsEntry
forall x. ValidationErrorsEntry -> Rep ValidationErrorsEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidationErrorsEntry x -> ValidationErrorsEntry
$cfrom :: forall x. ValidationErrorsEntry -> Rep ValidationErrorsEntry x
Prelude.Generic)

-- |
-- Create a value of 'ValidationErrorsEntry' 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:
--
-- 'checkName', 'validationErrorsEntry_checkName' - Checks the name of the policy.
--
-- 'errorMessage', 'validationErrorsEntry_errorMessage' - Displays error messages if validation encounters problems during
-- validation of the resource policy.
newValidationErrorsEntry ::
  ValidationErrorsEntry
newValidationErrorsEntry :: ValidationErrorsEntry
newValidationErrorsEntry =
  ValidationErrorsEntry' :: Maybe Text -> Maybe Text -> ValidationErrorsEntry
ValidationErrorsEntry'
    { $sel:checkName:ValidationErrorsEntry' :: Maybe Text
checkName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:ValidationErrorsEntry' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Checks the name of the policy.
validationErrorsEntry_checkName :: Lens.Lens' ValidationErrorsEntry (Prelude.Maybe Prelude.Text)
validationErrorsEntry_checkName :: (Maybe Text -> f (Maybe Text))
-> ValidationErrorsEntry -> f ValidationErrorsEntry
validationErrorsEntry_checkName = (ValidationErrorsEntry -> Maybe Text)
-> (ValidationErrorsEntry -> Maybe Text -> ValidationErrorsEntry)
-> Lens
     ValidationErrorsEntry
     ValidationErrorsEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationErrorsEntry' {Maybe Text
checkName :: Maybe Text
$sel:checkName:ValidationErrorsEntry' :: ValidationErrorsEntry -> Maybe Text
checkName} -> Maybe Text
checkName) (\s :: ValidationErrorsEntry
s@ValidationErrorsEntry' {} Maybe Text
a -> ValidationErrorsEntry
s {$sel:checkName:ValidationErrorsEntry' :: Maybe Text
checkName = Maybe Text
a} :: ValidationErrorsEntry)

-- | Displays error messages if validation encounters problems during
-- validation of the resource policy.
validationErrorsEntry_errorMessage :: Lens.Lens' ValidationErrorsEntry (Prelude.Maybe Prelude.Text)
validationErrorsEntry_errorMessage :: (Maybe Text -> f (Maybe Text))
-> ValidationErrorsEntry -> f ValidationErrorsEntry
validationErrorsEntry_errorMessage = (ValidationErrorsEntry -> Maybe Text)
-> (ValidationErrorsEntry -> Maybe Text -> ValidationErrorsEntry)
-> Lens
     ValidationErrorsEntry
     ValidationErrorsEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationErrorsEntry' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:ValidationErrorsEntry' :: ValidationErrorsEntry -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: ValidationErrorsEntry
s@ValidationErrorsEntry' {} Maybe Text
a -> ValidationErrorsEntry
s {$sel:errorMessage:ValidationErrorsEntry' :: Maybe Text
errorMessage = Maybe Text
a} :: ValidationErrorsEntry)

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

instance Prelude.Hashable ValidationErrorsEntry

instance Prelude.NFData ValidationErrorsEntry