{-# 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.TableVersion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.TableVersion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.Table
import qualified Amazonka.Prelude as Prelude

-- | Specifies a version of a table.
--
-- /See:/ 'newTableVersion' smart constructor.
data TableVersion = TableVersion'
  { -- | The table in question.
    TableVersion -> Maybe Table
table :: Prelude.Maybe Table,
    -- | The ID value that identifies this table version. A @VersionId@ is a
    -- string representation of an integer. Each version is incremented by 1.
    TableVersion -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text
  }
  deriving (TableVersion -> TableVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableVersion -> TableVersion -> Bool
$c/= :: TableVersion -> TableVersion -> Bool
== :: TableVersion -> TableVersion -> Bool
$c== :: TableVersion -> TableVersion -> Bool
Prelude.Eq, ReadPrec [TableVersion]
ReadPrec TableVersion
Int -> ReadS TableVersion
ReadS [TableVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableVersion]
$creadListPrec :: ReadPrec [TableVersion]
readPrec :: ReadPrec TableVersion
$creadPrec :: ReadPrec TableVersion
readList :: ReadS [TableVersion]
$creadList :: ReadS [TableVersion]
readsPrec :: Int -> ReadS TableVersion
$creadsPrec :: Int -> ReadS TableVersion
Prelude.Read, Int -> TableVersion -> ShowS
[TableVersion] -> ShowS
TableVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableVersion] -> ShowS
$cshowList :: [TableVersion] -> ShowS
show :: TableVersion -> String
$cshow :: TableVersion -> String
showsPrec :: Int -> TableVersion -> ShowS
$cshowsPrec :: Int -> TableVersion -> ShowS
Prelude.Show, forall x. Rep TableVersion x -> TableVersion
forall x. TableVersion -> Rep TableVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableVersion x -> TableVersion
$cfrom :: forall x. TableVersion -> Rep TableVersion x
Prelude.Generic)

-- |
-- Create a value of 'TableVersion' 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:
--
-- 'table', 'tableVersion_table' - The table in question.
--
-- 'versionId', 'tableVersion_versionId' - The ID value that identifies this table version. A @VersionId@ is a
-- string representation of an integer. Each version is incremented by 1.
newTableVersion ::
  TableVersion
newTableVersion :: TableVersion
newTableVersion =
  TableVersion'
    { $sel:table:TableVersion' :: Maybe Table
table = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:TableVersion' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing
    }

-- | The table in question.
tableVersion_table :: Lens.Lens' TableVersion (Prelude.Maybe Table)
tableVersion_table :: Lens' TableVersion (Maybe Table)
tableVersion_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableVersion' {Maybe Table
table :: Maybe Table
$sel:table:TableVersion' :: TableVersion -> Maybe Table
table} -> Maybe Table
table) (\s :: TableVersion
s@TableVersion' {} Maybe Table
a -> TableVersion
s {$sel:table:TableVersion' :: Maybe Table
table = Maybe Table
a} :: TableVersion)

-- | The ID value that identifies this table version. A @VersionId@ is a
-- string representation of an integer. Each version is incremented by 1.
tableVersion_versionId :: Lens.Lens' TableVersion (Prelude.Maybe Prelude.Text)
tableVersion_versionId :: Lens' TableVersion (Maybe Text)
tableVersion_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableVersion' {Maybe Text
versionId :: Maybe Text
$sel:versionId:TableVersion' :: TableVersion -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: TableVersion
s@TableVersion' {} Maybe Text
a -> TableVersion
s {$sel:versionId:TableVersion' :: Maybe Text
versionId = Maybe Text
a} :: TableVersion)

instance Data.FromJSON TableVersion where
  parseJSON :: Value -> Parser TableVersion
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableVersion"
      ( \Object
x ->
          Maybe Table -> Maybe Text -> TableVersion
TableVersion'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Table")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VersionId")
      )

instance Prelude.Hashable TableVersion where
  hashWithSalt :: Int -> TableVersion -> Int
hashWithSalt Int
_salt TableVersion' {Maybe Text
Maybe Table
versionId :: Maybe Text
table :: Maybe Table
$sel:versionId:TableVersion' :: TableVersion -> Maybe Text
$sel:table:TableVersion' :: TableVersion -> Maybe Table
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Table
table
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId

instance Prelude.NFData TableVersion where
  rnf :: TableVersion -> ()
rnf TableVersion' {Maybe Text
Maybe Table
versionId :: Maybe Text
table :: Maybe Table
$sel:versionId:TableVersion' :: TableVersion -> Maybe Text
$sel:table:TableVersion' :: TableVersion -> Maybe Table
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Table
table
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId