{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.GetDataLakeSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the list of the data lake administrators of a Lake
-- Formation-managed data lake.
module Amazonka.LakeFormation.GetDataLakeSettings
  ( -- * Creating a Request
    GetDataLakeSettings (..),
    newGetDataLakeSettings,

    -- * Request Lenses
    getDataLakeSettings_catalogId,

    -- * Destructuring the Response
    GetDataLakeSettingsResponse (..),
    newGetDataLakeSettingsResponse,

    -- * Response Lenses
    getDataLakeSettingsResponse_dataLakeSettings,
    getDataLakeSettingsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetDataLakeSettings' smart constructor.
data GetDataLakeSettings = GetDataLakeSettings'
  { -- | The identifier for the Data Catalog. By default, the account ID. The
    -- Data Catalog is the persistent metadata store. It contains database
    -- definitions, table definitions, and other control information to manage
    -- your Lake Formation environment.
    GetDataLakeSettings -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text
  }
  deriving (GetDataLakeSettings -> GetDataLakeSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataLakeSettings -> GetDataLakeSettings -> Bool
$c/= :: GetDataLakeSettings -> GetDataLakeSettings -> Bool
== :: GetDataLakeSettings -> GetDataLakeSettings -> Bool
$c== :: GetDataLakeSettings -> GetDataLakeSettings -> Bool
Prelude.Eq, ReadPrec [GetDataLakeSettings]
ReadPrec GetDataLakeSettings
Int -> ReadS GetDataLakeSettings
ReadS [GetDataLakeSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataLakeSettings]
$creadListPrec :: ReadPrec [GetDataLakeSettings]
readPrec :: ReadPrec GetDataLakeSettings
$creadPrec :: ReadPrec GetDataLakeSettings
readList :: ReadS [GetDataLakeSettings]
$creadList :: ReadS [GetDataLakeSettings]
readsPrec :: Int -> ReadS GetDataLakeSettings
$creadsPrec :: Int -> ReadS GetDataLakeSettings
Prelude.Read, Int -> GetDataLakeSettings -> ShowS
[GetDataLakeSettings] -> ShowS
GetDataLakeSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataLakeSettings] -> ShowS
$cshowList :: [GetDataLakeSettings] -> ShowS
show :: GetDataLakeSettings -> String
$cshow :: GetDataLakeSettings -> String
showsPrec :: Int -> GetDataLakeSettings -> ShowS
$cshowsPrec :: Int -> GetDataLakeSettings -> ShowS
Prelude.Show, forall x. Rep GetDataLakeSettings x -> GetDataLakeSettings
forall x. GetDataLakeSettings -> Rep GetDataLakeSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDataLakeSettings x -> GetDataLakeSettings
$cfrom :: forall x. GetDataLakeSettings -> Rep GetDataLakeSettings x
Prelude.Generic)

-- |
-- Create a value of 'GetDataLakeSettings' 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:
--
-- 'catalogId', 'getDataLakeSettings_catalogId' - The identifier for the Data Catalog. By default, the account ID. The
-- Data Catalog is the persistent metadata store. It contains database
-- definitions, table definitions, and other control information to manage
-- your Lake Formation environment.
newGetDataLakeSettings ::
  GetDataLakeSettings
newGetDataLakeSettings :: GetDataLakeSettings
newGetDataLakeSettings =
  GetDataLakeSettings' {$sel:catalogId:GetDataLakeSettings' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing}

-- | The identifier for the Data Catalog. By default, the account ID. The
-- Data Catalog is the persistent metadata store. It contains database
-- definitions, table definitions, and other control information to manage
-- your Lake Formation environment.
getDataLakeSettings_catalogId :: Lens.Lens' GetDataLakeSettings (Prelude.Maybe Prelude.Text)
getDataLakeSettings_catalogId :: Lens' GetDataLakeSettings (Maybe Text)
getDataLakeSettings_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataLakeSettings' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetDataLakeSettings' :: GetDataLakeSettings -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetDataLakeSettings
s@GetDataLakeSettings' {} Maybe Text
a -> GetDataLakeSettings
s {$sel:catalogId:GetDataLakeSettings' :: Maybe Text
catalogId = Maybe Text
a} :: GetDataLakeSettings)

instance Core.AWSRequest GetDataLakeSettings where
  type
    AWSResponse GetDataLakeSettings =
      GetDataLakeSettingsResponse
  request :: (Service -> Service)
-> GetDataLakeSettings -> Request GetDataLakeSettings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDataLakeSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDataLakeSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe DataLakeSettings -> Int -> GetDataLakeSettingsResponse
GetDataLakeSettingsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DataLakeSettings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetDataLakeSettings where
  hashWithSalt :: Int -> GetDataLakeSettings -> Int
hashWithSalt Int
_salt GetDataLakeSettings' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetDataLakeSettings' :: GetDataLakeSettings -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId

instance Prelude.NFData GetDataLakeSettings where
  rnf :: GetDataLakeSettings -> ()
rnf GetDataLakeSettings' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetDataLakeSettings' :: GetDataLakeSettings -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId

instance Data.ToHeaders GetDataLakeSettings where
  toHeaders :: GetDataLakeSettings -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.ToPath GetDataLakeSettings where
  toPath :: GetDataLakeSettings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/GetDataLakeSettings"

instance Data.ToQuery GetDataLakeSettings where
  toQuery :: GetDataLakeSettings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetDataLakeSettingsResponse' smart constructor.
data GetDataLakeSettingsResponse = GetDataLakeSettingsResponse'
  { -- | A structure representing a list of Lake Formation principals designated
    -- as data lake administrators.
    GetDataLakeSettingsResponse -> Maybe DataLakeSettings
dataLakeSettings :: Prelude.Maybe DataLakeSettings,
    -- | The response's http status code.
    GetDataLakeSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDataLakeSettingsResponse -> GetDataLakeSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataLakeSettingsResponse -> GetDataLakeSettingsResponse -> Bool
$c/= :: GetDataLakeSettingsResponse -> GetDataLakeSettingsResponse -> Bool
== :: GetDataLakeSettingsResponse -> GetDataLakeSettingsResponse -> Bool
$c== :: GetDataLakeSettingsResponse -> GetDataLakeSettingsResponse -> Bool
Prelude.Eq, ReadPrec [GetDataLakeSettingsResponse]
ReadPrec GetDataLakeSettingsResponse
Int -> ReadS GetDataLakeSettingsResponse
ReadS [GetDataLakeSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataLakeSettingsResponse]
$creadListPrec :: ReadPrec [GetDataLakeSettingsResponse]
readPrec :: ReadPrec GetDataLakeSettingsResponse
$creadPrec :: ReadPrec GetDataLakeSettingsResponse
readList :: ReadS [GetDataLakeSettingsResponse]
$creadList :: ReadS [GetDataLakeSettingsResponse]
readsPrec :: Int -> ReadS GetDataLakeSettingsResponse
$creadsPrec :: Int -> ReadS GetDataLakeSettingsResponse
Prelude.Read, Int -> GetDataLakeSettingsResponse -> ShowS
[GetDataLakeSettingsResponse] -> ShowS
GetDataLakeSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataLakeSettingsResponse] -> ShowS
$cshowList :: [GetDataLakeSettingsResponse] -> ShowS
show :: GetDataLakeSettingsResponse -> String
$cshow :: GetDataLakeSettingsResponse -> String
showsPrec :: Int -> GetDataLakeSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetDataLakeSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep GetDataLakeSettingsResponse x -> GetDataLakeSettingsResponse
forall x.
GetDataLakeSettingsResponse -> Rep GetDataLakeSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDataLakeSettingsResponse x -> GetDataLakeSettingsResponse
$cfrom :: forall x.
GetDataLakeSettingsResponse -> Rep GetDataLakeSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDataLakeSettingsResponse' 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:
--
-- 'dataLakeSettings', 'getDataLakeSettingsResponse_dataLakeSettings' - A structure representing a list of Lake Formation principals designated
-- as data lake administrators.
--
-- 'httpStatus', 'getDataLakeSettingsResponse_httpStatus' - The response's http status code.
newGetDataLakeSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDataLakeSettingsResponse
newGetDataLakeSettingsResponse :: Int -> GetDataLakeSettingsResponse
newGetDataLakeSettingsResponse Int
pHttpStatus_ =
  GetDataLakeSettingsResponse'
    { $sel:dataLakeSettings:GetDataLakeSettingsResponse' :: Maybe DataLakeSettings
dataLakeSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDataLakeSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A structure representing a list of Lake Formation principals designated
-- as data lake administrators.
getDataLakeSettingsResponse_dataLakeSettings :: Lens.Lens' GetDataLakeSettingsResponse (Prelude.Maybe DataLakeSettings)
getDataLakeSettingsResponse_dataLakeSettings :: Lens' GetDataLakeSettingsResponse (Maybe DataLakeSettings)
getDataLakeSettingsResponse_dataLakeSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataLakeSettingsResponse' {Maybe DataLakeSettings
dataLakeSettings :: Maybe DataLakeSettings
$sel:dataLakeSettings:GetDataLakeSettingsResponse' :: GetDataLakeSettingsResponse -> Maybe DataLakeSettings
dataLakeSettings} -> Maybe DataLakeSettings
dataLakeSettings) (\s :: GetDataLakeSettingsResponse
s@GetDataLakeSettingsResponse' {} Maybe DataLakeSettings
a -> GetDataLakeSettingsResponse
s {$sel:dataLakeSettings:GetDataLakeSettingsResponse' :: Maybe DataLakeSettings
dataLakeSettings = Maybe DataLakeSettings
a} :: GetDataLakeSettingsResponse)

-- | The response's http status code.
getDataLakeSettingsResponse_httpStatus :: Lens.Lens' GetDataLakeSettingsResponse Prelude.Int
getDataLakeSettingsResponse_httpStatus :: Lens' GetDataLakeSettingsResponse Int
getDataLakeSettingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataLakeSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDataLakeSettingsResponse' :: GetDataLakeSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDataLakeSettingsResponse
s@GetDataLakeSettingsResponse' {} Int
a -> GetDataLakeSettingsResponse
s {$sel:httpStatus:GetDataLakeSettingsResponse' :: Int
httpStatus = Int
a} :: GetDataLakeSettingsResponse)

instance Prelude.NFData GetDataLakeSettingsResponse where
  rnf :: GetDataLakeSettingsResponse -> ()
rnf GetDataLakeSettingsResponse' {Int
Maybe DataLakeSettings
httpStatus :: Int
dataLakeSettings :: Maybe DataLakeSettings
$sel:httpStatus:GetDataLakeSettingsResponse' :: GetDataLakeSettingsResponse -> Int
$sel:dataLakeSettings:GetDataLakeSettingsResponse' :: GetDataLakeSettingsResponse -> Maybe DataLakeSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DataLakeSettings
dataLakeSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus