{-# 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.PutDataLakeSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Sets the list of data lake administrators who have admin privileges on
-- all resources managed by Lake Formation. For more information on admin
-- privileges, see
-- <https://docs.aws.amazon.com/lake-formation/latest/dg/lake-formation-permissions.html Granting Lake Formation Permissions>.
--
-- This API replaces the current list of data lake admins with the new list
-- being passed. To add an admin, fetch the current list and add the new
-- admin to that list and pass that list in this API.
module Amazonka.LakeFormation.PutDataLakeSettings
  ( -- * Creating a Request
    PutDataLakeSettings (..),
    newPutDataLakeSettings,

    -- * Request Lenses
    putDataLakeSettings_catalogId,
    putDataLakeSettings_dataLakeSettings,

    -- * Destructuring the Response
    PutDataLakeSettingsResponse (..),
    newPutDataLakeSettingsResponse,

    -- * Response Lenses
    putDataLakeSettingsResponse_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:/ 'newPutDataLakeSettings' smart constructor.
data PutDataLakeSettings = PutDataLakeSettings'
  { -- | 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.
    PutDataLakeSettings -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | A structure representing a list of Lake Formation principals designated
    -- as data lake administrators.
    PutDataLakeSettings -> DataLakeSettings
dataLakeSettings :: DataLakeSettings
  }
  deriving (PutDataLakeSettings -> PutDataLakeSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDataLakeSettings -> PutDataLakeSettings -> Bool
$c/= :: PutDataLakeSettings -> PutDataLakeSettings -> Bool
== :: PutDataLakeSettings -> PutDataLakeSettings -> Bool
$c== :: PutDataLakeSettings -> PutDataLakeSettings -> Bool
Prelude.Eq, ReadPrec [PutDataLakeSettings]
ReadPrec PutDataLakeSettings
Int -> ReadS PutDataLakeSettings
ReadS [PutDataLakeSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDataLakeSettings]
$creadListPrec :: ReadPrec [PutDataLakeSettings]
readPrec :: ReadPrec PutDataLakeSettings
$creadPrec :: ReadPrec PutDataLakeSettings
readList :: ReadS [PutDataLakeSettings]
$creadList :: ReadS [PutDataLakeSettings]
readsPrec :: Int -> ReadS PutDataLakeSettings
$creadsPrec :: Int -> ReadS PutDataLakeSettings
Prelude.Read, Int -> PutDataLakeSettings -> ShowS
[PutDataLakeSettings] -> ShowS
PutDataLakeSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDataLakeSettings] -> ShowS
$cshowList :: [PutDataLakeSettings] -> ShowS
show :: PutDataLakeSettings -> String
$cshow :: PutDataLakeSettings -> String
showsPrec :: Int -> PutDataLakeSettings -> ShowS
$cshowsPrec :: Int -> PutDataLakeSettings -> ShowS
Prelude.Show, forall x. Rep PutDataLakeSettings x -> PutDataLakeSettings
forall x. PutDataLakeSettings -> Rep PutDataLakeSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDataLakeSettings x -> PutDataLakeSettings
$cfrom :: forall x. PutDataLakeSettings -> Rep PutDataLakeSettings x
Prelude.Generic)

-- |
-- Create a value of 'PutDataLakeSettings' 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', 'putDataLakeSettings_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.
--
-- 'dataLakeSettings', 'putDataLakeSettings_dataLakeSettings' - A structure representing a list of Lake Formation principals designated
-- as data lake administrators.
newPutDataLakeSettings ::
  -- | 'dataLakeSettings'
  DataLakeSettings ->
  PutDataLakeSettings
newPutDataLakeSettings :: DataLakeSettings -> PutDataLakeSettings
newPutDataLakeSettings DataLakeSettings
pDataLakeSettings_ =
  PutDataLakeSettings'
    { $sel:catalogId:PutDataLakeSettings' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
      $sel:dataLakeSettings:PutDataLakeSettings' :: DataLakeSettings
dataLakeSettings = DataLakeSettings
pDataLakeSettings_
    }

-- | 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.
putDataLakeSettings_catalogId :: Lens.Lens' PutDataLakeSettings (Prelude.Maybe Prelude.Text)
putDataLakeSettings_catalogId :: Lens' PutDataLakeSettings (Maybe Text)
putDataLakeSettings_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDataLakeSettings' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:PutDataLakeSettings' :: PutDataLakeSettings -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: PutDataLakeSettings
s@PutDataLakeSettings' {} Maybe Text
a -> PutDataLakeSettings
s {$sel:catalogId:PutDataLakeSettings' :: Maybe Text
catalogId = Maybe Text
a} :: PutDataLakeSettings)

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

