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

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

-- | An object that contains the error details for an operation on a schema
-- version.
--
-- /See:/ 'newSchemaVersionErrorItem' smart constructor.
data SchemaVersionErrorItem = SchemaVersionErrorItem'
  { -- | The version number of the schema.
    SchemaVersionErrorItem -> Maybe Natural
versionNumber :: Prelude.Maybe Prelude.Natural,
    -- | The details of the error for the schema version.
    SchemaVersionErrorItem -> Maybe ErrorDetails
errorDetails :: Prelude.Maybe ErrorDetails
  }
  deriving (SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
(SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool)
-> (SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool)
-> Eq SchemaVersionErrorItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
$c/= :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
== :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
$c== :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
Prelude.Eq, ReadPrec [SchemaVersionErrorItem]
ReadPrec SchemaVersionErrorItem
Int -> ReadS SchemaVersionErrorItem
ReadS [SchemaVersionErrorItem]
(Int -> ReadS SchemaVersionErrorItem)
-> ReadS [SchemaVersionErrorItem]
-> ReadPrec SchemaVersionErrorItem
-> ReadPrec [SchemaVersionErrorItem]
-> Read SchemaVersionErrorItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaVersionErrorItem]
$creadListPrec :: ReadPrec [SchemaVersionErrorItem]
readPrec :: ReadPrec SchemaVersionErrorItem
$creadPrec :: ReadPrec SchemaVersionErrorItem
readList :: ReadS [SchemaVersionErrorItem]
$creadList :: ReadS [SchemaVersionErrorItem]
readsPrec :: Int -> ReadS SchemaVersionErrorItem
$creadsPrec :: Int -> ReadS SchemaVersionErrorItem
Prelude.Read, Int -> SchemaVersionErrorItem -> ShowS
[SchemaVersionErrorItem] -> ShowS
SchemaVersionErrorItem -> String
(Int -> SchemaVersionErrorItem -> ShowS)
-> (SchemaVersionErrorItem -> String)
-> ([SchemaVersionErrorItem] -> ShowS)
-> Show SchemaVersionErrorItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaVersionErrorItem] -> ShowS
$cshowList :: [SchemaVersionErrorItem] -> ShowS
show :: SchemaVersionErrorItem -> String
$cshow :: SchemaVersionErrorItem -> String
showsPrec :: Int -> SchemaVersionErrorItem -> ShowS
$cshowsPrec :: Int -> SchemaVersionErrorItem -> ShowS
Prelude.Show, (forall x. SchemaVersionErrorItem -> Rep SchemaVersionErrorItem x)
-> (forall x.
    Rep SchemaVersionErrorItem x -> SchemaVersionErrorItem)
-> Generic SchemaVersionErrorItem
forall x. Rep SchemaVersionErrorItem x -> SchemaVersionErrorItem
forall x. SchemaVersionErrorItem -> Rep SchemaVersionErrorItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaVersionErrorItem x -> SchemaVersionErrorItem
$cfrom :: forall x. SchemaVersionErrorItem -> Rep SchemaVersionErrorItem x
Prelude.Generic)

-- |
-- Create a value of 'SchemaVersionErrorItem' 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:
--
-- 'versionNumber', 'schemaVersionErrorItem_versionNumber' - The version number of the schema.
--
-- 'errorDetails', 'schemaVersionErrorItem_errorDetails' - The details of the error for the schema version.
newSchemaVersionErrorItem ::
  SchemaVersionErrorItem
newSchemaVersionErrorItem :: SchemaVersionErrorItem
newSchemaVersionErrorItem =
  SchemaVersionErrorItem' :: Maybe Natural -> Maybe ErrorDetails -> SchemaVersionErrorItem
SchemaVersionErrorItem'
    { $sel:versionNumber:SchemaVersionErrorItem' :: Maybe Natural
versionNumber =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:errorDetails:SchemaVersionErrorItem' :: Maybe ErrorDetails
errorDetails = Maybe ErrorDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | The version number of the schema.
schemaVersionErrorItem_versionNumber :: Lens.Lens' SchemaVersionErrorItem (Prelude.Maybe Prelude.Natural)
schemaVersionErrorItem_versionNumber :: (Maybe Natural -> f (Maybe Natural))
-> SchemaVersionErrorItem -> f SchemaVersionErrorItem
schemaVersionErrorItem_versionNumber = (SchemaVersionErrorItem -> Maybe Natural)
-> (SchemaVersionErrorItem
    -> Maybe Natural -> SchemaVersionErrorItem)
-> Lens
     SchemaVersionErrorItem
     SchemaVersionErrorItem
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaVersionErrorItem' {Maybe Natural
versionNumber :: Maybe Natural
$sel:versionNumber:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe Natural
versionNumber} -> Maybe Natural
versionNumber) (\s :: SchemaVersionErrorItem
s@SchemaVersionErrorItem' {} Maybe Natural
a -> SchemaVersionErrorItem
s {$sel:versionNumber:SchemaVersionErrorItem' :: Maybe Natural
versionNumber = Maybe Natural
a} :: SchemaVersionErrorItem)

-- | The details of the error for the schema version.
schemaVersionErrorItem_errorDetails :: Lens.Lens' SchemaVersionErrorItem (Prelude.Maybe ErrorDetails)
schemaVersionErrorItem_errorDetails :: (Maybe ErrorDetails -> f (Maybe ErrorDetails))
-> SchemaVersionErrorItem -> f SchemaVersionErrorItem
schemaVersionErrorItem_errorDetails = (SchemaVersionErrorItem -> Maybe ErrorDetails)
-> (SchemaVersionErrorItem
    -> Maybe ErrorDetails -> SchemaVersionErrorItem)
-> Lens
     SchemaVersionErrorItem
     SchemaVersionErrorItem
     (Maybe ErrorDetails)
     (Maybe ErrorDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaVersionErrorItem' {Maybe ErrorDetails
errorDetails :: Maybe ErrorDetails
$sel:errorDetails:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe ErrorDetails
errorDetails} -> Maybe ErrorDetails
errorDetails) (\s :: SchemaVersionErrorItem
s@SchemaVersionErrorItem' {} Maybe ErrorDetails
a -> SchemaVersionErrorItem
s {$sel:errorDetails:SchemaVersionErrorItem' :: Maybe ErrorDetails
errorDetails = Maybe ErrorDetails
a} :: SchemaVersionErrorItem)

instance Core.FromJSON SchemaVersionErrorItem where
  parseJSON :: Value -> Parser SchemaVersionErrorItem
parseJSON =
    String
-> (Object -> Parser SchemaVersionErrorItem)
-> Value
-> Parser SchemaVersionErrorItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SchemaVersionErrorItem"
      ( \Object
x ->
          Maybe Natural -> Maybe ErrorDetails -> SchemaVersionErrorItem
SchemaVersionErrorItem'
            (Maybe Natural -> Maybe ErrorDetails -> SchemaVersionErrorItem)
-> Parser (Maybe Natural)
-> Parser (Maybe ErrorDetails -> SchemaVersionErrorItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VersionNumber")
            Parser (Maybe ErrorDetails -> SchemaVersionErrorItem)
-> Parser (Maybe ErrorDetails) -> Parser SchemaVersionErrorItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ErrorDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorDetails")
      )

instance Prelude.Hashable SchemaVersionErrorItem

instance Prelude.NFData SchemaVersionErrorItem