{-# 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.FinSpaceData.Types.DataViewErrorInfo
-- 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.FinSpaceData.Types.DataViewErrorInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FinSpaceData.Types.ErrorCategory
import qualified Amazonka.Prelude as Prelude

-- | The structure with error messages.
--
-- /See:/ 'newDataViewErrorInfo' smart constructor.
data DataViewErrorInfo = DataViewErrorInfo'
  { -- | The category of the error.
    --
    -- -   @VALIDATION@ – The inputs to this request are invalid.
    --
    -- -   @SERVICE_QUOTA_EXCEEDED@ – Service quotas have been exceeded. Please
    --     contact AWS support to increase quotas.
    --
    -- -   @ACCESS_DENIED@ – Missing required permission to perform this
    --     request.
    --
    -- -   @RESOURCE_NOT_FOUND@ – One or more inputs to this request were not
    --     found.
    --
    -- -   @THROTTLING@ – The system temporarily lacks sufficient resources to
    --     process the request.
    --
    -- -   @INTERNAL_SERVICE_EXCEPTION@ – An internal service error has
    --     occurred.
    --
    -- -   @CANCELLED@ – Cancelled.
    --
    -- -   @USER_RECOVERABLE@ – A user recoverable error has occurred.
    DataViewErrorInfo -> Maybe ErrorCategory
errorCategory :: Prelude.Maybe ErrorCategory,
    -- | The text of the error message.
    DataViewErrorInfo -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (DataViewErrorInfo -> DataViewErrorInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataViewErrorInfo -> DataViewErrorInfo -> Bool
$c/= :: DataViewErrorInfo -> DataViewErrorInfo -> Bool
== :: DataViewErrorInfo -> DataViewErrorInfo -> Bool
$c== :: DataViewErrorInfo -> DataViewErrorInfo -> Bool
Prelude.Eq, ReadPrec [DataViewErrorInfo]
ReadPrec DataViewErrorInfo
Int -> ReadS DataViewErrorInfo
ReadS [DataViewErrorInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataViewErrorInfo]
$creadListPrec :: ReadPrec [DataViewErrorInfo]
readPrec :: ReadPrec DataViewErrorInfo
$creadPrec :: ReadPrec DataViewErrorInfo
readList :: ReadS [DataViewErrorInfo]
$creadList :: ReadS [DataViewErrorInfo]
readsPrec :: Int -> ReadS DataViewErrorInfo
$creadsPrec :: Int -> ReadS DataViewErrorInfo
Prelude.Read, Int -> DataViewErrorInfo -> ShowS
[DataViewErrorInfo] -> ShowS
DataViewErrorInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataViewErrorInfo] -> ShowS
$cshowList :: [DataViewErrorInfo] -> ShowS
show :: DataViewErrorInfo -> String
$cshow :: DataViewErrorInfo -> String
showsPrec :: Int -> DataViewErrorInfo -> ShowS
$cshowsPrec :: Int -> DataViewErrorInfo -> ShowS
Prelude.Show, forall x. Rep DataViewErrorInfo x -> DataViewErrorInfo
forall x. DataViewErrorInfo -> Rep DataViewErrorInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataViewErrorInfo x -> DataViewErrorInfo
$cfrom :: forall x. DataViewErrorInfo -> Rep DataViewErrorInfo x
Prelude.Generic)

-- |
-- Create a value of 'DataViewErrorInfo' 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:
--
-- 'errorCategory', 'dataViewErrorInfo_errorCategory' - The category of the error.
--
-- -   @VALIDATION@ – The inputs to this request are invalid.
--
-- -   @SERVICE_QUOTA_EXCEEDED@ – Service quotas have been exceeded. Please
--     contact AWS support to increase quotas.
--
-- -   @ACCESS_DENIED@ – Missing required permission to perform this
--     request.
--
-- -   @RESOURCE_NOT_FOUND@ – One or more inputs to this request were not
--     found.
--
-- -   @THROTTLING@ – The system temporarily lacks sufficient resources to
--     process the request.
--
-- -   @INTERNAL_SERVICE_EXCEPTION@ – An internal service error has
--     occurred.
--
-- -   @CANCELLED@ – Cancelled.
--
-- -   @USER_RECOVERABLE@ – A user recoverable error has occurred.
--
-- 'errorMessage', 'dataViewErrorInfo_errorMessage' - The text of the error message.
newDataViewErrorInfo ::
  DataViewErrorInfo
newDataViewErrorInfo :: DataViewErrorInfo
newDataViewErrorInfo =
  DataViewErrorInfo'
    { $sel:errorCategory:DataViewErrorInfo' :: Maybe ErrorCategory
errorCategory = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:DataViewErrorInfo' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The category of the error.
--
-- -   @VALIDATION@ – The inputs to this request are invalid.
--
-- -   @SERVICE_QUOTA_EXCEEDED@ – Service quotas have been exceeded. Please
--     contact AWS support to increase quotas.
--
-- -   @ACCESS_DENIED@ – Missing required permission to perform this
--     request.
--
-- -   @RESOURCE_NOT_FOUND@ – One or more inputs to this request were not
--     found.
--
-- -   @THROTTLING@ – The system temporarily lacks sufficient resources to
--     process the request.
--
-- -   @INTERNAL_SERVICE_EXCEPTION@ – An internal service error has
--     occurred.
--
-- -   @CANCELLED@ – Cancelled.
--
-- -   @USER_RECOVERABLE@ – A user recoverable error has occurred.
dataViewErrorInfo_errorCategory :: Lens.Lens' DataViewErrorInfo (Prelude.Maybe ErrorCategory)
dataViewErrorInfo_errorCategory :: Lens' DataViewErrorInfo (Maybe ErrorCategory)
dataViewErrorInfo_errorCategory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataViewErrorInfo' {Maybe ErrorCategory
errorCategory :: Maybe ErrorCategory
$sel:errorCategory:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe ErrorCategory
errorCategory} -> Maybe ErrorCategory
errorCategory) (\s :: DataViewErrorInfo
s@DataViewErrorInfo' {} Maybe ErrorCategory
a -> DataViewErrorInfo
s {$sel:errorCategory:DataViewErrorInfo' :: Maybe ErrorCategory
errorCategory = Maybe ErrorCategory
a} :: DataViewErrorInfo)

