{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.Types.TableInput
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.TableInput where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.Column
import Amazonka.Glue.Types.StorageDescriptor
import Amazonka.Glue.Types.TableIdentifier
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure used to define a table.
--
-- /See:/ 'newTableInput' smart constructor.
data TableInput = TableInput'
  { -- | The retention time for this table.
    TableInput -> Maybe Natural
retention :: Prelude.Maybe Prelude.Natural,
    -- | A @TableIdentifier@ structure that describes a target table for resource
    -- linking.
    TableInput -> Maybe TableIdentifier
targetTable :: Prelude.Maybe TableIdentifier,
    -- | The type of this table (@EXTERNAL_TABLE@, @VIRTUAL_VIEW@, etc.).
    TableInput -> Maybe Text
tableType :: Prelude.Maybe Prelude.Text,
    -- | The table owner.
    TableInput -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | If the table is a view, the original text of the view; otherwise @null@.
    TableInput -> Maybe Text
viewOriginalText :: Prelude.Maybe Prelude.Text,
    -- | If the table is a view, the expanded text of the view; otherwise @null@.
    TableInput -> Maybe Text
viewExpandedText :: Prelude.Maybe Prelude.Text,
    -- | The last time that column statistics were computed for this table.
    TableInput -> Maybe POSIX
lastAnalyzedTime :: Prelude.Maybe Core.POSIX,
    -- | A storage descriptor containing information about the physical storage
    -- of this table.
    TableInput -> Maybe StorageDescriptor
storageDescriptor :: Prelude.Maybe StorageDescriptor,
    -- | These key-value pairs define properties associated with the table.
    TableInput -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The last time that the table was accessed.
    TableInput -> Maybe POSIX
lastAccessTime :: Prelude.Maybe Core.POSIX,
    -- | A description of the table.
    TableInput -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of columns by which the table is partitioned. Only primitive
    -- types are supported as partition keys.
    --
    -- When you create a table used by Amazon Athena, and you do not specify
    -- any @partitionKeys@, you must at least set the value of @partitionKeys@
    -- to an empty list. For example:
    --
    -- @\"PartitionKeys\": []@
    TableInput -> Maybe [Column]
partitionKeys :: Prelude.Maybe [Column],
    -- | The table name. For Hive compatibility, this is folded to lowercase when
    -- it is stored.
    TableInput -> Text
name :: Prelude.Text
  }
  deriving (TableInput -> TableInput -> Bool
(TableInput -> TableInput -> Bool)
-> (TableInput -> TableInput -> Bool) -> Eq TableInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableInput -> TableInput -> Bool
$c/= :: TableInput -> TableInput -> Bool
== :: TableInput -> TableInput -> Bool
$c== :: TableInput -> TableInput -> Bool
Prelude.Eq, ReadPrec [TableInput]
ReadPrec TableInput
Int -> ReadS TableInput
ReadS [TableInput]
(Int -> ReadS TableInput)
-> ReadS [TableInput]
-> ReadPrec TableInput
-> ReadPrec [TableInput]
-> Read TableInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableInput]
$creadListPrec :: ReadPrec [TableInput]
readPrec :: ReadPrec TableInput
$creadPrec :: ReadPrec TableInput
readList :: ReadS [TableInput]
$creadList :: ReadS [TableInput]
readsPrec :: Int -> ReadS TableInput
$creadsPrec :: Int -> ReadS TableInput
Prelude.Read, Int -> TableInput -> ShowS
[TableInput] -> ShowS
TableInput -> String
(Int -> TableInput -> ShowS)
-> (TableInput -> String)
-> ([TableInput] -> ShowS)
-> Show TableInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableInput] -> ShowS
$cshowList :: [TableInput] -> ShowS
show :: TableInput -> String
$cshow :: TableInput -> String
showsPrec :: Int -> TableInput -> ShowS
$cshowsPrec :: Int -> TableInput -> ShowS
Prelude.Show, (forall x. TableInput -> Rep TableInput x)
-> (forall x. Rep TableInput x -> TableInput) -> Generic TableInput
forall x. Rep TableInput x -> TableInput
forall x. TableInput -> Rep TableInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableInput x -> TableInput
$cfrom :: forall x. TableInput -> Rep TableInput x
Prelude.Generic)

-- |
-- Create a value of 'TableInput' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'retention', 'tableInput_retention' - The retention time for this table.
--
-- 'targetTable', 'tableInput_targetTable' - A @TableIdentifier@ structure that describes a target table for resource
-- linking.
--
-- 'tableType', 'tableInput_tableType' - The type of this table (@EXTERNAL_TABLE@, @VIRTUAL_VIEW@, etc.).
--
-- 'owner', 'tableInput_owner' - The table owner.
--
-- 'viewOriginalText', 'tableInput_viewOriginalText' - If the table is a view, the original text of the view; otherwise @null@.
--
-- 'viewExpandedText', 'tableInput_viewExpandedText' - If the table is a view, the expanded text of the view; otherwise @null@.
--
-- 'lastAnalyzedTime', 'tableInput_lastAnalyzedTime' - The last time that column statistics were computed for this table.
--
-- 'storageDescriptor', 'tableInput_storageDescriptor' - A storage descriptor containing information about the physical storage
-- of this table.
--
-- 'parameters', 'tableInput_parameters' - These key-value pairs define properties associated with the table.
--
-- 'lastAccessTime', 'tableInput_lastAccessTime' - The last time that the table was accessed.
--
-- 'description', 'tableInput_description' - A description of the table.
--
-- 'partitionKeys', 'tableInput_partitionKeys' - A list of columns by which the table is partitioned. Only primitive
-- types are supported as partition keys.
--
-- When you create a table used by Amazon Athena, and you do not specify
-- any @partitionKeys@, you must at least set the value of @partitionKeys@
-- to an empty list. For example:
--
-- @\"PartitionKeys\": []@
--
-- 'name', 'tableInput_name' - The table name. For Hive compatibility, this is folded to lowercase when
-- it is stored.
newTableInput ::
  -- | 'name'
  Prelude.Text ->
  TableInput
newTableInput :: Text -> TableInput
newTableInput Text
pName_ =
  TableInput' :: Maybe Natural
-> Maybe TableIdentifier
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe StorageDescriptor
-> Maybe (HashMap Text Text)
-> Maybe POSIX
-> Maybe Text
-> Maybe [Column]
-> Text
-> TableInput
TableInput'
    { $sel:retention:TableInput' :: Maybe Natural
retention = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetTable:TableInput' :: Maybe TableIdentifier
targetTable = Maybe TableIdentifier
forall a. Maybe a
Prelude.Nothing,
      $sel:tableType:TableInput' :: Maybe Text
tableType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:TableInput' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:viewOriginalText:TableInput' :: Maybe Text
viewOriginalText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:viewExpandedText:TableInput' :: Maybe Text
viewExpandedText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastAnalyzedTime:TableInput' :: Maybe POSIX
lastAnalyzedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:storageDescriptor:TableInput' :: Maybe StorageDescriptor
storageDescriptor = Maybe StorageDescriptor
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:TableInput' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:lastAccessTime:TableInput' :: Maybe POSIX
lastAccessTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:TableInput' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:partitionKeys:TableInput' :: Maybe [Column]
partitionKeys = Maybe [Column]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:TableInput' :: Text
name = Text
pName_
    }

-- | The retention time for this table.
tableInput_retention :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Natural)
tableInput_retention :: (Maybe Natural -> f (Maybe Natural)) -> TableInput -> f TableInput
tableInput_retention = (TableInput -> Maybe Natural)
-> (TableInput -> Maybe Natural -> TableInput)
-> Lens TableInput TableInput (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Natural
retention :: Maybe Natural
$sel:retention:TableInput' :: TableInput -> Maybe Natural
retention} -> Maybe Natural
retention) (\s :: TableInput
s@TableInput' {} Maybe Natural
a -> TableInput
s {$sel:retention:TableInput' :: Maybe Natural
retention = Maybe Natural
a} :: TableInput)

