{-# 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.Glue.Types.DataLakePrincipal
-- 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.Glue.Types.DataLakePrincipal where

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

-- | The Lake Formation principal.
--
-- /See:/ 'newDataLakePrincipal' smart constructor.
data DataLakePrincipal = DataLakePrincipal'
  { -- | An identifier for the Lake Formation principal.
    DataLakePrincipal -> Maybe Text
dataLakePrincipalIdentifier :: Prelude.Maybe Prelude.Text
  }
  deriving (DataLakePrincipal -> DataLakePrincipal -> Bool
(DataLakePrincipal -> DataLakePrincipal -> Bool)
-> (DataLakePrincipal -> DataLakePrincipal -> Bool)
-> Eq DataLakePrincipal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataLakePrincipal -> DataLakePrincipal -> Bool
$c/= :: DataLakePrincipal -> DataLakePrincipal -> Bool
== :: DataLakePrincipal -> DataLakePrincipal -> Bool
$c== :: DataLakePrincipal -> DataLakePrincipal -> Bool
Prelude.Eq, ReadPrec [DataLakePrincipal]
ReadPrec DataLakePrincipal
Int -> ReadS DataLakePrincipal
ReadS [DataLakePrincipal]
(Int -> ReadS DataLakePrincipal)
-> ReadS [DataLakePrincipal]
-> ReadPrec DataLakePrincipal
-> ReadPrec [DataLakePrincipal]
-> Read DataLakePrincipal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataLakePrincipal]
$creadListPrec :: ReadPrec [DataLakePrincipal]
readPrec :: ReadPrec DataLakePrincipal
$creadPrec :: ReadPrec DataLakePrincipal
readList :: ReadS [DataLakePrincipal]
$creadList :: ReadS [DataLakePrincipal]
readsPrec :: Int -> ReadS DataLakePrincipal
$creadsPrec :: Int -> ReadS DataLakePrincipal
Prelude.Read, Int -> DataLakePrincipal -> ShowS
[DataLakePrincipal] -> ShowS
DataLakePrincipal -> String
(Int -> DataLakePrincipal -> ShowS)
-> (DataLakePrincipal -> String)
-> ([DataLakePrincipal] -> ShowS)
-> Show DataLakePrincipal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataLakePrincipal] -> ShowS
$cshowList :: [DataLakePrincipal] -> ShowS
show :: DataLakePrincipal -> String
$cshow :: DataLakePrincipal -> String
showsPrec :: Int -> DataLakePrincipal -> ShowS
$cshowsPrec :: Int -> DataLakePrincipal -> ShowS
Prelude.Show, (forall x. DataLakePrincipal -> Rep DataLakePrincipal x)
-> (forall x. Rep DataLakePrincipal x -> DataLakePrincipal)
-> Generic DataLakePrincipal
forall x. Rep DataLakePrincipal x -> DataLakePrincipal
forall x. DataLakePrincipal -> Rep DataLakePrincipal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataLakePrincipal x -> DataLakePrincipal
$cfrom :: forall x. DataLakePrincipal -> Rep DataLakePrincipal x
Prelude.Generic)

-- |
-- Create a value of 'DataLakePrincipal' 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:
--
-- 'dataLakePrincipalIdentifier', 'dataLakePrincipal_dataLakePrincipalIdentifier' - An identifier for the Lake Formation principal.
newDataLakePrincipal ::
  DataLakePrincipal
newDataLakePrincipal :: DataLakePrincipal
newDataLakePrincipal =
  DataLakePrincipal' :: Maybe Text -> DataLakePrincipal
DataLakePrincipal'
    { $sel:dataLakePrincipalIdentifier:DataLakePrincipal' :: Maybe Text
dataLakePrincipalIdentifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An identifier for the Lake Formation principal.
dataLakePrincipal_dataLakePrincipalIdentifier :: Lens.Lens' DataLakePrincipal (Prelude.Maybe Prelude.Text)
dataLakePrincipal_dataLakePrincipalIdentifier :: (Maybe Text -> f (Maybe Text))
-> DataLakePrincipal -> f DataLakePrincipal
dataLakePrincipal_dataLakePrincipalIdentifier = (DataLakePrincipal -> Maybe Text)
-> (DataLakePrincipal -> Maybe Text -> DataLakePrincipal)
-> Lens
     DataLakePrincipal DataLakePrincipal (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataLakePrincipal' {Maybe Text
dataLakePrincipalIdentifier :: Maybe Text
$sel:dataLakePrincipalIdentifier:DataLakePrincipal' :: DataLakePrincipal -> Maybe Text
dataLakePrincipalIdentifier} -> Maybe Text
dataLakePrincipalIdentifier) (\s :: DataLakePrincipal
s@DataLakePrincipal' {} Maybe Text
a -> DataLakePrincipal
s {$sel:dataLakePrincipalIdentifier:DataLakePrincipal' :: Maybe Text
dataLakePrincipalIdentifier = Maybe Text
a} :: DataLakePrincipal)

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

instance Prelude.Hashable DataLakePrincipal

instance Prelude.NFData DataLakePrincipal

instance Core.ToJSON DataLakePrincipal where
  toJSON :: DataLakePrincipal -> Value
toJSON DataLakePrincipal' {Maybe Text
dataLakePrincipalIdentifier :: Maybe Text
$sel:dataLakePrincipalIdentifier:DataLakePrincipal' :: DataLakePrincipal -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DataLakePrincipalIdentifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dataLakePrincipalIdentifier
          ]
      )