{-# 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 #-}
module Amazonka.IoTSiteWise.Types.DetailedError where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.DetailedErrorCode
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DetailedError = DetailedError'
{
DetailedError -> DetailedErrorCode
code :: DetailedErrorCode,
DetailedError -> Text
message :: Prelude.Text
}
deriving (DetailedError -> DetailedError -> Bool
(DetailedError -> DetailedError -> Bool)
-> (DetailedError -> DetailedError -> Bool) -> Eq DetailedError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetailedError -> DetailedError -> Bool
$c/= :: DetailedError -> DetailedError -> Bool
== :: DetailedError -> DetailedError -> Bool
$c== :: DetailedError -> DetailedError -> Bool
Prelude.Eq, ReadPrec [DetailedError]
ReadPrec DetailedError
Int -> ReadS DetailedError
ReadS [DetailedError]
(Int -> ReadS DetailedError)
-> ReadS [DetailedError]
-> ReadPrec DetailedError
-> ReadPrec [DetailedError]
-> Read DetailedError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetailedError]
$creadListPrec :: ReadPrec [DetailedError]
readPrec :: ReadPrec DetailedError
$creadPrec :: ReadPrec DetailedError
readList :: ReadS [DetailedError]
$creadList :: ReadS [DetailedError]
readsPrec :: Int -> ReadS DetailedError
$creadsPrec :: Int -> ReadS DetailedError
Prelude.Read, Int -> DetailedError -> ShowS
[DetailedError] -> ShowS
DetailedError -> String
(Int -> DetailedError -> ShowS)
-> (DetailedError -> String)
-> ([DetailedError] -> ShowS)
-> Show DetailedError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetailedError] -> ShowS
$cshowList :: [DetailedError] -> ShowS
show :: DetailedError -> String
$cshow :: DetailedError -> String
showsPrec :: Int -> DetailedError -> ShowS
$cshowsPrec :: Int -> DetailedError -> ShowS
Prelude.Show, (forall x. DetailedError -> Rep DetailedError x)
-> (forall x. Rep DetailedError x -> DetailedError)
-> Generic DetailedError
forall x. Rep DetailedError x -> DetailedError
forall x. DetailedError -> Rep DetailedError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetailedError x -> DetailedError
$cfrom :: forall x. DetailedError -> Rep DetailedError x
Prelude.Generic)
newDetailedError ::
DetailedErrorCode ->
Prelude.Text ->
DetailedError
newDetailedError :: DetailedErrorCode -> Text -> DetailedError
newDetailedError DetailedErrorCode
pCode_ Text
pMessage_ =
DetailedError' :: DetailedErrorCode -> Text -> DetailedError
DetailedError' {$sel:code:DetailedError' :: DetailedErrorCode
code = DetailedErrorCode
pCode_, $sel:message:DetailedError' :: Text
message = Text
pMessage_}
detailedError_code :: Lens.Lens' DetailedError DetailedErrorCode
detailedError_code :: (DetailedErrorCode -> f DetailedErrorCode)
-> DetailedError -> f DetailedError
detailedError_code = (DetailedError -> DetailedErrorCode)
-> (DetailedError -> DetailedErrorCode -> DetailedError)
-> Lens
DetailedError DetailedError DetailedErrorCode DetailedErrorCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetailedError' {DetailedErrorCode
code :: DetailedErrorCode
$sel:code:DetailedError' :: DetailedError -> DetailedErrorCode
code} -> DetailedErrorCode
code) (\s :: DetailedError
s@DetailedError' {} DetailedErrorCode
a -> DetailedError
s {$sel:code:DetailedError' :: DetailedErrorCode
code = DetailedErrorCode
a} :: DetailedError)
detailedError_message :: Lens.Lens' DetailedError Prelude.Text
detailedError_message :: (Text -> f Text) -> DetailedError -> f DetailedError
detailedError_message = (DetailedError -> Text)
-> (DetailedError -> Text -> DetailedError)
-> Lens DetailedError DetailedError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetailedError' {Text
message :: Text
$sel:message:DetailedError' :: DetailedError -> Text
message} -> Text
message) (\s :: DetailedError
s@DetailedError' {} Text
a -> DetailedError
s {$sel:message:DetailedError' :: Text
message = Text
a} :: DetailedError)
instance Core.FromJSON DetailedError where
parseJSON :: Value -> Parser DetailedError
parseJSON =
String
-> (Object -> Parser DetailedError)
-> Value
-> Parser DetailedError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DetailedError"
( \Object
x ->
DetailedErrorCode -> Text -> DetailedError
DetailedError'
(DetailedErrorCode -> Text -> DetailedError)
-> Parser DetailedErrorCode -> Parser (Text -> DetailedError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser DetailedErrorCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"code") Parser (Text -> DetailedError)
-> Parser Text -> Parser DetailedError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"message")
)
instance Prelude.Hashable DetailedError
instance Prelude.NFData DetailedError