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