{-# 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.DatabaseInput 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 DatabaseInput = DatabaseInput'
{
DatabaseInput -> Maybe Text
locationUri :: Prelude.Maybe Prelude.Text,
DatabaseInput -> Maybe DatabaseIdentifier
targetDatabase :: Prelude.Maybe DatabaseIdentifier,
DatabaseInput -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
DatabaseInput -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
DatabaseInput -> Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Prelude.Maybe [PrincipalPermissions],
DatabaseInput -> Text
name :: Prelude.Text
}
deriving (DatabaseInput -> DatabaseInput -> Bool
(DatabaseInput -> DatabaseInput -> Bool)
-> (DatabaseInput -> DatabaseInput -> Bool) -> Eq DatabaseInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatabaseInput -> DatabaseInput -> Bool
$c/= :: DatabaseInput -> DatabaseInput -> Bool
== :: DatabaseInput -> DatabaseInput -> Bool
$c== :: DatabaseInput -> DatabaseInput -> Bool
Prelude.Eq, ReadPrec [DatabaseInput]
ReadPrec DatabaseInput
Int -> ReadS DatabaseInput
ReadS [DatabaseInput]
(Int -> ReadS DatabaseInput)
-> ReadS [DatabaseInput]
-> ReadPrec DatabaseInput
-> ReadPrec [DatabaseInput]
-> Read DatabaseInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatabaseInput]
$creadListPrec :: ReadPrec [DatabaseInput]
readPrec :: ReadPrec DatabaseInput
$creadPrec :: ReadPrec DatabaseInput
readList :: ReadS [DatabaseInput]
$creadList :: ReadS [DatabaseInput]
readsPrec :: Int -> ReadS DatabaseInput
$creadsPrec :: Int -> ReadS DatabaseInput
Prelude.Read, Int -> DatabaseInput -> ShowS
[DatabaseInput] -> ShowS
DatabaseInput -> String
(Int -> DatabaseInput -> ShowS)
-> (DatabaseInput -> String)
-> ([DatabaseInput] -> ShowS)
-> Show DatabaseInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatabaseInput] -> ShowS
$cshowList :: [DatabaseInput] -> ShowS
show :: DatabaseInput -> String
$cshow :: DatabaseInput -> String
showsPrec :: Int -> DatabaseInput -> ShowS
$cshowsPrec :: Int -> DatabaseInput -> ShowS
Prelude.Show, (forall x. DatabaseInput -> Rep DatabaseInput x)
-> (forall x. Rep DatabaseInput x -> DatabaseInput)
-> Generic DatabaseInput
forall x. Rep DatabaseInput x -> DatabaseInput
forall x. DatabaseInput -> Rep DatabaseInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatabaseInput x -> DatabaseInput
$cfrom :: forall x. DatabaseInput -> Rep DatabaseInput x
Prelude.Generic)
newDatabaseInput ::
Prelude.Text ->
DatabaseInput
newDatabaseInput :: Text -> DatabaseInput
newDatabaseInput Text
pName_ =
DatabaseInput' :: Maybe Text
-> Maybe DatabaseIdentifier
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe [PrincipalPermissions]
-> Text
-> DatabaseInput
DatabaseInput'
{ $sel:locationUri:DatabaseInput' :: Maybe Text
locationUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetDatabase:DatabaseInput' :: Maybe DatabaseIdentifier
targetDatabase = Maybe DatabaseIdentifier
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:DatabaseInput' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:description:DatabaseInput' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createTableDefaultPermissions:DatabaseInput' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
forall a. Maybe a
Prelude.Nothing,
$sel:name:DatabaseInput' :: Text
name = Text
pName_
}
databaseInput_locationUri :: Lens.Lens' DatabaseInput (Prelude.Maybe Prelude.Text)
databaseInput_locationUri :: (Maybe Text -> f (Maybe Text)) -> DatabaseInput -> f DatabaseInput
databaseInput_locationUri = (DatabaseInput -> Maybe Text)
-> (DatabaseInput -> Maybe Text -> DatabaseInput)
-> Lens DatabaseInput DatabaseInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseInput' {Maybe Text
locationUri :: Maybe Text
$sel:locationUri:DatabaseInput' :: DatabaseInput -> Maybe Text
locationUri} -> Maybe Text
locationUri) (\s :: DatabaseInput
s@DatabaseInput' {} Maybe Text
a -> DatabaseInput
s {$sel:locationUri:DatabaseInput' :: Maybe Text
locationUri = Maybe Text
a} :: DatabaseInput)
databaseInput_targetDatabase :: Lens.Lens' DatabaseInput (Prelude.Maybe DatabaseIdentifier)
databaseInput_targetDatabase :: (Maybe DatabaseIdentifier -> f (Maybe DatabaseIdentifier))
-> DatabaseInput -> f DatabaseInput
databaseInput_targetDatabase = (DatabaseInput -> Maybe DatabaseIdentifier)
-> (DatabaseInput -> Maybe DatabaseIdentifier -> DatabaseInput)
-> Lens
DatabaseInput
DatabaseInput
(Maybe DatabaseIdentifier)
(Maybe DatabaseIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseInput' {Maybe DatabaseIdentifier
targetDatabase :: Maybe DatabaseIdentifier
$sel:targetDatabase:DatabaseInput' :: DatabaseInput -> Maybe DatabaseIdentifier
targetDatabase} -> Maybe DatabaseIdentifier
targetDatabase) (\s :: DatabaseInput
s@DatabaseInput' {} Maybe DatabaseIdentifier
a -> DatabaseInput
s {$sel:targetDatabase:DatabaseInput' :: Maybe DatabaseIdentifier
targetDatabase = Maybe DatabaseIdentifier
a} :: DatabaseInput)
databaseInput_parameters :: Lens.Lens' DatabaseInput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
databaseInput_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DatabaseInput -> f DatabaseInput
databaseInput_parameters = (DatabaseInput -> Maybe (HashMap Text Text))
-> (DatabaseInput -> Maybe (HashMap Text Text) -> DatabaseInput)
-> Lens
DatabaseInput
DatabaseInput
(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 (\DatabaseInput' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:DatabaseInput' :: DatabaseInput -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: DatabaseInput
s@DatabaseInput' {} Maybe (HashMap Text Text)
a -> DatabaseInput
s {$sel:parameters:DatabaseInput' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: DatabaseInput) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DatabaseInput -> f DatabaseInput)
-> ((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)))
-> DatabaseInput
-> f DatabaseInput
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
databaseInput_description :: Lens.Lens' DatabaseInput (Prelude.Maybe Prelude.Text)
databaseInput_description :: (Maybe Text -> f (Maybe Text)) -> DatabaseInput -> f DatabaseInput
databaseInput_description = (DatabaseInput -> Maybe Text)
-> (DatabaseInput -> Maybe Text -> DatabaseInput)
-> Lens DatabaseInput DatabaseInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseInput' {Maybe Text
description :: Maybe Text
$sel:description:DatabaseInput' :: DatabaseInput -> Maybe Text
description} -> Maybe Text
description) (\s :: DatabaseInput
s@DatabaseInput' {} Maybe Text
a -> DatabaseInput
s {$sel:description:DatabaseInput' :: Maybe Text
description = Maybe Text
a} :: DatabaseInput)
databaseInput_createTableDefaultPermissions :: Lens.Lens' DatabaseInput (Prelude.Maybe [PrincipalPermissions])
databaseInput_createTableDefaultPermissions :: (Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DatabaseInput -> f DatabaseInput
databaseInput_createTableDefaultPermissions = (DatabaseInput -> Maybe [PrincipalPermissions])
-> (DatabaseInput -> Maybe [PrincipalPermissions] -> DatabaseInput)
-> Lens
DatabaseInput
DatabaseInput
(Maybe [PrincipalPermissions])
(Maybe [PrincipalPermissions])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseInput' {Maybe [PrincipalPermissions]
createTableDefaultPermissions :: Maybe [PrincipalPermissions]
$sel:createTableDefaultPermissions:DatabaseInput' :: DatabaseInput -> Maybe [PrincipalPermissions]
createTableDefaultPermissions} -> Maybe [PrincipalPermissions]
createTableDefaultPermissions) (\s :: DatabaseInput
s@DatabaseInput' {} Maybe [PrincipalPermissions]
a -> DatabaseInput
s {$sel:createTableDefaultPermissions:DatabaseInput' :: Maybe [PrincipalPermissions]
createTableDefaultPermissions = Maybe [PrincipalPermissions]
a} :: DatabaseInput) ((Maybe [PrincipalPermissions] -> f (Maybe [PrincipalPermissions]))
-> DatabaseInput -> f DatabaseInput)
-> ((Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> (Maybe [PrincipalPermissions]
-> f (Maybe [PrincipalPermissions]))
-> DatabaseInput
-> f DatabaseInput
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
databaseInput_name :: Lens.Lens' DatabaseInput Prelude.Text
databaseInput_name :: (Text -> f Text) -> DatabaseInput -> f DatabaseInput
databaseInput_name = (DatabaseInput -> Text)
-> (DatabaseInput -> Text -> DatabaseInput)
-> Lens DatabaseInput DatabaseInput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseInput' {Text
name :: Text
$sel:name:DatabaseInput' :: DatabaseInput -> Text
name} -> Text
name) (\s :: DatabaseInput
s@DatabaseInput' {} Text
a -> DatabaseInput
s {$sel:name:DatabaseInput' :: Text
name = Text
a} :: DatabaseInput)
instance Prelude.Hashable DatabaseInput
instance Prelude.NFData DatabaseInput
instance Core.ToJSON DatabaseInput where
toJSON :: DatabaseInput -> Value
toJSON DatabaseInput' {Maybe [PrincipalPermissions]
Maybe Text
Maybe (HashMap Text Text)
Maybe DatabaseIdentifier
Text
name :: Text
createTableDefaultPermissions :: Maybe [PrincipalPermissions]
description :: Maybe Text
parameters :: Maybe (HashMap Text Text)
targetDatabase :: Maybe DatabaseIdentifier
locationUri :: Maybe Text
$sel:name:DatabaseInput' :: DatabaseInput -> Text
$sel:createTableDefaultPermissions:DatabaseInput' :: DatabaseInput -> Maybe [PrincipalPermissions]
$sel:description:DatabaseInput' :: DatabaseInput -> Maybe Text
$sel:parameters:DatabaseInput' :: DatabaseInput -> Maybe (HashMap Text Text)
$sel:targetDatabase:DatabaseInput' :: DatabaseInput -> Maybe DatabaseIdentifier
$sel:locationUri:DatabaseInput' :: DatabaseInput -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LocationUri" 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
locationUri,
(Text
"TargetDatabase" Text -> DatabaseIdentifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DatabaseIdentifier -> Pair)
-> Maybe DatabaseIdentifier -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatabaseIdentifier
targetDatabase,
(Text
"Parameters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
parameters,
(Text
"Description" 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
description,
(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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)