{-# 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.DatabaseIdentifier where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DatabaseIdentifier = DatabaseIdentifier'
{
DatabaseIdentifier -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
DatabaseIdentifier -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text
}
deriving (DatabaseIdentifier -> DatabaseIdentifier -> Bool
(DatabaseIdentifier -> DatabaseIdentifier -> Bool)
-> (DatabaseIdentifier -> DatabaseIdentifier -> Bool)
-> Eq DatabaseIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatabaseIdentifier -> DatabaseIdentifier -> Bool
$c/= :: DatabaseIdentifier -> DatabaseIdentifier -> Bool
== :: DatabaseIdentifier -> DatabaseIdentifier -> Bool
$c== :: DatabaseIdentifier -> DatabaseIdentifier -> Bool
Prelude.Eq, ReadPrec [DatabaseIdentifier]
ReadPrec DatabaseIdentifier
Int -> ReadS DatabaseIdentifier
ReadS [DatabaseIdentifier]
(Int -> ReadS DatabaseIdentifier)
-> ReadS [DatabaseIdentifier]
-> ReadPrec DatabaseIdentifier
-> ReadPrec [DatabaseIdentifier]
-> Read DatabaseIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatabaseIdentifier]
$creadListPrec :: ReadPrec [DatabaseIdentifier]
readPrec :: ReadPrec DatabaseIdentifier
$creadPrec :: ReadPrec DatabaseIdentifier
readList :: ReadS [DatabaseIdentifier]
$creadList :: ReadS [DatabaseIdentifier]
readsPrec :: Int -> ReadS DatabaseIdentifier
$creadsPrec :: Int -> ReadS DatabaseIdentifier
Prelude.Read, Int -> DatabaseIdentifier -> ShowS
[DatabaseIdentifier] -> ShowS
DatabaseIdentifier -> String
(Int -> DatabaseIdentifier -> ShowS)
-> (DatabaseIdentifier -> String)
-> ([DatabaseIdentifier] -> ShowS)
-> Show DatabaseIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatabaseIdentifier] -> ShowS
$cshowList :: [DatabaseIdentifier] -> ShowS
show :: DatabaseIdentifier -> String
$cshow :: DatabaseIdentifier -> String
showsPrec :: Int -> DatabaseIdentifier -> ShowS
$cshowsPrec :: Int -> DatabaseIdentifier -> ShowS
Prelude.Show, (forall x. DatabaseIdentifier -> Rep DatabaseIdentifier x)
-> (forall x. Rep DatabaseIdentifier x -> DatabaseIdentifier)
-> Generic DatabaseIdentifier
forall x. Rep DatabaseIdentifier x -> DatabaseIdentifier
forall x. DatabaseIdentifier -> Rep DatabaseIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatabaseIdentifier x -> DatabaseIdentifier
$cfrom :: forall x. DatabaseIdentifier -> Rep DatabaseIdentifier x
Prelude.Generic)
newDatabaseIdentifier ::
DatabaseIdentifier
newDatabaseIdentifier :: DatabaseIdentifier
newDatabaseIdentifier =
DatabaseIdentifier' :: Maybe Text -> Maybe Text -> DatabaseIdentifier
DatabaseIdentifier'
{ $sel:catalogId:DatabaseIdentifier' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:DatabaseIdentifier' :: Maybe Text
databaseName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
databaseIdentifier_catalogId :: Lens.Lens' DatabaseIdentifier (Prelude.Maybe Prelude.Text)
databaseIdentifier_catalogId :: (Maybe Text -> f (Maybe Text))
-> DatabaseIdentifier -> f DatabaseIdentifier
databaseIdentifier_catalogId = (DatabaseIdentifier -> Maybe Text)
-> (DatabaseIdentifier -> Maybe Text -> DatabaseIdentifier)
-> Lens
DatabaseIdentifier DatabaseIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseIdentifier' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DatabaseIdentifier' :: DatabaseIdentifier -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DatabaseIdentifier
s@DatabaseIdentifier' {} Maybe Text
a -> DatabaseIdentifier
s {$sel:catalogId:DatabaseIdentifier' :: Maybe Text
catalogId = Maybe Text
a} :: DatabaseIdentifier)
databaseIdentifier_databaseName :: Lens.Lens' DatabaseIdentifier (Prelude.Maybe Prelude.Text)
databaseIdentifier_databaseName :: (Maybe Text -> f (Maybe Text))
-> DatabaseIdentifier -> f DatabaseIdentifier
databaseIdentifier_databaseName = (DatabaseIdentifier -> Maybe Text)
-> (DatabaseIdentifier -> Maybe Text -> DatabaseIdentifier)
-> Lens
DatabaseIdentifier DatabaseIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatabaseIdentifier' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:DatabaseIdentifier' :: DatabaseIdentifier -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: DatabaseIdentifier
s@DatabaseIdentifier' {} Maybe Text
a -> DatabaseIdentifier
s {$sel:databaseName:DatabaseIdentifier' :: Maybe Text
databaseName = Maybe Text
a} :: DatabaseIdentifier)
instance Core.FromJSON DatabaseIdentifier where
parseJSON :: Value -> Parser DatabaseIdentifier
parseJSON =
String
-> (Object -> Parser DatabaseIdentifier)
-> Value
-> Parser DatabaseIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DatabaseIdentifier"
( \Object
x ->
Maybe Text -> Maybe Text -> DatabaseIdentifier
DatabaseIdentifier'
(Maybe Text -> Maybe Text -> DatabaseIdentifier)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DatabaseIdentifier)
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
"CatalogId")
Parser (Maybe Text -> DatabaseIdentifier)
-> Parser (Maybe Text) -> Parser DatabaseIdentifier
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
"DatabaseName")
)
instance Prelude.Hashable DatabaseIdentifier
instance Prelude.NFData DatabaseIdentifier
instance Core.ToJSON DatabaseIdentifier where
toJSON :: DatabaseIdentifier -> Value
toJSON DatabaseIdentifier' {Maybe Text
databaseName :: Maybe Text
catalogId :: Maybe Text
$sel:databaseName:DatabaseIdentifier' :: DatabaseIdentifier -> Maybe Text
$sel:catalogId:DatabaseIdentifier' :: DatabaseIdentifier -> 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,
(Text
"DatabaseName" 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
databaseName
]
)