{-# 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-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)
--
-- 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 Amazonka.LakeFormation.Types
import qualified Amazonka.Lens as Lens
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 AWS Lake Formation environment.
    PutDataLakeSettings -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | A structure representing a list of AWS Lake Formation principals
    -- designated as data lake administrators.
    PutDataLakeSettings -> DataLakeSettings
dataLakeSettings :: DataLakeSettings
  }
  deriving (PutDataLakeSettings -> PutDataLakeSettings -> Bool
(PutDataLakeSettings -> PutDataLakeSettings -> Bool)
-> (PutDataLakeSettings -> PutDataLakeSettings -> Bool)
-> Eq PutDataLakeSettings
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]
(Int -> ReadS PutDataLakeSettings)
-> ReadS [PutDataLakeSettings]
-> ReadPrec PutDataLakeSettings
-> ReadPrec [PutDataLakeSettings]
-> Read 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
(Int -> PutDataLakeSettings -> ShowS)
-> (PutDataLakeSettings -> String)
-> ([PutDataLakeSettings] -> ShowS)
-> Show PutDataLakeSettings
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. PutDataLakeSettings -> Rep PutDataLakeSettings x)
-> (forall x. Rep PutDataLakeSettings x -> PutDataLakeSettings)
-> Generic PutDataLakeSettings
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 AWS Lake Formation environment.
--
-- 'dataLakeSettings', 'putDataLakeSettings_dataLakeSettings' - A structure representing a list of AWS Lake Formation principals
-- designated as data lake administrators.
newPutDataLakeSettings ::
  -- | 'dataLakeSettings'
  DataLakeSettings ->
  PutDataLakeSettings
newPutDataLakeSettings :: DataLakeSettings -> PutDataLakeSettings
newPutDataLakeSettings DataLakeSettings
pDataLakeSettings_ =
  PutDataLakeSettings' :: Maybe Text -> DataLakeSettings -> PutDataLakeSettings
PutDataLakeSettings'
    { $sel:catalogId:PutDataLakeSettings' :: Maybe Text
catalogId = Maybe Text
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 AWS Lake Formation environment.
putDataLakeSettings_catalogId :: Lens.Lens' PutDataLakeSettings (Prelude.Maybe Prelude.Text)
putDataLakeSettings_catalogId :: (Maybe Text -> f (Maybe Text))
-> PutDataLakeSettings -> f PutDataLakeSettings
putDataLakeSettings_catalogId = (PutDataLakeSettings -> Maybe Text)
-> (PutDataLakeSettings -> Maybe Text -> PutDataLakeSettings)
-> Lens
     PutDataLakeSettings PutDataLakeSettings (Maybe Text) (Maybe Text)
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 AWS Lake Formation principals
-- designated as data lake administrators.
putDataLakeSettings_dataLakeSettings :: Lens.Lens' PutDataLakeSettings DataLakeSettings
putDataLakeSettings_dataLakeSettings :: (DataLakeSettings -> f DataLakeSettings)
-> PutDataLakeSettings -> f PutDataLakeSettings
putDataLakeSettings_dataLakeSettings = (PutDataLakeSettings -> DataLakeSettings)
-> (PutDataLakeSettings -> DataLakeSettings -> PutDataLakeSettings)
-> Lens
     PutDataLakeSettings
     PutDataLakeSettings
     DataLakeSettings
     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 :: PutDataLakeSettings -> Request PutDataLakeSettings
request = Service -> PutDataLakeSettings -> Request PutDataLakeSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutDataLakeSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutDataLakeSettings)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse PutDataLakeSettings))
-> Logger
-> Service
-> Proxy PutDataLakeSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutDataLakeSettings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutDataLakeSettingsResponse
PutDataLakeSettingsResponse'
            (Int -> PutDataLakeSettingsResponse)
-> Either String Int -> Either String PutDataLakeSettingsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutDataLakeSettings

instance Prelude.NFData PutDataLakeSettings

instance Core.ToHeaders PutDataLakeSettings where
  toHeaders :: PutDataLakeSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutDataLakeSettings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSLakeFormation.PutDataLakeSettings" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CatalogId" 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
catalogId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DataLakeSettings" Text -> DataLakeSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataLakeSettings
dataLakeSettings)
          ]
      )

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

instance Core.ToQuery PutDataLakeSettings where
  toQuery :: PutDataLakeSettings -> QueryString
toQuery = QueryString -> PutDataLakeSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(PutDataLakeSettingsResponse
 -> PutDataLakeSettingsResponse -> Bool)
-> (PutDataLakeSettingsResponse
    -> PutDataLakeSettingsResponse -> Bool)
-> Eq PutDataLakeSettingsResponse
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]
(Int -> ReadS PutDataLakeSettingsResponse)
-> ReadS [PutDataLakeSettingsResponse]
-> ReadPrec PutDataLakeSettingsResponse
-> ReadPrec [PutDataLakeSettingsResponse]
-> Read 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
(Int -> PutDataLakeSettingsResponse -> ShowS)
-> (PutDataLakeSettingsResponse -> String)
-> ([PutDataLakeSettingsResponse] -> ShowS)
-> Show PutDataLakeSettingsResponse
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.
 PutDataLakeSettingsResponse -> Rep PutDataLakeSettingsResponse x)
-> (forall x.
    Rep PutDataLakeSettingsResponse x -> PutDataLakeSettingsResponse)
-> Generic PutDataLakeSettingsResponse
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' :: Int -> PutDataLakeSettingsResponse
PutDataLakeSettingsResponse'
    { $sel:httpStatus:PutDataLakeSettingsResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
putDataLakeSettingsResponse_httpStatus :: Lens.Lens' PutDataLakeSettingsResponse Prelude.Int
putDataLakeSettingsResponse_httpStatus :: (Int -> f Int)
-> PutDataLakeSettingsResponse -> f PutDataLakeSettingsResponse
putDataLakeSettingsResponse_httpStatus = (PutDataLakeSettingsResponse -> Int)
-> (PutDataLakeSettingsResponse
    -> Int -> PutDataLakeSettingsResponse)
-> Lens
     PutDataLakeSettingsResponse PutDataLakeSettingsResponse Int Int
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