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