{-# 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-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.TableVersion where

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

-- | Specifies a version of a table.
--
-- /See:/ 'newTableVersion' smart constructor.
data TableVersion = 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 -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The table in question.
    TableVersion -> Maybe Table
table :: Prelude.Maybe Table
  }
  deriving (TableVersion -> TableVersion -> Bool
(TableVersion -> TableVersion -> Bool)
-> (TableVersion -> TableVersion -> Bool) -> Eq TableVersion
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]
(Int -> ReadS TableVersion)
-> ReadS [TableVersion]
-> ReadPrec TableVersion
-> ReadPrec [TableVersion]
-> Read 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
(Int -> TableVersion -> ShowS)
-> (TableVersion -> String)
-> ([TableVersion] -> ShowS)
-> Show TableVersion
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. TableVersion -> Rep TableVersion x)
-> (forall x. Rep TableVersion x -> TableVersion)
-> Generic TableVersion
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:
--
-- '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.
--
-- 'table', 'tableVersion_table' - The table in question.
newTableVersion ::
  TableVersion
newTableVersion :: TableVersion
newTableVersion =
  TableVersion' :: Maybe Text -> Maybe Table -> TableVersion
TableVersion'
    { $sel:versionId:TableVersion' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:table:TableVersion' :: Maybe Table
table = Maybe Table
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> TableVersion -> f TableVersion
tableVersion_versionId = (TableVersion -> Maybe Text)
-> (TableVersion -> Maybe Text -> TableVersion)
-> Lens TableVersion TableVersion (Maybe Text) (Maybe Text)
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)

-- | The table in question.
tableVersion_table :: Lens.Lens' TableVersion (Prelude.Maybe Table)
tableVersion_table :: (Maybe Table -> f (Maybe Table)) -> TableVersion -> f TableVersion
tableVersion_table = (TableVersion -> Maybe Table)
-> (TableVersion -> Maybe Table -> TableVersion)
-> Lens TableVersion TableVersion (Maybe Table) (Maybe 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)

instance Core.FromJSON TableVersion where
  parseJSON :: Value -> Parser TableVersion
parseJSON =
    String
-> (Object -> Parser TableVersion) -> Value -> Parser TableVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TableVersion"
      ( \Object
x ->
          Maybe Text -> Maybe Table -> TableVersion
TableVersion'
            (Maybe Text -> Maybe Table -> TableVersion)
-> Parser (Maybe Text) -> Parser (Maybe Table -> TableVersion)
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
"VersionId")
            Parser (Maybe Table -> TableVersion)
-> Parser (Maybe Table) -> Parser TableVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Table)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Table")
      )

instance Prelude.Hashable TableVersion

instance Prelude.NFData TableVersion