-- | A @TableIdentifier@ structure that describes a target table for resource
-- linking.
tableInput_targetTable :: Lens.Lens' TableInput (Prelude.Maybe TableIdentifier)
tableInput_targetTable :: (Maybe TableIdentifier -> f (Maybe TableIdentifier))
-> TableInput -> f TableInput
tableInput_targetTable = (TableInput -> Maybe TableIdentifier)
-> (TableInput -> Maybe TableIdentifier -> TableInput)
-> Lens
     TableInput
     TableInput
     (Maybe TableIdentifier)
     (Maybe TableIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe TableIdentifier
targetTable :: Maybe TableIdentifier
$sel:targetTable:TableInput' :: TableInput -> Maybe TableIdentifier
targetTable} -> Maybe TableIdentifier
targetTable) (\s :: TableInput
s@TableInput' {} Maybe TableIdentifier
a -> TableInput
s {$sel:targetTable:TableInput' :: Maybe TableIdentifier
targetTable = Maybe TableIdentifier
a} :: TableInput)

-- | The type of this table (@EXTERNAL_TABLE@, @VIRTUAL_VIEW@, etc.).
tableInput_tableType :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Text)
tableInput_tableType :: (Maybe Text -> f (Maybe Text)) -> TableInput -> f TableInput
tableInput_tableType = (TableInput -> Maybe Text)
-> (TableInput -> Maybe Text -> TableInput)
-> Lens TableInput TableInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Text
tableType :: Maybe Text
$sel:tableType:TableInput' :: TableInput -> Maybe Text
tableType} -> Maybe Text
tableType) (\s :: TableInput
s@TableInput' {} Maybe Text
a -> TableInput
s {$sel:tableType:TableInput' :: Maybe Text
tableType = Maybe Text
a} :: TableInput)

-- | The table owner.
tableInput_owner :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Text)
tableInput_owner :: (Maybe Text -> f (Maybe Text)) -> TableInput -> f TableInput
tableInput_owner = (TableInput -> Maybe Text)
-> (TableInput -> Maybe Text -> TableInput)
-> Lens TableInput TableInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Text
owner :: Maybe Text
$sel:owner:TableInput' :: TableInput -> Maybe Text
owner} -> Maybe Text
owner) (\s :: TableInput
s@TableInput' {} Maybe Text
a -> TableInput
s {$sel:owner:TableInput' :: Maybe Text
owner = Maybe Text
a} :: TableInput)

-- | If the table is a view, the original text of the view; otherwise @null@.
tableInput_viewOriginalText :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Text)
tableInput_viewOriginalText :: (Maybe Text -> f (Maybe Text)) -> TableInput -> f TableInput
tableInput_viewOriginalText = (TableInput -> Maybe Text)
-> (TableInput -> Maybe Text -> TableInput)
-> Lens TableInput TableInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Text
viewOriginalText :: Maybe Text
$sel:viewOriginalText:TableInput' :: TableInput -> Maybe Text
viewOriginalText} -> Maybe Text
viewOriginalText) (\s :: TableInput
s@TableInput' {} Maybe Text
a -> TableInput
s {$sel:viewOriginalText:TableInput' :: Maybe Text
viewOriginalText = Maybe Text
a} :: TableInput)

-- | If the table is a view, the expanded text of the view; otherwise @null@.
tableInput_viewExpandedText :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Text)
tableInput_viewExpandedText :: (Maybe Text -> f (Maybe Text)) -> TableInput -> f TableInput
tableInput_viewExpandedText = (TableInput -> Maybe Text)
-> (TableInput -> Maybe Text -> TableInput)
-> Lens TableInput TableInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Text
viewExpandedText :: Maybe Text
$sel:viewExpandedText:TableInput' :: TableInput -> Maybe Text
viewExpandedText} -> Maybe Text
viewExpandedText) (\s :: TableInput
s@TableInput' {} Maybe Text
a -> TableInput
s {$sel:viewExpandedText:TableInput' :: Maybe Text
viewExpandedText = Maybe Text
a} :: TableInput)

-- | The last time that column statistics were computed for this table.
tableInput_lastAnalyzedTime :: Lens.Lens' TableInput (Prelude.Maybe Prelude.UTCTime)
tableInput_lastAnalyzedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> TableInput -> f TableInput
tableInput_lastAnalyzedTime = (TableInput -> Maybe POSIX)
-> (TableInput -> Maybe POSIX -> TableInput)
-> Lens TableInput TableInput (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe POSIX
lastAnalyzedTime :: Maybe POSIX
$sel:lastAnalyzedTime:TableInput' :: TableInput -> Maybe POSIX
lastAnalyzedTime} -> Maybe POSIX
lastAnalyzedTime) (\s :: TableInput
s@TableInput' {} Maybe POSIX
a -> TableInput
s {$sel:lastAnalyzedTime:TableInput' :: Maybe POSIX
lastAnalyzedTime = Maybe POSIX
a} :: TableInput) ((Maybe POSIX -> f (Maybe POSIX)) -> TableInput -> f TableInput)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TableInput
-> f TableInput
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

