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

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

-- | Encapsulates a @ColumnStatistics@ object that failed and the reason for
-- failure.
--
-- /See:/ 'newColumnStatisticsError' smart constructor.
data ColumnStatisticsError = ColumnStatisticsError'
  { -- | An error message with the reason for the failure of an operation.
    ColumnStatisticsError -> Maybe ErrorDetail
error :: Prelude.Maybe ErrorDetail,
    -- | The @ColumnStatistics@ of the column.
    ColumnStatisticsError -> Maybe ColumnStatistics
columnStatistics :: Prelude.Maybe ColumnStatistics
  }
  deriving (ColumnStatisticsError -> ColumnStatisticsError -> Bool
(ColumnStatisticsError -> ColumnStatisticsError -> Bool)
-> (ColumnStatisticsError -> ColumnStatisticsError -> Bool)
-> Eq ColumnStatisticsError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnStatisticsError -> ColumnStatisticsError -> Bool
$c/= :: ColumnStatisticsError -> ColumnStatisticsError -> Bool
== :: ColumnStatisticsError -> ColumnStatisticsError -> Bool
$c== :: ColumnStatisticsError -> ColumnStatisticsError -> Bool
Prelude.Eq, ReadPrec [ColumnStatisticsError]
ReadPrec ColumnStatisticsError
Int -> ReadS ColumnStatisticsError
ReadS [ColumnStatisticsError]
(Int -> ReadS ColumnStatisticsError)
-> ReadS [ColumnStatisticsError]
-> ReadPrec ColumnStatisticsError
-> ReadPrec [ColumnStatisticsError]
-> Read ColumnStatisticsError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnStatisticsError]
$creadListPrec :: ReadPrec [ColumnStatisticsError]
readPrec :: ReadPrec ColumnStatisticsError
$creadPrec :: ReadPrec ColumnStatisticsError
readList :: ReadS [ColumnStatisticsError]
$creadList :: ReadS [ColumnStatisticsError]
readsPrec :: Int -> ReadS ColumnStatisticsError
$creadsPrec :: Int -> ReadS ColumnStatisticsError
Prelude.Read, Int -> ColumnStatisticsError -> ShowS
[ColumnStatisticsError] -> ShowS
ColumnStatisticsError -> String
(Int -> ColumnStatisticsError -> ShowS)
-> (ColumnStatisticsError -> String)
-> ([ColumnStatisticsError] -> ShowS)
-> Show ColumnStatisticsError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnStatisticsError] -> ShowS
$cshowList :: [ColumnStatisticsError] -> ShowS
show :: ColumnStatisticsError -> String
$cshow :: ColumnStatisticsError -> String
showsPrec :: Int -> ColumnStatisticsError -> ShowS
$cshowsPrec :: Int -> ColumnStatisticsError -> ShowS
Prelude.Show, (forall x. ColumnStatisticsError -> Rep ColumnStatisticsError x)
-> (forall x. Rep ColumnStatisticsError x -> ColumnStatisticsError)
-> Generic ColumnStatisticsError
forall x. Rep ColumnStatisticsError x -> ColumnStatisticsError
forall x. ColumnStatisticsError -> Rep ColumnStatisticsError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnStatisticsError x -> ColumnStatisticsError
$cfrom :: forall x. ColumnStatisticsError -> Rep ColumnStatisticsError x
Prelude.Generic)

-- |
-- Create a value of 'ColumnStatisticsError' 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:
--
-- 'error', 'columnStatisticsError_error' - An error message with the reason for the failure of an operation.
--
-- 'columnStatistics', 'columnStatisticsError_columnStatistics' - The @ColumnStatistics@ of the column.
newColumnStatisticsError ::
  ColumnStatisticsError
newColumnStatisticsError :: ColumnStatisticsError
newColumnStatisticsError =
  ColumnStatisticsError' :: Maybe ErrorDetail
-> Maybe ColumnStatistics -> ColumnStatisticsError
ColumnStatisticsError'
    { $sel:error:ColumnStatisticsError' :: Maybe ErrorDetail
error = Maybe ErrorDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:columnStatistics:ColumnStatisticsError' :: Maybe ColumnStatistics
columnStatistics = Maybe ColumnStatistics
forall a. Maybe a
Prelude.Nothing
    }

-- | An error message with the reason for the failure of an operation.
columnStatisticsError_error :: Lens.Lens' ColumnStatisticsError (Prelude.Maybe ErrorDetail)
columnStatisticsError_error :: (Maybe ErrorDetail -> f (Maybe ErrorDetail))
-> ColumnStatisticsError -> f ColumnStatisticsError
columnStatisticsError_error = (ColumnStatisticsError -> Maybe ErrorDetail)
-> (ColumnStatisticsError
    -> Maybe ErrorDetail -> ColumnStatisticsError)
-> Lens
     ColumnStatisticsError
     ColumnStatisticsError
     (Maybe ErrorDetail)
     (Maybe ErrorDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnStatisticsError' {Maybe ErrorDetail
error :: Maybe ErrorDetail
$sel:error:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ErrorDetail
error} -> Maybe ErrorDetail
error) (\s :: ColumnStatisticsError
s@ColumnStatisticsError' {} Maybe ErrorDetail
a -> ColumnStatisticsError
s {$sel:error:ColumnStatisticsError' :: Maybe ErrorDetail
error = Maybe ErrorDetail
a} :: ColumnStatisticsError)

-- | The @ColumnStatistics@ of the column.
columnStatisticsError_columnStatistics :: Lens.Lens' ColumnStatisticsError (Prelude.Maybe ColumnStatistics)
columnStatisticsError_columnStatistics :: (Maybe ColumnStatistics -> f (Maybe ColumnStatistics))
-> ColumnStatisticsError -> f ColumnStatisticsError
columnStatisticsError_columnStatistics = (ColumnStatisticsError -> Maybe ColumnStatistics)
-> (ColumnStatisticsError
    -> Maybe ColumnStatistics -> ColumnStatisticsError)
-> Lens
     ColumnStatisticsError
     ColumnStatisticsError
     (Maybe ColumnStatistics)
     (Maybe ColumnStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnStatisticsError' {Maybe ColumnStatistics
columnStatistics :: Maybe ColumnStatistics
$sel:columnStatistics:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ColumnStatistics
columnStatistics} -> Maybe ColumnStatistics
columnStatistics) (\s :: ColumnStatisticsError
s@ColumnStatisticsError' {} Maybe ColumnStatistics
a -> ColumnStatisticsError
s {$sel:columnStatistics:ColumnStatisticsError' :: Maybe ColumnStatistics
columnStatistics = Maybe ColumnStatistics
a} :: ColumnStatisticsError)

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

instance Prelude.Hashable ColumnStatisticsError

instance Prelude.NFData ColumnStatisticsError