instance Core.AWSRequest PutDataLakeSettings where
  type
    AWSResponse PutDataLakeSettings =
      PutDataLakeSettingsResponse
  request :: (Service -> Service)
-> PutDataLakeSettings -> Request PutDataLakeSettings
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 PutDataLakeSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutDataLakeSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutDataLakeSettingsResponse
PutDataLakeSettingsResponse'
            forall (f :: * -> *) a b. Functor 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 PutDataLakeSettings where
  hashWithSalt :: Int -> PutDataLakeSettings -> Int
hashWithSalt Int
_salt PutDataLakeSettings' {Maybe Text
DataLakeSettings
dataLakeSettings :: DataLakeSettings
catalogId :: Maybe Text
$sel:dataLakeSettings:PutDataLakeSettings' :: PutDataLakeSettings -> DataLakeSettings
$sel:catalogId:PutDataLakeSettings' :: PutDataLakeSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataLakeSettings
dataLakeSettings

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

instance Data.ToHeaders PutDataLakeSettings where
  toHeaders :: PutDataLakeSettings -> 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 PutDataLakeSettings where
  toJSON :: PutDataLakeSettings -> Value
toJSON PutDataLakeSettings' {Maybe Text
DataLakeSettings
dataLakeSettings :: DataLakeSettings
catalogId :: Maybe Text
$sel:dataLakeSettings:PutDataLakeSettings' :: PutDataLakeSettings -> DataLakeSettings
$sel:catalogId:PutDataLakeSettings' :: PutDataLakeSettings -> 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,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DataLakeSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataLakeSettings
dataLakeSettings)
          ]
      )

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

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

-- | /See:/ 'newPutDataLakeSettingsResponse' smart constructor.
data PutDataLakeSettingsResponse = PutDataLakeSettingsResponse'
  { -- | The response's http status code.
    PutDataLakeSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutDataLakeSettingsResponse -> PutDataLakeSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDataLakeSettingsResponse -> PutDataLakeSettingsResponse -> Bool
$c/= :: PutDataLakeSettingsResponse -> PutDataLakeSettingsResponse -> Bool
== :: PutDataLakeSettingsResponse -> PutDataLakeSettingsResponse -> Bool
$c== :: PutDataLakeSettingsResponse -> PutDataLakeSettingsResponse -> Bool
Prelude.Eq, ReadPrec [PutDataLakeSettingsResponse]
ReadPrec PutDataLakeSettingsResponse
Int -> ReadS PutDataLakeSettingsResponse
ReadS [PutDataLakeSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDataLakeSettingsResponse]
$creadListPrec :: ReadPrec [PutDataLakeSettingsResponse]
readPrec :: ReadPrec PutDataLakeSettingsResponse
$creadPrec :: ReadPrec PutDataLakeSettingsResponse
readList :: ReadS [PutDataLakeSettingsResponse]
$creadList :: ReadS [PutDataLakeSettingsResponse]
readsPrec :: Int -> ReadS PutDataLakeSettingsResponse
$creadsPrec :: Int -> ReadS PutDataLakeSettingsResponse
Prelude.Read, Int -> PutDataLakeSettingsResponse -> ShowS
[PutDataLakeSettingsResponse] -> ShowS
PutDataLakeSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDataLakeSettingsResponse] -> ShowS
$cshowList :: [PutDataLakeSettingsResponse] -> ShowS
show :: PutDataLakeSettingsResponse -> String
$cshow :: PutDataLakeSettingsResponse -> String
showsPrec :: Int -> PutDataLakeSettingsResponse -> ShowS
$cshowsPrec :: Int -> PutDataLakeSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep PutDataLakeSettingsResponse x -> PutDataLakeSettingsResponse
forall x.
PutDataLakeSettingsResponse -> Rep PutDataLakeSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutDataLakeSettingsResponse x -> PutDataLakeSettingsResponse
$cfrom :: forall x.
PutDataLakeSettingsResponse -> Rep PutDataLakeSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutDataLakeSettingsResponse' 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:
--
-- 'httpStatus', 'putDataLakeSettingsResponse_httpStatus' - The response's http status code.
newPutDataLakeSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutDataLakeSettingsResponse
newPutDataLakeSettingsResponse :: Int -> PutDataLakeSettingsResponse
newPutDataLakeSettingsResponse Int
pHttpStatus_ =
  PutDataLakeSettingsResponse'
    { $sel:httpStatus:PutDataLakeSettingsResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData PutDataLakeSettingsResponse where
  rnf :: PutDataLakeSettingsResponse -> ()
rnf PutDataLakeSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutDataLakeSettingsResponse' :: PutDataLakeSettingsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus