{-# 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.LakeFormation.Types.BatchPermissionsFailureEntry
-- 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.LakeFormation.Types.BatchPermissionsFailureEntry where

import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.Types.BatchPermissionsRequestEntry
import Amazonka.LakeFormation.Types.ErrorDetail
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of failures when performing a batch grant or batch revoke
-- operation.
--
-- /See:/ 'newBatchPermissionsFailureEntry' smart constructor.
data BatchPermissionsFailureEntry = BatchPermissionsFailureEntry'
  { -- | An error message that applies to the failure of the entry.
    BatchPermissionsFailureEntry -> Maybe ErrorDetail
error :: Prelude.Maybe ErrorDetail,
    -- | An identifier for an entry of the batch request.
    BatchPermissionsFailureEntry -> Maybe BatchPermissionsRequestEntry
requestEntry :: Prelude.Maybe BatchPermissionsRequestEntry
  }
  deriving (BatchPermissionsFailureEntry
-> BatchPermissionsFailureEntry -> Bool
(BatchPermissionsFailureEntry
 -> BatchPermissionsFailureEntry -> Bool)
-> (BatchPermissionsFailureEntry
    -> BatchPermissionsFailureEntry -> Bool)
-> Eq BatchPermissionsFailureEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPermissionsFailureEntry
-> BatchPermissionsFailureEntry -> Bool
$c/= :: BatchPermissionsFailureEntry
-> BatchPermissionsFailureEntry -> Bool
== :: BatchPermissionsFailureEntry
-> BatchPermissionsFailureEntry -> Bool
$c== :: BatchPermissionsFailureEntry
-> BatchPermissionsFailureEntry -> Bool
Prelude.Eq, ReadPrec [BatchPermissionsFailureEntry]
ReadPrec BatchPermissionsFailureEntry
Int -> ReadS BatchPermissionsFailureEntry
ReadS [BatchPermissionsFailureEntry]
(Int -> ReadS BatchPermissionsFailureEntry)
-> ReadS [BatchPermissionsFailureEntry]
-> ReadPrec BatchPermissionsFailureEntry
-> ReadPrec [BatchPermissionsFailureEntry]
-> Read BatchPermissionsFailureEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPermissionsFailureEntry]
$creadListPrec :: ReadPrec [BatchPermissionsFailureEntry]
readPrec :: ReadPrec BatchPermissionsFailureEntry
$creadPrec :: ReadPrec BatchPermissionsFailureEntry
readList :: ReadS [BatchPermissionsFailureEntry]
$creadList :: ReadS [BatchPermissionsFailureEntry]
readsPrec :: Int -> ReadS BatchPermissionsFailureEntry
$creadsPrec :: Int -> ReadS BatchPermissionsFailureEntry
Prelude.Read, Int -> BatchPermissionsFailureEntry -> ShowS
[BatchPermissionsFailureEntry] -> ShowS
BatchPermissionsFailureEntry -> String
(Int -> BatchPermissionsFailureEntry -> ShowS)
-> (BatchPermissionsFailureEntry -> String)
-> ([BatchPermissionsFailureEntry] -> ShowS)
-> Show BatchPermissionsFailureEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPermissionsFailureEntry] -> ShowS
$cshowList :: [BatchPermissionsFailureEntry] -> ShowS
show :: BatchPermissionsFailureEntry -> String
$cshow :: BatchPermissionsFailureEntry -> String
showsPrec :: Int -> BatchPermissionsFailureEntry -> ShowS
$cshowsPrec :: Int -> BatchPermissionsFailureEntry -> ShowS
Prelude.Show, (forall x.
 BatchPermissionsFailureEntry -> Rep BatchPermissionsFailureEntry x)
-> (forall x.
    Rep BatchPermissionsFailureEntry x -> BatchPermissionsFailureEntry)
-> Generic BatchPermissionsFailureEntry
forall x.
Rep BatchPermissionsFailureEntry x -> BatchPermissionsFailureEntry
forall x.
BatchPermissionsFailureEntry -> Rep BatchPermissionsFailureEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPermissionsFailureEntry x -> BatchPermissionsFailureEntry
$cfrom :: forall x.
BatchPermissionsFailureEntry -> Rep BatchPermissionsFailureEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchPermissionsFailureEntry' 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', 'batchPermissionsFailureEntry_error' - An error message that applies to the failure of the entry.
--
-- 'requestEntry', 'batchPermissionsFailureEntry_requestEntry' - An identifier for an entry of the batch request.
newBatchPermissionsFailureEntry ::
  BatchPermissionsFailureEntry
