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

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

-- | Dashboard error.
--
-- /See:/ 'newDashboardError' smart constructor.
data DashboardError = DashboardError'
  { -- | Type.
    DashboardError -> Maybe DashboardErrorType
type' :: Prelude.Maybe DashboardErrorType,
    -- | Message.
    DashboardError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (DashboardError -> DashboardError -> Bool
(DashboardError -> DashboardError -> Bool)
-> (DashboardError -> DashboardError -> Bool) -> Eq DashboardError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashboardError -> DashboardError -> Bool
$c/= :: DashboardError -> DashboardError -> Bool
== :: DashboardError -> DashboardError -> Bool
$c== :: DashboardError -> DashboardError -> Bool
Prelude.Eq, ReadPrec [DashboardError]
ReadPrec DashboardError
Int -> ReadS DashboardError
ReadS [DashboardError]
(Int -> ReadS DashboardError)
-> ReadS [DashboardError]
-> ReadPrec DashboardError
-> ReadPrec [DashboardError]
-> Read DashboardError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashboardError]
$creadListPrec :: ReadPrec [DashboardError]
readPrec :: ReadPrec DashboardError
$creadPrec :: ReadPrec DashboardError
readList :: ReadS [DashboardError]
$creadList :: ReadS [DashboardError]
readsPrec :: Int -> ReadS DashboardError
$creadsPrec :: Int -> ReadS DashboardError
Prelude.Read, Int -> DashboardError -> ShowS
[DashboardError] -> ShowS
DashboardError -> String
(Int -> DashboardError -> ShowS)
-> (DashboardError -> String)
-> ([DashboardError] -> ShowS)
-> Show DashboardError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashboardError] -> ShowS
$cshowList :: [DashboardError] -> ShowS
show :: DashboardError -> String
$cshow :: DashboardError -> String
showsPrec :: Int -> DashboardError -> ShowS
$cshowsPrec :: Int -> DashboardError -> ShowS
Prelude.Show, (forall x. DashboardError -> Rep DashboardError x)
-> (forall x. Rep DashboardError x -> DashboardError)
-> Generic DashboardError
forall x. Rep DashboardError x -> DashboardError
forall x. DashboardError -> Rep DashboardError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashboardError x -> DashboardError
$cfrom :: forall x. DashboardError -> Rep DashboardError x
Prelude.Generic)

-- |
-- Create a value of 'DashboardError' 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'', 'dashboardError_type' - Type.
--
-- 'message', 'dashboardError_message' - Message.
newDashboardError ::
  DashboardError
newDashboardError :: DashboardError
newDashboardError =
  DashboardError' :: Maybe DashboardErrorType -> Maybe Text -> DashboardError
DashboardError'
    { $sel:type':DashboardError' :: Maybe DashboardErrorType
type' = Maybe DashboardErrorType
forall a. Maybe a
Prelude.Nothing,
      $sel:message:DashboardError' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Type.
dashboardError_type :: Lens.Lens' DashboardError (Prelude.Maybe DashboardErrorType)
dashboardError_type :: (Maybe DashboardErrorType -> f (Maybe DashboardErrorType))
-> DashboardError -> f DashboardError
dashboardError_type = (DashboardError -> Maybe DashboardErrorType)
-> (DashboardError -> Maybe DashboardErrorType -> DashboardError)
-> Lens
     DashboardError
     DashboardError
     (Maybe DashboardErrorType)
     (Maybe DashboardErrorType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardError' {Maybe DashboardErrorType
type' :: Maybe DashboardErrorType
$sel:type':DashboardError' :: DashboardError -> Maybe DashboardErrorType
type'} -> Maybe DashboardErrorType
type') (\s :: DashboardError
s@DashboardError' {} Maybe DashboardErrorType
a -> DashboardError
s {$sel:type':DashboardError' :: Maybe DashboardErrorType
type' = Maybe DashboardErrorType
a} :: DashboardError)

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

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

instance Prelude.NFData DashboardError