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

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

-- | An error record for table-version operations.
--
-- /See:/ 'newTableVersionError' smart constructor.
data TableVersionError = TableVersionError'
  { -- | The ID value of the version in question. A @VersionID@ is a string
    -- representation of an integer. Each version is incremented by 1.
    TableVersionError -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the table in question.
    TableVersionError -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text,
    -- | The details about the error.
    TableVersionError -> Maybe ErrorDetail
errorDetail :: Prelude.Maybe ErrorDetail
  }
  deriving (TableVersionError -> TableVersionError -> Bool
(TableVersionError -> TableVersionError -> Bool)
-> (TableVersionError -> TableVersionError -> Bool)
-> Eq TableVersionError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableVersionError -> TableVersionError -> Bool
$c/= :: TableVersionError -> TableVersionError -> Bool
== :: TableVersionError -> TableVersionError -> Bool
$c== :: TableVersionError -> TableVersionError -> Bool
Prelude.Eq, ReadPrec [TableVersionError]
ReadPrec TableVersionError
Int -> ReadS TableVersionError
ReadS [TableVersionError]
(Int -> ReadS TableVersionError)
-> ReadS [TableVersionError]
-> ReadPrec TableVersionError
-> ReadPrec [TableVersionError]
-> Read TableVersionError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableVersionError]
$creadListPrec :: ReadPrec [TableVersionError]
readPrec :: ReadPrec TableVersionError
$creadPrec :: ReadPrec TableVersionError
readList :: ReadS [TableVersionError]
$creadList :: ReadS [TableVersionError]
readsPrec :: Int -> ReadS TableVersionError
$creadsPrec :: Int -> ReadS TableVersionError
Prelude.Read, Int -> TableVersionError -> ShowS
[TableVersionError] -> ShowS
TableVersionError -> String
(Int -> TableVersionError -> ShowS)
-> (TableVersionError -> String)
-> ([TableVersionError] -> ShowS)
-> Show TableVersionError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableVersionError] -> ShowS
$cshowList :: [TableVersionError] -> ShowS
show :: TableVersionError -> String
$cshow :: TableVersionError -> String
showsPrec :: Int -> TableVersionError -> ShowS
$cshowsPrec :: Int -> TableVersionError -> ShowS
Prelude.Show, (forall x. TableVersionError -> Rep TableVersionError x)
-> (forall x. Rep TableVersionError x -> TableVersionError)
-> Generic TableVersionError
forall x. Rep TableVersionError x -> TableVersionError
forall x. TableVersionError -> Rep TableVersionError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableVersionError x -> TableVersionError
$cfrom :: forall x. TableVersionError -> Rep TableVersionError x
Prelude.Generic)

-- |
-- Create a value of 'TableVersionError' 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', 'tableVersionError_versionId' - The ID value of the version in question. A @VersionID@ is a string
-- representation of an integer. Each version is incremented by 1.
--
-- 'tableName', 'tableVersionError_tableName' - The name of the table in question.
--
-- 'errorDetail', 'tableVersionError_errorDetail' - The details about the error.
newTableVersionError ::
  TableVersionError
newTableVersionError :: TableVersionError
newTableVersionError =
  TableVersionError' :: Maybe Text -> Maybe Text -> Maybe ErrorDetail -> TableVersionError
TableVersionError'
    { $sel:versionId:TableVersionError' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:TableVersionError' :: Maybe Text
tableName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorDetail:TableVersionError' :: Maybe ErrorDetail
errorDetail = Maybe ErrorDetail
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID value of the version in question. A @VersionID@ is a string
-- representation of an integer. Each version is incremented by 1.
tableVersionError_versionId :: Lens.Lens' TableVersionError (Prelude.Maybe Prelude.Text)
tableVersionError_versionId :: (Maybe Text -> f (Maybe Text))
-> TableVersionError -> f TableVersionError
tableVersionError_versionId = (TableVersionError -> Maybe Text)
-> (TableVersionError -> Maybe Text -> TableVersionError)
-> Lens
     TableVersionError TableVersionError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableVersionError' {Maybe Text
versionId :: Maybe Text
$sel:versionId:TableVersionError' :: TableVersionError -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: TableVersionError
s@TableVersionError' {} Maybe Text
a -> TableVersionError
s {$sel:versionId:TableVersionError' :: Maybe Text
versionId = Maybe Text
a} :: TableVersionError)

-- | The name of the table in question.
tableVersionError_tableName :: Lens.Lens' TableVersionError (Prelude.Maybe Prelude.Text)
tableVersionError_tableName :: (Maybe Text -> f (Maybe Text))
-> TableVersionError -> f TableVersionError
tableVersionError_tableName = (TableVersionError -> Maybe Text)
-> (TableVersionError -> Maybe Text -> TableVersionError)
-> Lens
     TableVersionError TableVersionError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableVersionError' {Maybe Text
tableName :: Maybe Text
$sel:tableName:TableVersionError' :: TableVersionError -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: TableVersionError
s@TableVersionError' {} Maybe Text
a -> TableVersionError
s {$sel:tableName:TableVersionError' :: Maybe Text
tableName = Maybe Text
a} :: TableVersionError)

-- | The details about the error.
tableVersionError_errorDetail :: Lens.Lens' TableVersionError (Prelude.Maybe ErrorDetail)
tableVersionError_errorDetail :: (Maybe ErrorDetail -> f (Maybe ErrorDetail))
-> TableVersionError -> f TableVersionError
tableVersionError_errorDetail = (TableVersionError -> Maybe ErrorDetail)
-> (TableVersionError -> Maybe ErrorDetail -> TableVersionError)
-> Lens
     TableVersionError
     TableVersionError
     (Maybe ErrorDetail)
     (Maybe ErrorDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableVersionError' {Maybe ErrorDetail
errorDetail :: Maybe ErrorDetail
$sel:errorDetail:TableVersionError' :: TableVersionError -> Maybe ErrorDetail
errorDetail} -> Maybe ErrorDetail
errorDetail) (\s :: TableVersionError
s@TableVersionError' {} Maybe ErrorDetail
a -> TableVersionError
s {$sel:errorDetail:TableVersionError' :: Maybe ErrorDetail
errorDetail = Maybe ErrorDetail
a} :: TableVersionError)

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

instance Prelude.Hashable TableVersionError

instance Prelude.NFData TableVersionError