{-# 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.Athena.Types.TableMetadata where
import Amazonka.Athena.Types.Column
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TableMetadata = TableMetadata'
{
TableMetadata -> Maybe Text
tableType :: Prelude.Maybe Prelude.Text,
TableMetadata -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
TableMetadata -> Maybe [Column]
columns :: Prelude.Maybe [Column],
TableMetadata -> Maybe POSIX
lastAccessTime :: Prelude.Maybe Core.POSIX,
TableMetadata -> Maybe [Column]
partitionKeys :: Prelude.Maybe [Column],
TableMetadata -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX,
TableMetadata -> Text
name :: Prelude.Text
}
deriving (TableMetadata -> TableMetadata -> Bool
(TableMetadata -> TableMetadata -> Bool)
-> (TableMetadata -> TableMetadata -> Bool) -> Eq TableMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableMetadata -> TableMetadata -> Bool
$c/= :: TableMetadata -> TableMetadata -> Bool
== :: TableMetadata -> TableMetadata -> Bool
$c== :: TableMetadata -> TableMetadata -> Bool
Prelude.Eq, ReadPrec [TableMetadata]
ReadPrec TableMetadata
Int -> ReadS TableMetadata
ReadS [TableMetadata]
(Int -> ReadS TableMetadata)
-> ReadS [TableMetadata]
-> ReadPrec TableMetadata
-> ReadPrec [TableMetadata]
-> Read TableMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableMetadata]
$creadListPrec :: ReadPrec [TableMetadata]
readPrec :: ReadPrec TableMetadata
$creadPrec :: ReadPrec TableMetadata
readList :: ReadS [TableMetadata]
$creadList :: ReadS [TableMetadata]
readsPrec :: Int -> ReadS TableMetadata
$creadsPrec :: Int -> ReadS TableMetadata
Prelude.Read, Int -> TableMetadata -> ShowS
[TableMetadata] -> ShowS
TableMetadata -> String
(Int -> TableMetadata -> ShowS)
-> (TableMetadata -> String)
-> ([TableMetadata] -> ShowS)
-> Show TableMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableMetadata] -> ShowS
$cshowList :: [TableMetadata] -> ShowS
show :: TableMetadata -> String
$cshow :: TableMetadata -> String
showsPrec :: Int -> TableMetadata -> ShowS
$cshowsPrec :: Int -> TableMetadata -> ShowS
Prelude.Show, (forall x. TableMetadata -> Rep TableMetadata x)
-> (forall x. Rep TableMetadata x -> TableMetadata)
-> Generic TableMetadata
forall x. Rep TableMetadata x -> TableMetadata
forall x. TableMetadata -> Rep TableMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableMetadata x -> TableMetadata
$cfrom :: forall x. TableMetadata -> Rep TableMetadata x
Prelude.Generic)
newTableMetadata ::
Prelude.Text ->
TableMetadata
newTableMetadata :: Text -> TableMetadata
newTableMetadata Text
pName_ =
TableMetadata' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata
TableMetadata'
{ $sel:tableType:TableMetadata' :: Maybe Text
tableType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:parameters:TableMetadata' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:columns:TableMetadata' :: Maybe [Column]
columns = Maybe [Column]
forall a. Maybe a
Prelude.Nothing,
$sel:lastAccessTime:TableMetadata' :: Maybe POSIX
lastAccessTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:partitionKeys:TableMetadata' :: Maybe [Column]
partitionKeys = Maybe [Column]
forall a. Maybe a
Prelude.Nothing,
$sel:createTime:TableMetadata' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:name:TableMetadata' :: Text
name = Text
pName_
}
tableMetadata_tableType :: Lens.Lens' TableMetadata (Prelude.Maybe Prelude.Text)
tableMetadata_tableType :: (Maybe Text -> f (Maybe Text)) -> TableMetadata -> f TableMetadata
tableMetadata_tableType = (TableMetadata -> Maybe Text)
-> (TableMetadata -> Maybe Text -> TableMetadata)
-> Lens TableMetadata TableMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Maybe Text
tableType :: Maybe Text
$sel:tableType:TableMetadata' :: TableMetadata -> Maybe Text
tableType} -> Maybe Text
tableType) (\s :: TableMetadata
s@TableMetadata' {} Maybe Text
a -> TableMetadata
s {$sel:tableType:TableMetadata' :: Maybe Text
tableType = Maybe Text
a} :: TableMetadata)
tableMetadata_parameters :: Lens.Lens' TableMetadata (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
tableMetadata_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TableMetadata -> f TableMetadata
tableMetadata_parameters = (TableMetadata -> Maybe (HashMap Text Text))
-> (TableMetadata -> Maybe (HashMap Text Text) -> TableMetadata)
-> Lens
TableMetadata
TableMetadata
(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 (\TableMetadata' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:TableMetadata' :: TableMetadata -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: TableMetadata
s@TableMetadata' {} Maybe (HashMap Text Text)
a -> TableMetadata
s {$sel:parameters:TableMetadata' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: TableMetadata) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TableMetadata -> f TableMetadata)
-> ((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)))
-> TableMetadata
-> f TableMetadata
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
tableMetadata_columns :: Lens.Lens' TableMetadata (Prelude.Maybe [Column])
tableMetadata_columns :: (Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata -> f TableMetadata
tableMetadata_columns = (TableMetadata -> Maybe [Column])
-> (TableMetadata -> Maybe [Column] -> TableMetadata)
-> Lens
TableMetadata TableMetadata (Maybe [Column]) (Maybe [Column])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Maybe [Column]
columns :: Maybe [Column]
$sel:columns:TableMetadata' :: TableMetadata -> Maybe [Column]
columns} -> Maybe [Column]
columns) (\s :: TableMetadata
s@TableMetadata' {} Maybe [Column]
a -> TableMetadata
s {$sel:columns:TableMetadata' :: Maybe [Column]
columns = Maybe [Column]
a} :: TableMetadata) ((Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata -> f TableMetadata)
-> ((Maybe [Column] -> f (Maybe [Column]))
-> Maybe [Column] -> f (Maybe [Column]))
-> (Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata
-> f TableMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Column] [Column] [Column] [Column]
-> Iso
(Maybe [Column]) (Maybe [Column]) (Maybe [Column]) (Maybe [Column])
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 [Column] [Column] [Column] [Column]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
tableMetadata_lastAccessTime :: Lens.Lens' TableMetadata (Prelude.Maybe Prelude.UTCTime)
tableMetadata_lastAccessTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TableMetadata -> f TableMetadata
tableMetadata_lastAccessTime = (TableMetadata -> Maybe POSIX)
-> (TableMetadata -> Maybe POSIX -> TableMetadata)
-> Lens TableMetadata TableMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Maybe POSIX
lastAccessTime :: Maybe POSIX
$sel:lastAccessTime:TableMetadata' :: TableMetadata -> Maybe POSIX
lastAccessTime} -> Maybe POSIX
lastAccessTime) (\s :: TableMetadata
s@TableMetadata' {} Maybe POSIX
a -> TableMetadata
s {$sel:lastAccessTime:TableMetadata' :: Maybe POSIX
lastAccessTime = Maybe POSIX
a} :: TableMetadata) ((Maybe POSIX -> f (Maybe POSIX))
-> TableMetadata -> f TableMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TableMetadata
-> f TableMetadata
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
tableMetadata_partitionKeys :: Lens.Lens' TableMetadata (Prelude.Maybe [Column])
tableMetadata_partitionKeys :: (Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata -> f TableMetadata
tableMetadata_partitionKeys = (TableMetadata -> Maybe [Column])
-> (TableMetadata -> Maybe [Column] -> TableMetadata)
-> Lens
TableMetadata TableMetadata (Maybe [Column]) (Maybe [Column])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Maybe [Column]
partitionKeys :: Maybe [Column]
$sel:partitionKeys:TableMetadata' :: TableMetadata -> Maybe [Column]
partitionKeys} -> Maybe [Column]
partitionKeys) (\s :: TableMetadata
s@TableMetadata' {} Maybe [Column]
a -> TableMetadata
s {$sel:partitionKeys:TableMetadata' :: Maybe [Column]
partitionKeys = Maybe [Column]
a} :: TableMetadata) ((Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata -> f TableMetadata)
-> ((Maybe [Column] -> f (Maybe [Column]))
-> Maybe [Column] -> f (Maybe [Column]))
-> (Maybe [Column] -> f (Maybe [Column]))
-> TableMetadata
-> f TableMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Column] [Column] [Column] [Column]
-> Iso
(Maybe [Column]) (Maybe [Column]) (Maybe [Column]) (Maybe [Column])
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 [Column] [Column] [Column] [Column]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
tableMetadata_createTime :: Lens.Lens' TableMetadata (Prelude.Maybe Prelude.UTCTime)
tableMetadata_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TableMetadata -> f TableMetadata
tableMetadata_createTime = (TableMetadata -> Maybe POSIX)
-> (TableMetadata -> Maybe POSIX -> TableMetadata)
-> Lens TableMetadata TableMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:TableMetadata' :: TableMetadata -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: TableMetadata
s@TableMetadata' {} Maybe POSIX
a -> TableMetadata
s {$sel:createTime:TableMetadata' :: Maybe POSIX
createTime = Maybe POSIX
a} :: TableMetadata) ((Maybe POSIX -> f (Maybe POSIX))
-> TableMetadata -> f TableMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TableMetadata
-> f TableMetadata
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
tableMetadata_name :: Lens.Lens' TableMetadata Prelude.Text
tableMetadata_name :: (Text -> f Text) -> TableMetadata -> f TableMetadata
tableMetadata_name = (TableMetadata -> Text)
-> (TableMetadata -> Text -> TableMetadata)
-> Lens TableMetadata TableMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMetadata' {Text
name :: Text
$sel:name:TableMetadata' :: TableMetadata -> Text
name} -> Text
name) (\s :: TableMetadata
s@TableMetadata' {} Text
a -> TableMetadata
s {$sel:name:TableMetadata' :: Text
name = Text
a} :: TableMetadata)
instance Core.FromJSON TableMetadata where
parseJSON :: Value -> Parser TableMetadata
parseJSON =
String
-> (Object -> Parser TableMetadata)
-> Value
-> Parser TableMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TableMetadata"
( \Object
x ->
Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata
TableMetadata'
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata)
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
"TableType")
Parser
(Maybe (HashMap Text Text)
-> Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata)
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 [Column]
-> Maybe POSIX
-> Maybe [Column]
-> Maybe POSIX
-> Text
-> TableMetadata)
-> Parser (Maybe [Column])
-> Parser
(Maybe POSIX
-> Maybe [Column] -> Maybe POSIX -> Text -> TableMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Column]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Columns" Parser (Maybe (Maybe [Column]))
-> Maybe [Column] -> Parser (Maybe [Column])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Column]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe POSIX
-> Maybe [Column] -> Maybe POSIX -> Text -> TableMetadata)
-> Parser (Maybe POSIX)
-> Parser (Maybe [Column] -> Maybe POSIX -> Text -> TableMetadata)
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
"LastAccessTime")
Parser (Maybe [Column] -> Maybe POSIX -> Text -> TableMetadata)
-> Parser (Maybe [Column])
-> Parser (Maybe POSIX -> Text -> TableMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Column]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PartitionKeys" Parser (Maybe (Maybe [Column]))
-> Maybe [Column] -> Parser (Maybe [Column])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Column]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe POSIX -> Text -> TableMetadata)
-> Parser (Maybe POSIX) -> Parser (Text -> TableMetadata)
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 (Text -> TableMetadata)
-> Parser Text -> Parser TableMetadata
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 TableMetadata
instance Prelude.NFData TableMetadata