-- | A storage descriptor containing information about the physical storage
-- of this table.
tableInput_storageDescriptor :: Lens.Lens' TableInput (Prelude.Maybe StorageDescriptor)
tableInput_storageDescriptor :: (Maybe StorageDescriptor -> f (Maybe StorageDescriptor))
-> TableInput -> f TableInput
tableInput_storageDescriptor = (TableInput -> Maybe StorageDescriptor)
-> (TableInput -> Maybe StorageDescriptor -> TableInput)
-> Lens
     TableInput
     TableInput
     (Maybe StorageDescriptor)
     (Maybe StorageDescriptor)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe StorageDescriptor
storageDescriptor :: Maybe StorageDescriptor
$sel:storageDescriptor:TableInput' :: TableInput -> Maybe StorageDescriptor
storageDescriptor} -> Maybe StorageDescriptor
storageDescriptor) (\s :: TableInput
s@TableInput' {} Maybe StorageDescriptor
a -> TableInput
s {$sel:storageDescriptor:TableInput' :: Maybe StorageDescriptor
storageDescriptor = Maybe StorageDescriptor
a} :: TableInput)

-- | These key-value pairs define properties associated with the table.
tableInput_parameters :: Lens.Lens' TableInput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
tableInput_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TableInput -> f TableInput
tableInput_parameters = (TableInput -> Maybe (HashMap Text Text))
-> (TableInput -> Maybe (HashMap Text Text) -> TableInput)
-> Lens
     TableInput
     TableInput
     (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 (\TableInput' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:TableInput' :: TableInput -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: TableInput
s@TableInput' {} Maybe (HashMap Text Text)
a -> TableInput
s {$sel:parameters:TableInput' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: TableInput) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> TableInput -> f TableInput)
-> ((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)))
-> TableInput
-> f TableInput
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

-- | The last time that the table was accessed.
tableInput_lastAccessTime :: Lens.Lens' TableInput (Prelude.Maybe Prelude.UTCTime)
tableInput_lastAccessTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> TableInput -> f TableInput
tableInput_lastAccessTime = (TableInput -> Maybe POSIX)
-> (TableInput -> Maybe POSIX -> TableInput)
-> Lens TableInput TableInput (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe POSIX
lastAccessTime :: Maybe POSIX
$sel:lastAccessTime:TableInput' :: TableInput -> Maybe POSIX
lastAccessTime} -> Maybe POSIX
lastAccessTime) (\s :: TableInput
s@TableInput' {} Maybe POSIX
a -> TableInput
s {$sel:lastAccessTime:TableInput' :: Maybe POSIX
lastAccessTime = Maybe POSIX
a} :: TableInput) ((Maybe POSIX -> f (Maybe POSIX)) -> TableInput -> f TableInput)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TableInput
-> f TableInput
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

-- | A description of the table.
tableInput_description :: Lens.Lens' TableInput (Prelude.Maybe Prelude.Text)
tableInput_description :: (Maybe Text -> f (Maybe Text)) -> TableInput -> f TableInput
tableInput_description = (TableInput -> Maybe Text)
-> (TableInput -> Maybe Text -> TableInput)
-> Lens TableInput TableInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe Text
description :: Maybe Text
$sel:description:TableInput' :: TableInput -> Maybe Text
description} -> Maybe Text
description) (\s :: TableInput
s@TableInput' {} Maybe Text
a -> TableInput
s {$sel:description:TableInput' :: Maybe Text
description = Maybe Text
a} :: TableInput)