newBatchPermissionsFailureEntry :: BatchPermissionsFailureEntry
newBatchPermissionsFailureEntry =
  BatchPermissionsFailureEntry' :: Maybe ErrorDetail
-> Maybe BatchPermissionsRequestEntry
-> BatchPermissionsFailureEntry
BatchPermissionsFailureEntry'
    { $sel:error:BatchPermissionsFailureEntry' :: Maybe ErrorDetail
error =
        Maybe ErrorDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:requestEntry:BatchPermissionsFailureEntry' :: Maybe BatchPermissionsRequestEntry
requestEntry = Maybe BatchPermissionsRequestEntry
forall a. Maybe a
Prelude.Nothing
    }

-- | An error message that applies to the failure of the entry.
batchPermissionsFailureEntry_error :: Lens.Lens' BatchPermissionsFailureEntry (Prelude.Maybe ErrorDetail)
batchPermissionsFailureEntry_error :: (Maybe ErrorDetail -> f (Maybe ErrorDetail))
-> BatchPermissionsFailureEntry -> f BatchPermissionsFailureEntry
batchPermissionsFailureEntry_error = (BatchPermissionsFailureEntry -> Maybe ErrorDetail)
-> (BatchPermissionsFailureEntry
    -> Maybe ErrorDetail -> BatchPermissionsFailureEntry)
-> Lens
     BatchPermissionsFailureEntry
     BatchPermissionsFailureEntry
     (Maybe ErrorDetail)
     (Maybe ErrorDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPermissionsFailureEntry' {Maybe ErrorDetail
error :: Maybe ErrorDetail
$sel:error:BatchPermissionsFailureEntry' :: BatchPermissionsFailureEntry -> Maybe ErrorDetail
error} -> Maybe ErrorDetail
error) (\s :: BatchPermissionsFailureEntry
s@BatchPermissionsFailureEntry' {} Maybe ErrorDetail
a -> BatchPermissionsFailureEntry
s {$sel:error:BatchPermissionsFailureEntry' :: Maybe ErrorDetail
error = Maybe ErrorDetail
a} :: BatchPermissionsFailureEntry)

-- | An identifier for an entry of the batch request.
batchPermissionsFailureEntry_requestEntry :: Lens.Lens' BatchPermissionsFailureEntry (Prelude.Maybe BatchPermissionsRequestEntry)
batchPermissionsFailureEntry_requestEntry :: (Maybe BatchPermissionsRequestEntry
 -> f (Maybe BatchPermissionsRequestEntry))
-> BatchPermissionsFailureEntry -> f BatchPermissionsFailureEntry
batchPermissionsFailureEntry_requestEntry = (BatchPermissionsFailureEntry
 -> Maybe BatchPermissionsRequestEntry)
-> (BatchPermissionsFailureEntry
    -> Maybe BatchPermissionsRequestEntry
    -> BatchPermissionsFailureEntry)
-> Lens
     BatchPermissionsFailureEntry
     BatchPermissionsFailureEntry
     (Maybe BatchPermissionsRequestEntry)
     (Maybe BatchPermissionsRequestEntry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPermissionsFailureEntry' {Maybe BatchPermissionsRequestEntry
requestEntry :: Maybe BatchPermissionsRequestEntry
$sel:requestEntry:BatchPermissionsFailureEntry' :: BatchPermissionsFailureEntry -> Maybe BatchPermissionsRequestEntry
requestEntry} -> Maybe BatchPermissionsRequestEntry
requestEntry) (\s :: BatchPermissionsFailureEntry
s@BatchPermissionsFailureEntry' {} Maybe BatchPermissionsRequestEntry
a -> BatchPermissionsFailureEntry
s {$sel:requestEntry:BatchPermissionsFailureEntry' :: Maybe BatchPermissionsRequestEntry
requestEntry = Maybe BatchPermissionsRequestEntry
a} :: BatchPermissionsFailureEntry)

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

instance
  Prelude.Hashable
    BatchPermissionsFailureEntry

instance Prelude.NFData BatchPermissionsFailureEntry