{-# 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.QuickSight.Types.DataSourceErrorInfo
-- 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.QuickSight.Types.DataSourceErrorInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.DataSourceErrorInfoType

-- | Error information for the data source creation or update.
--
-- /See:/ 'newDataSourceErrorInfo' smart constructor.
data DataSourceErrorInfo = DataSourceErrorInfo'
  { -- | Error type.
    DataSourceErrorInfo -> Maybe DataSourceErrorInfoType
type' :: Prelude.Maybe DataSourceErrorInfoType,
    -- | Error message.
    DataSourceErrorInfo -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (DataSourceErrorInfo -> DataSourceErrorInfo -> Bool
(DataSourceErrorInfo -> DataSourceErrorInfo -> Bool)
-> (DataSourceErrorInfo -> DataSourceErrorInfo -> Bool)
-> Eq DataSourceErrorInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSourceErrorInfo -> DataSourceErrorInfo -> Bool
$c/= :: DataSourceErrorInfo -> DataSourceErrorInfo -> Bool
== :: DataSourceErrorInfo -> DataSourceErrorInfo -> Bool
$c== :: DataSourceErrorInfo -> DataSourceErrorInfo -> Bool
Prelude.Eq, ReadPrec [DataSourceErrorInfo]
ReadPrec DataSourceErrorInfo
Int -> ReadS DataSourceErrorInfo
ReadS [DataSourceErrorInfo]
(Int -> ReadS DataSourceErrorInfo)
-> ReadS [DataSourceErrorInfo]
-> ReadPrec DataSourceErrorInfo
-> ReadPrec [DataSourceErrorInfo]
-> Read DataSourceErrorInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSourceErrorInfo]
$creadListPrec :: ReadPrec [DataSourceErrorInfo]
readPrec :: ReadPrec DataSourceErrorInfo
$creadPrec :: ReadPrec DataSourceErrorInfo
readList :: ReadS [DataSourceErrorInfo]
$creadList :: ReadS [DataSourceErrorInfo]
readsPrec :: Int -> ReadS DataSourceErrorInfo
$creadsPrec :: Int -> ReadS DataSourceErrorInfo
Prelude.Read, Int -> DataSourceErrorInfo -> ShowS
[DataSourceErrorInfo] -> ShowS
DataSourceErrorInfo -> String
(Int -> DataSourceErrorInfo -> ShowS)
-> (DataSourceErrorInfo -> String)
-> ([DataSourceErrorInfo] -> ShowS)
-> Show DataSourceErrorInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSourceErrorInfo] -> ShowS
$cshowList :: [DataSourceErrorInfo] -> ShowS
show :: DataSourceErrorInfo -> String
$cshow :: DataSourceErrorInfo -> String
showsPrec :: Int -> DataSourceErrorInfo -> ShowS
$cshowsPrec :: Int -> DataSourceErrorInfo -> ShowS
Prelude.Show, (forall x. DataSourceErrorInfo -> Rep DataSourceErrorInfo x)
-> (forall x. Rep DataSourceErrorInfo x -> DataSourceErrorInfo)
-> Generic DataSourceErrorInfo
forall x. Rep DataSourceErrorInfo x -> DataSourceErrorInfo
forall x. DataSourceErrorInfo -> Rep DataSourceErrorInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSourceErrorInfo x -> DataSourceErrorInfo
$cfrom :: forall x. DataSourceErrorInfo -> Rep DataSourceErrorInfo x
Prelude.Generic)

-- |
-- Create a value of 'DataSourceErrorInfo' 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:
--
-- 'type'', 'dataSourceErrorInfo_type' - Error type.
--
-- 'message', 'dataSourceErrorInfo_message' - Error message.
newDataSourceErrorInfo ::
  DataSourceErrorInfo
newDataSourceErrorInfo :: DataSourceErrorInfo
newDataSourceErrorInfo =
  DataSourceErrorInfo' :: Maybe DataSourceErrorInfoType -> Maybe Text -> DataSourceErrorInfo
DataSourceErrorInfo'
    { $sel:type':DataSourceErrorInfo' :: Maybe DataSourceErrorInfoType
type' = Maybe DataSourceErrorInfoType
forall a. Maybe a
Prelude.Nothing,
      $sel:message:DataSourceErrorInfo' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Error type.
dataSourceErrorInfo_type :: Lens.Lens' DataSourceErrorInfo (Prelude.Maybe DataSourceErrorInfoType)
dataSourceErrorInfo_type :: (Maybe DataSourceErrorInfoType
 -> f (Maybe DataSourceErrorInfoType))
-> DataSourceErrorInfo -> f DataSourceErrorInfo
dataSourceErrorInfo_type = (DataSourceErrorInfo -> Maybe DataSourceErrorInfoType)
-> (DataSourceErrorInfo
    -> Maybe DataSourceErrorInfoType -> DataSourceErrorInfo)
-> Lens
     DataSourceErrorInfo
     DataSourceErrorInfo
     (Maybe DataSourceErrorInfoType)
     (Maybe DataSourceErrorInfoType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceErrorInfo' {Maybe DataSourceErrorInfoType
type' :: Maybe DataSourceErrorInfoType
$sel:type':DataSourceErrorInfo' :: DataSourceErrorInfo -> Maybe DataSourceErrorInfoType
type'} -> Maybe DataSourceErrorInfoType
type') (\s :: DataSourceErrorInfo
s@DataSourceErrorInfo' {} Maybe DataSourceErrorInfoType
a -> DataSourceErrorInfo
s {$sel:type':DataSourceErrorInfo' :: Maybe DataSourceErrorInfoType
type' = Maybe DataSourceErrorInfoType
a} :: DataSourceErrorInfo)

-- | Error message.
dataSourceErrorInfo_message :: Lens.Lens' DataSourceErrorInfo (Prelude.Maybe Prelude.Text)
dataSourceErrorInfo_message :: (Maybe Text -> f (Maybe Text))
-> DataSourceErrorInfo -> f DataSourceErrorInfo
dataSourceErrorInfo_message = (DataSourceErrorInfo -> Maybe Text)
-> (DataSourceErrorInfo -> Maybe Text -> DataSourceErrorInfo)
-> Lens
     DataSourceErrorInfo DataSourceErrorInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceErrorInfo' {Maybe Text
message :: Maybe Text
$sel:message:DataSourceErrorInfo' :: DataSourceErrorInfo -> Maybe Text
message} -> Maybe Text
message) (\s :: DataSourceErrorInfo
s@DataSourceErrorInfo' {} Maybe Text
a -> DataSourceErrorInfo
s {$sel:message:DataSourceErrorInfo' :: Maybe Text
message = Maybe Text
a} :: DataSourceErrorInfo)

instance Core.FromJSON DataSourceErrorInfo where
  parseJSON :: Value -> Parser DataSourceErrorInfo
parseJSON =
    String
-> (Object -> Parser DataSourceErrorInfo)
-> Value
-> Parser DataSourceErrorInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataSourceErrorInfo"
      ( \Object
x ->
          Maybe DataSourceErrorInfoType -> Maybe Text -> DataSourceErrorInfo
DataSourceErrorInfo'
            (Maybe DataSourceErrorInfoType
 -> Maybe Text -> DataSourceErrorInfo)
-> Parser (Maybe DataSourceErrorInfoType)
-> Parser (Maybe Text -> DataSourceErrorInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DataSourceErrorInfoType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> DataSourceErrorInfo)
-> Parser (Maybe Text) -> Parser DataSourceErrorInfo
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
"Message")
      )

instance Prelude.Hashable DataSourceErrorInfo

instance Prelude.NFData DataSourceErrorInfo