{-# 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.ResourceGroups.Types.QueryError where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResourceGroups.Types.QueryErrorCode
data QueryError = QueryError'
{
QueryError -> Maybe QueryErrorCode
errorCode :: Prelude.Maybe QueryErrorCode,
QueryError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
}
deriving (QueryError -> QueryError -> Bool
(QueryError -> QueryError -> Bool)
-> (QueryError -> QueryError -> Bool) -> Eq QueryError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryError -> QueryError -> Bool
$c/= :: QueryError -> QueryError -> Bool
== :: QueryError -> QueryError -> Bool
$c== :: QueryError -> QueryError -> Bool
Prelude.Eq, ReadPrec [QueryError]
ReadPrec QueryError
Int -> ReadS QueryError
ReadS [QueryError]
(Int -> ReadS QueryError)
-> ReadS [QueryError]
-> ReadPrec QueryError
-> ReadPrec [QueryError]
-> Read QueryError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryError]
$creadListPrec :: ReadPrec [QueryError]
readPrec :: ReadPrec QueryError
$creadPrec :: ReadPrec QueryError
readList :: ReadS [QueryError]
$creadList :: ReadS [QueryError]
readsPrec :: Int -> ReadS QueryError
$creadsPrec :: Int -> ReadS QueryError
Prelude.Read, Int -> QueryError -> ShowS
[QueryError] -> ShowS
QueryError -> String
(Int -> QueryError -> ShowS)
-> (QueryError -> String)
-> ([QueryError] -> ShowS)
-> Show QueryError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryError] -> ShowS
$cshowList :: [QueryError] -> ShowS
show :: QueryError -> String
$cshow :: QueryError -> String
showsPrec :: Int -> QueryError -> ShowS
$cshowsPrec :: Int -> QueryError -> ShowS
Prelude.Show, (forall x. QueryError -> Rep QueryError x)
-> (forall x. Rep QueryError x -> QueryError) -> Generic QueryError
forall x. Rep QueryError x -> QueryError
forall x. QueryError -> Rep QueryError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryError x -> QueryError
$cfrom :: forall x. QueryError -> Rep QueryError x
Prelude.Generic)
newQueryError ::
QueryError
newQueryError :: QueryError
newQueryError =
QueryError' :: Maybe QueryErrorCode -> Maybe Text -> QueryError
QueryError'
{ $sel:errorCode:QueryError' :: Maybe QueryErrorCode
errorCode = Maybe QueryErrorCode
forall a. Maybe a
Prelude.Nothing,
$sel:message:QueryError' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
queryError_errorCode :: Lens.Lens' QueryError (Prelude.Maybe QueryErrorCode)
queryError_errorCode :: (Maybe QueryErrorCode -> f (Maybe QueryErrorCode))
-> QueryError -> f QueryError
queryError_errorCode = (QueryError -> Maybe QueryErrorCode)
-> (QueryError -> Maybe QueryErrorCode -> QueryError)
-> Lens
QueryError QueryError (Maybe QueryErrorCode) (Maybe QueryErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryError' {Maybe QueryErrorCode
errorCode :: Maybe QueryErrorCode
$sel:errorCode:QueryError' :: QueryError -> Maybe QueryErrorCode
errorCode} -> Maybe QueryErrorCode
errorCode) (\s :: QueryError
s@QueryError' {} Maybe QueryErrorCode
a -> QueryError
s {$sel:errorCode:QueryError' :: Maybe QueryErrorCode
errorCode = Maybe QueryErrorCode
a} :: QueryError)
queryError_message :: Lens.Lens' QueryError (Prelude.Maybe Prelude.Text)
queryError_message :: (Maybe Text -> f (Maybe Text)) -> QueryError -> f QueryError
queryError_message = (QueryError -> Maybe Text)
-> (QueryError -> Maybe Text -> QueryError)
-> Lens QueryError QueryError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryError' {Maybe Text
message :: Maybe Text
$sel:message:QueryError' :: QueryError -> Maybe Text
message} -> Maybe Text
message) (\s :: QueryError
s@QueryError' {} Maybe Text
a -> QueryError
s {$sel:message:QueryError' :: Maybe Text
message = Maybe Text
a} :: QueryError)
instance Core.FromJSON QueryError where
parseJSON :: Value -> Parser QueryError
parseJSON =
String
-> (Object -> Parser QueryError) -> Value -> Parser QueryError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"QueryError"
( \Object
x ->
Maybe QueryErrorCode -> Maybe Text -> QueryError
QueryError'
(Maybe QueryErrorCode -> Maybe Text -> QueryError)
-> Parser (Maybe QueryErrorCode)
-> Parser (Maybe Text -> QueryError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe QueryErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
Parser (Maybe Text -> QueryError)
-> Parser (Maybe Text) -> Parser QueryError
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 QueryError
instance Prelude.NFData QueryError