{-# 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-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.ColumnStatisticsError 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.ColumnStatistics
import Amazonka.Glue.Types.ErrorDetail
import qualified Amazonka.Prelude as Prelude

-- | Encapsulates a @ColumnStatistics@ object that failed and the reason for
-- failure.
--
-- /See:/ 'newColumnStatisticsError' smart constructor.
data ColumnStatisticsError = ColumnStatisticsError'
  { -- | The @ColumnStatistics@ of the column.
    ColumnStatisticsError -> Maybe ColumnStatistics
columnStatistics :: Prelude.Maybe ColumnStatistics,
    -- | An error message with the reason for the failure of an operation.
    ColumnStatisticsError -> Maybe ErrorDetail
error :: Prelude.Maybe ErrorDetail
  }
  deriving (ColumnStatisticsError -> ColumnStatisticsError -> Bool
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]
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
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. 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:
--
-- 'columnStatistics', 'columnStatisticsError_columnStatistics' - The @ColumnStatistics@ of the column.
--
-- 'error', 'columnStatisticsError_error' - An error message with the reason for the failure of an operation.
newColumnStatisticsError ::
  ColumnStatisticsError
newColumnStatisticsError :: ColumnStatisticsError
newColumnStatisticsError =
  ColumnStatisticsError'
    { $sel:columnStatistics:ColumnStatisticsError' :: Maybe ColumnStatistics
columnStatistics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:error:ColumnStatisticsError' :: Maybe ErrorDetail
error = forall a. Maybe a
Prelude.Nothing
    }

-- | The @ColumnStatistics@ of the column.
columnStatisticsError_columnStatistics :: Lens.Lens' ColumnStatisticsError (Prelude.Maybe ColumnStatistics)
columnStatisticsError_columnStatistics :: Lens' ColumnStatisticsError (Maybe ColumnStatistics)
columnStatisticsError_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)

-- | An error message with the reason for the failure of an operation.
columnStatisticsError_error :: Lens.Lens' ColumnStatisticsError (Prelude.Maybe ErrorDetail)
columnStatisticsError_error :: Lens' ColumnStatisticsError (Maybe ErrorDetail)
columnStatisticsError_error = 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)

instance Data.FromJSON ColumnStatisticsError where
  parseJSON :: Value -> Parser ColumnStatisticsError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ColumnStatisticsError"
      ( \Object
x ->
          Maybe ColumnStatistics
-> Maybe ErrorDetail -> ColumnStatisticsError
ColumnStatisticsError'
            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
"ColumnStatistics")
            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
"Error")
      )

instance Prelude.Hashable ColumnStatisticsError where
  hashWithSalt :: Int -> ColumnStatisticsError -> Int
hashWithSalt Int
_salt ColumnStatisticsError' {Maybe ErrorDetail
Maybe ColumnStatistics
error :: Maybe ErrorDetail
columnStatistics :: Maybe ColumnStatistics
$sel:error:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ErrorDetail
$sel:columnStatistics:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ColumnStatistics
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ColumnStatistics
columnStatistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorDetail
error

instance Prelude.NFData ColumnStatisticsError where
  rnf :: ColumnStatisticsError -> ()
rnf ColumnStatisticsError' {Maybe ErrorDetail
Maybe ColumnStatistics
error :: Maybe ErrorDetail
columnStatistics :: Maybe ColumnStatistics
$sel:error:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ErrorDetail
$sel:columnStatistics:ColumnStatisticsError' :: ColumnStatisticsError -> Maybe ColumnStatistics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ColumnStatistics
columnStatistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorDetail
error