-- | A list of columns by which the table is partitioned. Only primitive
-- types are supported as partition keys.
--
-- When you create a table used by Amazon Athena, and you do not specify
-- any @partitionKeys@, you must at least set the value of @partitionKeys@
-- to an empty list. For example:
--
-- @\"PartitionKeys\": []@
tableInput_partitionKeys :: Lens.Lens' TableInput (Prelude.Maybe [Column])
tableInput_partitionKeys :: (Maybe [Column] -> f (Maybe [Column]))
-> TableInput -> f TableInput
tableInput_partitionKeys = (TableInput -> Maybe [Column])
-> (TableInput -> Maybe [Column] -> TableInput)
-> Lens TableInput TableInput (Maybe [Column]) (Maybe [Column])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Maybe [Column]
partitionKeys :: Maybe [Column]
$sel:partitionKeys:TableInput' :: TableInput -> Maybe [Column]
partitionKeys} -> Maybe [Column]
partitionKeys) (\s :: TableInput
s@TableInput' {} Maybe [Column]
a -> TableInput
s {$sel:partitionKeys:TableInput' :: Maybe [Column]
partitionKeys = Maybe [Column]
a} :: TableInput) ((Maybe [Column] -> f (Maybe [Column]))
 -> TableInput -> f TableInput)
-> ((Maybe [Column] -> f (Maybe [Column]))
    -> Maybe [Column] -> f (Maybe [Column]))
-> (Maybe [Column] -> f (Maybe [Column]))
-> TableInput
-> f TableInput
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

-- | The table name. For Hive compatibility, this is folded to lowercase when
-- it is stored.
tableInput_name :: Lens.Lens' TableInput Prelude.Text
tableInput_name :: (Text -> f Text) -> TableInput -> f TableInput
tableInput_name = (TableInput -> Text)
-> (TableInput -> Text -> TableInput)
-> Lens TableInput TableInput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableInput' {Text
name :: Text
$sel:name:TableInput' :: TableInput -> Text
name} -> Text
name) (\s :: TableInput
s@TableInput' {} Text
a -> TableInput
s {$sel:name:TableInput' :: Text
name = Text
a} :: TableInput)

instance Prelude.Hashable TableInput

instance Prelude.NFData TableInput

instance Core.ToJSON TableInput where
  toJSON :: TableInput -> Value
toJSON TableInput' {Maybe Natural
Maybe [Column]
Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe StorageDescriptor
Maybe TableIdentifier
Text
name :: Text
partitionKeys :: Maybe [Column]
description :: Maybe Text
lastAccessTime :: Maybe POSIX
parameters :: Maybe (HashMap Text Text)
storageDescriptor :: Maybe StorageDescriptor
lastAnalyzedTime :: Maybe POSIX
viewExpandedText :: Maybe Text
viewOriginalText :: Maybe Text
owner :: Maybe Text
tableType :: Maybe Text
targetTable :: Maybe TableIdentifier
retention :: Maybe Natural
$sel:name:TableInput' :: TableInput -> Text
$sel:partitionKeys:TableInput' :: TableInput -> Maybe [Column]
$sel:description:TableInput' :: TableInput -> Maybe Text
$sel:lastAccessTime:TableInput' :: TableInput -> Maybe POSIX
$sel:parameters:TableInput' :: TableInput -> Maybe (HashMap Text Text)
$sel:storageDescriptor:TableInput' :: TableInput -> Maybe StorageDescriptor
$sel:lastAnalyzedTime:TableInput' :: TableInput -> Maybe POSIX
$sel:viewExpandedText:TableInput' :: TableInput -> Maybe Text
$sel:viewOriginalText:TableInput' :: TableInput -> Maybe Text
$sel:owner:TableInput' :: TableInput -> Maybe Text
$sel:tableType:TableInput' :: TableInput -> Maybe Text
$sel:targetTable:TableInput' :: TableInput -> Maybe TableIdentifier
$sel:retention:TableInput' :: TableInput -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Retention" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retention,
            (Text
"TargetTable" Text -> TableIdentifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TableIdentifier -> Pair) -> Maybe TableIdentifier -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TableIdentifier
targetTable,
            (Text
"TableType" 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
tableType,
            (Text
"Owner" 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
owner,
            (Text
"ViewOriginalText" 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
viewOriginalText,
            (Text
"ViewExpandedText" 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
viewExpandedText,
            (Text
"LastAnalyzedTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
lastAnalyzedTime,
            (Text
"StorageDescriptor" Text -> StorageDescriptor -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StorageDescriptor -> Pair)
-> Maybe StorageDescriptor -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageDescriptor
storageDescriptor,
            (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
"LastAccessTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
lastAccessTime,
            (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
"PartitionKeys" Text -> [Column] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Column] -> Pair) -> Maybe [Column] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Column]
partitionKeys,
            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)
          ]
      )