{-# 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.AppSync.Types.CodeError where
import Amazonka.AppSync.Types.CodeErrorLocation
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CodeError = CodeError'
{
CodeError -> Maybe Text
errorType :: Prelude.Maybe Prelude.Text,
CodeError -> Maybe CodeErrorLocation
location :: Prelude.Maybe CodeErrorLocation,
CodeError -> Maybe Text
value :: Prelude.Maybe Prelude.Text
}
deriving (CodeError -> CodeError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeError -> CodeError -> Bool
$c/= :: CodeError -> CodeError -> Bool
== :: CodeError -> CodeError -> Bool
$c== :: CodeError -> CodeError -> Bool
Prelude.Eq, ReadPrec [CodeError]
ReadPrec CodeError
Int -> ReadS CodeError
ReadS [CodeError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeError]
$creadListPrec :: ReadPrec [CodeError]
readPrec :: ReadPrec CodeError
$creadPrec :: ReadPrec CodeError
readList :: ReadS [CodeError]
$creadList :: ReadS [CodeError]
readsPrec :: Int -> ReadS CodeError
$creadsPrec :: Int -> ReadS CodeError
Prelude.Read, Int -> CodeError -> ShowS
[CodeError] -> ShowS
CodeError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeError] -> ShowS
$cshowList :: [CodeError] -> ShowS
show :: CodeError -> String
$cshow :: CodeError -> String
showsPrec :: Int -> CodeError -> ShowS
$cshowsPrec :: Int -> CodeError -> ShowS
Prelude.Show, forall x. Rep CodeError x -> CodeError
forall x. CodeError -> Rep CodeError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeError x -> CodeError
$cfrom :: forall x. CodeError -> Rep CodeError x
Prelude.Generic)
newCodeError ::
CodeError
newCodeError :: CodeError
newCodeError =
CodeError'
{ $sel:errorType:CodeError' :: Maybe Text
errorType = forall a. Maybe a
Prelude.Nothing,
$sel:location:CodeError' :: Maybe CodeErrorLocation
location = forall a. Maybe a
Prelude.Nothing,
$sel:value:CodeError' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
}
codeError_errorType :: Lens.Lens' CodeError (Prelude.Maybe Prelude.Text)
codeError_errorType :: Lens' CodeError (Maybe Text)
codeError_errorType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeError' {Maybe Text
errorType :: Maybe Text
$sel:errorType:CodeError' :: CodeError -> Maybe Text
errorType} -> Maybe Text
errorType) (\s :: CodeError
s@CodeError' {} Maybe Text
a -> CodeError
s {$sel:errorType:CodeError' :: Maybe Text
errorType = Maybe Text
a} :: CodeError)
codeError_location :: Lens.Lens' CodeError (Prelude.Maybe CodeErrorLocation)
codeError_location :: Lens' CodeError (Maybe CodeErrorLocation)
codeError_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeError' {Maybe CodeErrorLocation
location :: Maybe CodeErrorLocation
$sel:location:CodeError' :: CodeError -> Maybe CodeErrorLocation
location} -> Maybe CodeErrorLocation
location) (\s :: CodeError
s@CodeError' {} Maybe CodeErrorLocation
a -> CodeError
s {$sel:location:CodeError' :: Maybe CodeErrorLocation
location = Maybe CodeErrorLocation
a} :: CodeError)
codeError_value :: Lens.Lens' CodeError (Prelude.Maybe Prelude.Text)
codeError_value :: Lens' CodeError (Maybe Text)
codeError_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeError' {Maybe Text
value :: Maybe Text
$sel:value:CodeError' :: CodeError -> Maybe Text
value} -> Maybe Text
value) (\s :: CodeError
s@CodeError' {} Maybe Text
a -> CodeError
s {$sel:value:CodeError' :: Maybe Text
value = Maybe Text
a} :: CodeError)
instance Data.FromJSON CodeError where
parseJSON :: Value -> Parser CodeError
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CodeError"
( \Object
x ->
Maybe Text -> Maybe CodeErrorLocation -> Maybe Text -> CodeError
CodeError'
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
"errorType")
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
"location")
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
"value")
)
instance Prelude.Hashable CodeError where
hashWithSalt :: Int -> CodeError -> Int
hashWithSalt Int
_salt CodeError' {Maybe Text
Maybe CodeErrorLocation
value :: Maybe Text
location :: Maybe CodeErrorLocation
errorType :: Maybe Text
$sel:value:CodeError' :: CodeError -> Maybe Text
$sel:location:CodeError' :: CodeError -> Maybe CodeErrorLocation
$sel:errorType:CodeError' :: CodeError -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CodeErrorLocation
location
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value
instance Prelude.NFData CodeError where
rnf :: CodeError -> ()
rnf CodeError' {Maybe Text
Maybe CodeErrorLocation
value :: Maybe Text
location :: Maybe CodeErrorLocation
errorType :: Maybe Text
$sel:value:CodeError' :: CodeError -> Maybe Text
$sel:location:CodeError' :: CodeError -> Maybe CodeErrorLocation
$sel:errorType:CodeError' :: CodeError -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CodeErrorLocation
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value