-- | The text of the error message.
dataViewErrorInfo_errorMessage :: Lens.Lens' DataViewErrorInfo (Prelude.Maybe Prelude.Text)
dataViewErrorInfo_errorMessage :: Lens' DataViewErrorInfo (Maybe Text)
dataViewErrorInfo_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataViewErrorInfo' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: DataViewErrorInfo
s@DataViewErrorInfo' {} Maybe Text
a -> DataViewErrorInfo
s {$sel:errorMessage:DataViewErrorInfo' :: Maybe Text
errorMessage = Maybe Text
a} :: DataViewErrorInfo)

instance Data.FromJSON DataViewErrorInfo where
  parseJSON :: Value -> Parser DataViewErrorInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataViewErrorInfo"
      ( \Object
x ->
          Maybe ErrorCategory -> Maybe Text -> DataViewErrorInfo
DataViewErrorInfo'
            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
"errorCategory")
            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
"errorMessage")
      )

instance Prelude.Hashable DataViewErrorInfo where
  hashWithSalt :: Int -> DataViewErrorInfo -> Int
hashWithSalt Int
_salt DataViewErrorInfo' {Maybe Text
Maybe ErrorCategory
errorMessage :: Maybe Text
errorCategory :: Maybe ErrorCategory
$sel:errorMessage:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe Text
$sel:errorCategory:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe ErrorCategory
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorCategory
errorCategory
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage

instance Prelude.NFData DataViewErrorInfo where
  rnf :: DataViewErrorInfo -> ()
rnf DataViewErrorInfo' {Maybe Text
Maybe ErrorCategory
errorMessage :: Maybe Text
errorCategory :: Maybe ErrorCategory
$sel:errorMessage:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe Text
$sel:errorCategory:DataViewErrorInfo' :: DataViewErrorInfo -> Maybe ErrorCategory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorCategory
errorCategory
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage