{-# 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.Glue.Types.Database where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.DatabaseIdentifier
import Amazonka.Glue.Types.PrincipalPermissions
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Database = Database'
{
Database -> Maybe Text
locationUri :: Prelude.Maybe Prelude.Text,
Database -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
Database -> Maybe DatabaseIdentifier
targetDatabase :: Prelude.Maybe DatabaseIdentifier,
Database -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Database -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Database -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX,
Database -> Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Prelude.Maybe [PrincipalPermissions],
Database -> Text
name :: Prelude.Text
}
deriving (Database -> Database -> Bool
(Database -> Database -> Bool)
-> (Database -> Database -> Bool) -> Eq Database
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Database -> Database -> Bool
$c/= :: Database -> Database -> Bool
== :: Database -> Database -> Bool
$c== :: Database -> Database -> Bool
Prelude.Eq, ReadPrec [Database]
ReadPrec Database
Int -> ReadS Database
ReadS [Database]
(Int -> ReadS Database)
-> ReadS [Database]
-> ReadPrec Database
-> ReadPrec [Database]
-> Read Database
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Database]
$creadListPrec :: ReadPrec [Database]
readPrec :: ReadPrec Database
$creadPrec :: ReadPrec Database
readList :: ReadS [Database]
$creadList :: ReadS [Database]
readsPrec :: Int -> ReadS Database
$creadsPrec :: Int -> ReadS Database
Prelude.Read, Int -> Database -> ShowS
[Database] -> ShowS
Database -> String
(Int -> Database -> ShowS)
-> (Database -> String) -> ([Database] -> ShowS) -> Show Database
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Database] -> ShowS
$cshowList :: [Database] -> ShowS
show :: Database -> String
$cshow :: Database -> String
showsPrec :: Int -> Database -> ShowS
$cshowsPrec :: Int -> Database -> ShowS
Prelude.Show, (forall x. Database -> Rep Database x)
-> (forall x. Rep Database x -> Database) -> Generic Database
forall x. Rep Database x -> Database
forall x. Database -> Rep Database x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Database x -> Database
$cfrom :: forall x. Database -> Rep Database x
Prelude.Generic)
newDatabase ::
Prelude.Text ->
Database
newDatabase :: Text -> Database
newDatabase Text
pName_ =
Database' :: Maybe Text
-> Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database
Database'
{ $sel:locationUri:Database' :: Maybe Text
locationUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:catalogId:Database' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetDatabase:Database' :: Maybe DatabaseIdentifier
targetDatabase = Maybe DatabaseIdentifier
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:Database' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:description:Database' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createTime:Database' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:createTableDefaultPermissions:Database' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
forall a. Maybe a
Prelude.Nothing,
$sel:name:Database' :: Text
name = Text
pName_
}
database_locationUri :: Lens.Lens' Database (Prelude.Maybe Prelude.Text)
database_locationUri :: (Maybe Text -> f (Maybe Text)) -> Database -> f Database
database_locationUri = (Database -> Maybe Text)
-> (Database -> Maybe Text -> Database)
-> Lens Database Database (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe Text
locationUri :: Maybe Text
$sel:locationUri:Database' :: Database -> Maybe Text
locationUri} -> Maybe Text
locationUri) (\s :: Database
s@Database' {} Maybe Text
a -> Database
s {$sel:locationUri:Database' :: Maybe Text
locationUri = Maybe Text
a} :: Database)
database_catalogId :: Lens.Lens' Database (Prelude.Maybe Prelude.Text)
database_catalogId :: (Maybe Text -> f (Maybe Text)) -> Database -> f Database
database_catalogId = (Database -> Maybe Text)
-> (Database -> Maybe Text -> Database)
-> Lens Database Database (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:Database' :: Database -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: Database
s@Database' {} Maybe Text
a -> Database
s {$sel:catalogId:Database' :: Maybe Text
catalogId = Maybe Text
a} :: Database)
database_targetDatabase :: Lens.Lens' Database (Prelude.Maybe DatabaseIdentifier)
database_targetDatabase :: (Maybe DatabaseIdentifier -> f (Maybe DatabaseIdentifier))
-> Database -> f Database
database_targetDatabase = (Database -> Maybe DatabaseIdentifier)
-> (Database -> Maybe DatabaseIdentifier -> Database)
-> Lens
Database
Database
(Maybe DatabaseIdentifier)
(Maybe DatabaseIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe DatabaseIdentifier
targetDatabase :: Maybe DatabaseIdentifier
$sel:targetDatabase:Database' :: Database -> Maybe DatabaseIdentifier
targetDatabase} -> Maybe DatabaseIdentifier
targetDatabase) (\s :: Database
s@Database' {} Maybe DatabaseIdentifier
a -> Database
s {$sel:targetDatabase:Database' :: Maybe DatabaseIdentifier
targetDatabase = Maybe DatabaseIdentifier
a} :: Database)
database_parameters :: Lens.Lens' Database (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
database_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Database -> f Database
database_parameters = (Database -> Maybe (HashMap Text Text))
-> (Database -> Maybe (HashMap Text Text) -> Database)
-> Lens
Database
Database
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:Database' :: Database -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: Database
s@Database' {} Maybe (HashMap Text Text)
a -> Database
s {$sel:parameters:Database' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: Database) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Database -> f Database)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Database
-> f Database
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
database_description :: Lens.Lens' Database (Prelude.Maybe Prelude.Text)
database_description :: (Maybe Text -> f (Maybe Text)) -> Database -> f Database
database_description = (Database -> Maybe Text)
-> (Database -> Maybe Text -> Database)
-> Lens Database Database (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe Text
description :: Maybe Text
$sel:description:Database' :: Database -> Maybe Text
description} -> Maybe Text
description) (\s :: Database
s@Database' {} Maybe Text
a -> Database
s {$sel:description:Database' :: Maybe Text
description = Maybe Text
a} :: Database)
database_createTime :: Lens.Lens' Database (Prelude.Maybe Prelude.UTCTime)
database_createTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Database -> f Database
database_createTime = (Database -> Maybe POSIX)
-> (Database -> Maybe POSIX -> Database)
-> Lens Database Database (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:Database' :: Database -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: Database
s@Database' {} Maybe POSIX
a -> Database
s {$sel:createTime:Database' :: Maybe POSIX
createTime = Maybe POSIX
a} :: Database) ((Maybe POSIX -> f (Maybe POSIX)) -> Database -> f Database)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Database
-> f Database
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
database_createTableDefaultPermissions :: Lens.Lens' Database (Prelude.Maybe [PrincipalPermissions])
database_createTableDefaultPermissions :: (Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> Database -> f Database
database_createTableDefaultPermissions = (Database -> Maybe [PrincipalPermissions])
-> (Database -> Maybe [PrincipalPermissions] -> Database)
-> Lens
Database
Database
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Maybe [PrincipalPermissions]
$sel:createTableDefaultPermissions:Database' :: Database -> Maybe [PrincipalPermissions]
createTableDefaultPermissions} -> Maybe [PrincipalPermissions]
createTableDefaultPermissions) (\s :: Database
s@Database' {} Maybe [PrincipalPermissions]
a -> Database
s {$sel:createTableDefaultPermissions:Database' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
a} :: Database) ((Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> Database -> f Database)
-> ((Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> (Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> Database
-> f Database
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
database_name :: Lens.Lens' Database Prelude.Text
database_name :: (Text -> f Text) -> Database -> f Database
database_name = (Database -> Text)
-> (Database -> Text -> Database)
-> Lens Database Database Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Database' {Text
name :: Text
$sel:name:Database' :: Database -> Text
name} -> Text
name) (\s :: Database
s@Database' {} Text
a -> Database
s {$sel:name:Database' :: Text
name = Text
a} :: Database)
instance Core.FromJSON Database where
parseJSON :: Value -> Parser Database
parseJSON =
String -> (Object -> Parser Database) -> Value -> Parser Database
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Database"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database
Database'
(Maybe Text
-> Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
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
"LocationUri")
Parser
(Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
-> Parser (Maybe Text)
-> Parser
(Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
forall (f :: * -> *) a b. Applicative f => 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
"CatalogId")
Parser
(Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
-> Parser (Maybe DatabaseIdentifier)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatabaseIdentifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetDatabase")
Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe [PrincipalPermissions]
-> Text
-> Database)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text
-> Maybe POSIX -> Maybe [PrincipalPermissions] -> Text -> Database)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parameters" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe POSIX -> Maybe [PrincipalPermissions] -> Text -> Database)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX -> Maybe [PrincipalPermissions] -> Text -> Database)
forall (f :: * -> *) a b. Applicative f => 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
"Description")
Parser
(Maybe POSIX -> Maybe [PrincipalPermissions] -> Text -> Database)
-> Parser (Maybe POSIX)
-> Parser (Maybe [PrincipalPermissions] -> Text -> Database)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateTime")
Parser (Maybe [PrincipalPermissions] -> Text -> Database)
-> Parser (Maybe [PrincipalPermissions])
-> Parser (Text -> Database)
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
)
Parser (Text -> Database) -> Parser Text -> Parser Database
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
)
instance Prelude.Hashable Database
instance Prelude.NFData Database