{-# 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 #-}
module Amazonka.LakeFormation.Types.DataLakeSettings where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.Types.DataLakePrincipal
import Amazonka.LakeFormation.Types.PrincipalPermissions
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DataLakeSettings = DataLakeSettings'
{
DataLakeSettings -> Maybe [DataLakePrincipal]
dataLakeAdmins :: Prelude.Maybe [DataLakePrincipal],
DataLakeSettings -> Maybe [Text]
trustedResourceOwners :: Prelude.Maybe [Prelude.Text],
DataLakeSettings -> Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions :: Prelude.Maybe [PrincipalPermissions],
DataLakeSettings -> Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Prelude.Maybe [PrincipalPermissions]
}
deriving (DataLakeSettings -> DataLakeSettings -> Bool
(DataLakeSettings -> DataLakeSettings -> Bool)
-> (DataLakeSettings -> DataLakeSettings -> Bool)
-> Eq DataLakeSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataLakeSettings -> DataLakeSettings -> Bool
$c/= :: DataLakeSettings -> DataLakeSettings -> Bool
== :: DataLakeSettings -> DataLakeSettings -> Bool
$c== :: DataLakeSettings -> DataLakeSettings -> Bool
Prelude.Eq, ReadPrec [DataLakeSettings]
ReadPrec DataLakeSettings
Int -> ReadS DataLakeSettings
ReadS [DataLakeSettings]
(Int -> ReadS DataLakeSettings)
-> ReadS [DataLakeSettings]
-> ReadPrec DataLakeSettings
-> ReadPrec [DataLakeSettings]
-> Read DataLakeSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataLakeSettings]
$creadListPrec :: ReadPrec [DataLakeSettings]
readPrec :: ReadPrec DataLakeSettings
$creadPrec :: ReadPrec DataLakeSettings
readList :: ReadS [DataLakeSettings]
$creadList :: ReadS [DataLakeSettings]
readsPrec :: Int -> ReadS DataLakeSettings
$creadsPrec :: Int -> ReadS DataLakeSettings
Prelude.Read, Int -> DataLakeSettings -> ShowS
[DataLakeSettings] -> ShowS
DataLakeSettings -> String
(Int -> DataLakeSettings -> ShowS)
-> (DataLakeSettings -> String)
-> ([DataLakeSettings] -> ShowS)
-> Show DataLakeSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataLakeSettings] -> ShowS
$cshowList :: [DataLakeSettings] -> ShowS
show :: DataLakeSettings -> String
$cshow :: DataLakeSettings -> String
showsPrec :: Int -> DataLakeSettings -> ShowS
$cshowsPrec :: Int -> DataLakeSettings -> ShowS
Prelude.Show, (forall x. DataLakeSettings -> Rep DataLakeSettings x)
-> (forall x. Rep DataLakeSettings x -> DataLakeSettings)
-> Generic DataLakeSettings
forall x. Rep DataLakeSettings x -> DataLakeSettings
forall x. DataLakeSettings -> Rep DataLakeSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataLakeSettings x -> DataLakeSettings
$cfrom :: forall x. DataLakeSettings -> Rep DataLakeSettings x
Prelude.Generic)
newDataLakeSettings ::
DataLakeSettings
newDataLakeSettings :: DataLakeSettings
newDataLakeSettings =
DataLakeSettings' :: Maybe [DataLakePrincipal]
-> Maybe [Text]
-> Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions]
-> DataLakeSettings
DataLakeSettings'
{ $sel:dataLakeAdmins:DataLakeSettings' :: Maybe [DataLakePrincipal]
dataLakeAdmins = Maybe [DataLakePrincipal]
forall a. Maybe a
Prelude.Nothing,
$sel:trustedResourceOwners:DataLakeSettings' :: Maybe [Text]
trustedResourceOwners = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:createDatabaseDefaultPermissions:DataLakeSettings' :: Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions = Maybe [PrincipalPermissions]
forall a. Maybe a
Prelude.Nothing,
$sel:createTableDefaultPermissions:DataLakeSettings' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
forall a. Maybe a
Prelude.Nothing
}
dataLakeSettings_dataLakeAdmins :: Lens.Lens' DataLakeSettings (Prelude.Maybe [DataLakePrincipal])
dataLakeSettings_dataLakeAdmins :: (Maybe [DataLakePrincipal] -> f (Maybe [DataLakePrincipal]))
-> DataLakeSettings -> f DataLakeSettings
dataLakeSettings_dataLakeAdmins = (DataLakeSettings -> Maybe [DataLakePrincipal])
-> (DataLakeSettings
-> Maybe [DataLakePrincipal] -> DataLakeSettings)
-> Lens
DataLakeSettings
DataLakeSettings
(Maybe [DataLakePrincipal])
(Maybe [DataLakePrincipal])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataLakeSettings' {Maybe [DataLakePrincipal]
dataLakeAdmins :: Maybe [DataLakePrincipal]
$sel:dataLakeAdmins:DataLakeSettings' :: DataLakeSettings -> Maybe [DataLakePrincipal]
dataLakeAdmins} -> Maybe [DataLakePrincipal]
dataLakeAdmins) (\s :: DataLakeSettings
s@DataLakeSettings' {} Maybe [DataLakePrincipal]
a -> DataLakeSettings
s {$sel:dataLakeAdmins:DataLakeSettings' :: Maybe [DataLakePrincipal]
dataLakeAdmins = Maybe [DataLakePrincipal]
a} :: DataLakeSettings) ((Maybe [DataLakePrincipal] -> f (Maybe [DataLakePrincipal]))
-> DataLakeSettings -> f DataLakeSettings)
-> ((Maybe [DataLakePrincipal] -> f (Maybe [DataLakePrincipal]))
-> Maybe [DataLakePrincipal] -> f (Maybe [DataLakePrincipal]))
-> (Maybe [DataLakePrincipal] -> f (Maybe [DataLakePrincipal]))
-> DataLakeSettings
-> f DataLakeSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DataLakePrincipal]
[DataLakePrincipal]
[DataLakePrincipal]
[DataLakePrincipal]
-> Iso
(Maybe [DataLakePrincipal])
(Maybe [DataLakePrincipal])
(Maybe [DataLakePrincipal])
(Maybe [DataLakePrincipal])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DataLakePrincipal]
[DataLakePrincipal]
[DataLakePrincipal]
[DataLakePrincipal]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataLakeSettings_trustedResourceOwners :: Lens.Lens' DataLakeSettings (Prelude.Maybe [Prelude.Text])
dataLakeSettings_trustedResourceOwners :: (Maybe [Text] -> f (Maybe [Text]))
-> DataLakeSettings -> f DataLakeSettings
dataLakeSettings_trustedResourceOwners = (DataLakeSettings -> Maybe [Text])
-> (DataLakeSettings -> Maybe [Text] -> DataLakeSettings)
-> Lens
DataLakeSettings DataLakeSettings (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataLakeSettings' {Maybe [Text]
trustedResourceOwners :: Maybe [Text]
$sel:trustedResourceOwners:DataLakeSettings' :: DataLakeSettings -> Maybe [Text]
trustedResourceOwners} -> Maybe [Text]
trustedResourceOwners) (\s :: DataLakeSettings
s@DataLakeSettings' {} Maybe [Text]
a -> DataLakeSettings
s {$sel:trustedResourceOwners:DataLakeSettings' :: Maybe [Text]
trustedResourceOwners = Maybe [Text]
a} :: DataLakeSettings) ((Maybe [Text] -> f (Maybe [Text]))
-> DataLakeSettings -> f DataLakeSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DataLakeSettings
-> f DataLakeSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataLakeSettings_createDatabaseDefaultPermissions :: Lens.Lens' DataLakeSettings (Prelude.Maybe [PrincipalPermissions])
dataLakeSettings_createDatabaseDefaultPermissions :: (Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings -> f DataLakeSettings
dataLakeSettings_createDatabaseDefaultPermissions = (DataLakeSettings -> Maybe [PrincipalPermissions])
-> (DataLakeSettings
-> Maybe [PrincipalPermissions] -> DataLakeSettings)
-> Lens
DataLakeSettings
DataLakeSettings
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataLakeSettings' {Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions :: Maybe [PrincipalPermissions]
$sel:createDatabaseDefaultPermissions:DataLakeSettings' :: DataLakeSettings -> Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions} -> Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions) (\s :: DataLakeSettings
s@DataLakeSettings' {} Maybe [PrincipalPermissions]
a -> DataLakeSettings
s {$sel:createDatabaseDefaultPermissions:DataLakeSettings' :: Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions = Maybe [PrincipalPermissions]
a} :: DataLakeSettings) ((Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings -> f DataLakeSettings)
-> ((Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> (Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings
-> f DataLakeSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
-> Iso
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataLakeSettings_createTableDefaultPermissions :: Lens.Lens' DataLakeSettings (Prelude.Maybe [PrincipalPermissions])
dataLakeSettings_createTableDefaultPermissions :: (Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings -> f DataLakeSettings
dataLakeSettings_createTableDefaultPermissions = (DataLakeSettings -> Maybe [PrincipalPermissions])
-> (DataLakeSettings
-> Maybe [PrincipalPermissions] -> DataLakeSettings)
-> Lens
DataLakeSettings
DataLakeSettings
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataLakeSettings' {Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Maybe [PrincipalPermissions]
$sel:createTableDefaultPermissions:DataLakeSettings' :: DataLakeSettings -> Maybe [PrincipalPermissions]
createTableDefaultPermissions} -> Maybe [PrincipalPermissions]
createTableDefaultPermissions) (\s :: DataLakeSettings
s@DataLakeSettings' {} Maybe [PrincipalPermissions]
a -> DataLakeSettings
s {$sel:createTableDefaultPermissions:DataLakeSettings' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
a} :: DataLakeSettings) ((Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings -> f DataLakeSettings)
-> ((Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> (Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> DataLakeSettings
-> f DataLakeSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
-> Iso
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
[PrincipalPermissions]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DataLakeSettings where
parseJSON :: Value -> Parser DataLakeSettings
parseJSON =
String
-> (Object -> Parser DataLakeSettings)
-> Value
-> Parser DataLakeSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataLakeSettings"
( \Object
x ->
Maybe [DataLakePrincipal]
-> Maybe [Text]
-> Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions]
-> DataLakeSettings
DataLakeSettings'
(Maybe [DataLakePrincipal]
-> Maybe [Text]
-> Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions]
-> DataLakeSettings)
-> Parser (Maybe [DataLakePrincipal])
-> Parser
(Maybe [Text]
-> Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions]
-> DataLakeSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [DataLakePrincipal]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataLakeAdmins" Parser (Maybe (Maybe [DataLakePrincipal]))
-> Maybe [DataLakePrincipal] -> Parser (Maybe [DataLakePrincipal])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DataLakePrincipal]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe [Text]
-> Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions]
-> DataLakeSettings)
-> Parser (Maybe [Text])
-> Parser
(Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions] -> DataLakeSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrustedResourceOwners"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe [PrincipalPermissions]
-> Maybe [PrincipalPermissions] -> DataLakeSettings)
-> Parser (Maybe [PrincipalPermissions])
-> Parser (Maybe [PrincipalPermissions] -> DataLakeSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [PrincipalPermissions]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateDatabaseDefaultPermissions"
Parser (Maybe (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> Parser (Maybe [PrincipalPermissions])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PrincipalPermissions]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe [PrincipalPermissions] -> DataLakeSettings)
-> Parser (Maybe [PrincipalPermissions]) -> Parser DataLakeSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [PrincipalPermissions]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateTableDefaultPermissions"
Parser (Maybe (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> Parser (Maybe [PrincipalPermissions])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PrincipalPermissions]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable DataLakeSettings
instance Prelude.NFData DataLakeSettings
instance Core.ToJSON DataLakeSettings where
toJSON :: DataLakeSettings -> Value
toJSON DataLakeSettings' {Maybe [Text]
Maybe [DataLakePrincipal]
Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions :: Maybe [PrincipalPermissions]
trustedResourceOwners :: Maybe [Text]
dataLakeAdmins :: Maybe [DataLakePrincipal]
$sel:createTableDefaultPermissions:DataLakeSettings' :: DataLakeSettings -> Maybe [PrincipalPermissions]
$sel:createDatabaseDefaultPermissions:DataLakeSettings' :: DataLakeSettings -> Maybe [PrincipalPermissions]
$sel:trustedResourceOwners:DataLakeSettings' :: DataLakeSettings -> Maybe [Text]
$sel:dataLakeAdmins:DataLakeSettings' :: DataLakeSettings -> Maybe [DataLakePrincipal]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DataLakeAdmins" Text -> [DataLakePrincipal] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([DataLakePrincipal] -> Pair)
-> Maybe [DataLakePrincipal] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DataLakePrincipal]
dataLakeAdmins,
(Text
"TrustedResourceOwners" 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]
trustedResourceOwners,
(Text
"CreateDatabaseDefaultPermissions" Text -> [PrincipalPermissions] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PrincipalPermissions] -> Pair)
-> Maybe [PrincipalPermissions] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PrincipalPermissions]
createDatabaseDefaultPermissions,
(Text
"CreateTableDefaultPermissions" Text -> [PrincipalPermissions] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PrincipalPermissions] -> Pair)
-> Maybe [PrincipalPermissions] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PrincipalPermissions]
createTableDefaultPermissions
]
)