{-# 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.DataExchange.Types.JobError where
import qualified Amazonka.Core as Core
import Amazonka.DataExchange.Types.Code
import Amazonka.DataExchange.Types.Details
import Amazonka.DataExchange.Types.JobErrorLimitName
import Amazonka.DataExchange.Types.JobErrorResourceTypes
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data JobError = JobError'
{
JobError -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
JobError -> Maybe JobErrorLimitName
limitName :: Prelude.Maybe JobErrorLimitName,
JobError -> Maybe JobErrorResourceTypes
resourceType :: Prelude.Maybe JobErrorResourceTypes,
JobError -> Maybe Details
details :: Prelude.Maybe Details,
JobError -> Maybe Double
limitValue :: Prelude.Maybe Prelude.Double,
JobError -> Text
message :: Prelude.Text,
JobError -> Code
code :: Code
}
deriving (JobError -> JobError -> Bool
(JobError -> JobError -> Bool)
-> (JobError -> JobError -> Bool) -> Eq JobError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobError -> JobError -> Bool
$c/= :: JobError -> JobError -> Bool
== :: JobError -> JobError -> Bool
$c== :: JobError -> JobError -> Bool
Prelude.Eq, ReadPrec [JobError]
ReadPrec JobError
Int -> ReadS JobError
ReadS [JobError]
(Int -> ReadS JobError)
-> ReadS [JobError]
-> ReadPrec JobError
-> ReadPrec [JobError]
-> Read JobError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobError]
$creadListPrec :: ReadPrec [JobError]
readPrec :: ReadPrec JobError
$creadPrec :: ReadPrec JobError
readList :: ReadS [JobError]
$creadList :: ReadS [JobError]
readsPrec :: Int -> ReadS JobError
$creadsPrec :: Int -> ReadS JobError
Prelude.Read, Int -> JobError -> ShowS
[JobError] -> ShowS
JobError -> String
(Int -> JobError -> ShowS)
-> (JobError -> String) -> ([JobError] -> ShowS) -> Show JobError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobError] -> ShowS
$cshowList :: [JobError] -> ShowS
show :: JobError -> String
$cshow :: JobError -> String
showsPrec :: Int -> JobError -> ShowS
$cshowsPrec :: Int -> JobError -> ShowS
Prelude.Show, (forall x. JobError -> Rep JobError x)
-> (forall x. Rep JobError x -> JobError) -> Generic JobError
forall x. Rep JobError x -> JobError
forall x. JobError -> Rep JobError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobError x -> JobError
$cfrom :: forall x. JobError -> Rep JobError x
Prelude.Generic)
newJobError ::
Prelude.Text ->
Code ->
JobError
newJobError :: Text -> Code -> JobError
newJobError Text
pMessage_ Code
pCode_ =
JobError' :: Maybe Text
-> Maybe JobErrorLimitName
-> Maybe JobErrorResourceTypes
-> Maybe Details
-> Maybe Double
-> Text
-> Code
-> JobError
JobError'
{ $sel:resourceId:JobError' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limitName:JobError' :: Maybe JobErrorLimitName
limitName = Maybe JobErrorLimitName
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:JobError' :: Maybe JobErrorResourceTypes
resourceType = Maybe JobErrorResourceTypes
forall a. Maybe a
Prelude.Nothing,
$sel:details:JobError' :: Maybe Details
details = Maybe Details
forall a. Maybe a
Prelude.Nothing,
$sel:limitValue:JobError' :: Maybe Double
limitValue = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:message:JobError' :: Text
message = Text
pMessage_,
$sel:code:JobError' :: Code
code = Code
pCode_
}
jobError_resourceId :: Lens.Lens' JobError (Prelude.Maybe Prelude.Text)
jobError_resourceId :: (Maybe Text -> f (Maybe Text)) -> JobError -> f JobError
jobError_resourceId = (JobError -> Maybe Text)
-> (JobError -> Maybe Text -> JobError)
-> Lens JobError JobError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:JobError' :: JobError -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: JobError
s@JobError' {} Maybe Text
a -> JobError
s {$sel:resourceId:JobError' :: Maybe Text
resourceId = Maybe Text
a} :: JobError)
jobError_limitName :: Lens.Lens' JobError (Prelude.Maybe JobErrorLimitName)
jobError_limitName :: (Maybe JobErrorLimitName -> f (Maybe JobErrorLimitName))
-> JobError -> f JobError
jobError_limitName = (JobError -> Maybe JobErrorLimitName)
-> (JobError -> Maybe JobErrorLimitName -> JobError)
-> Lens
JobError
JobError
(Maybe JobErrorLimitName)
(Maybe JobErrorLimitName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Maybe JobErrorLimitName
limitName :: Maybe JobErrorLimitName
$sel:limitName:JobError' :: JobError -> Maybe JobErrorLimitName
limitName} -> Maybe JobErrorLimitName
limitName) (\s :: JobError
s@JobError' {} Maybe JobErrorLimitName
a -> JobError
s {$sel:limitName:JobError' :: Maybe JobErrorLimitName
limitName = Maybe JobErrorLimitName
a} :: JobError)
jobError_resourceType :: Lens.Lens' JobError (Prelude.Maybe JobErrorResourceTypes)
jobError_resourceType :: (Maybe JobErrorResourceTypes -> f (Maybe JobErrorResourceTypes))
-> JobError -> f JobError
jobError_resourceType = (JobError -> Maybe JobErrorResourceTypes)
-> (JobError -> Maybe JobErrorResourceTypes -> JobError)
-> Lens
JobError
JobError
(Maybe JobErrorResourceTypes)
(Maybe JobErrorResourceTypes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Maybe JobErrorResourceTypes
resourceType :: Maybe JobErrorResourceTypes
$sel:resourceType:JobError' :: JobError -> Maybe JobErrorResourceTypes
resourceType} -> Maybe JobErrorResourceTypes
resourceType) (\s :: JobError
s@JobError' {} Maybe JobErrorResourceTypes
a -> JobError
s {$sel:resourceType:JobError' :: Maybe JobErrorResourceTypes
resourceType = Maybe JobErrorResourceTypes
a} :: JobError)
jobError_details :: Lens.Lens' JobError (Prelude.Maybe Details)
jobError_details :: (Maybe Details -> f (Maybe Details)) -> JobError -> f JobError
jobError_details = (JobError -> Maybe Details)
-> (JobError -> Maybe Details -> JobError)
-> Lens JobError JobError (Maybe Details) (Maybe Details)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Maybe Details
details :: Maybe Details
$sel:details:JobError' :: JobError -> Maybe Details
details} -> Maybe Details
details) (\s :: JobError
s@JobError' {} Maybe Details
a -> JobError
s {$sel:details:JobError' :: Maybe Details
details = Maybe Details
a} :: JobError)
jobError_limitValue :: Lens.Lens' JobError (Prelude.Maybe Prelude.Double)
jobError_limitValue :: (Maybe Double -> f (Maybe Double)) -> JobError -> f JobError
jobError_limitValue = (JobError -> Maybe Double)
-> (JobError -> Maybe Double -> JobError)
-> Lens JobError JobError (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Maybe Double
limitValue :: Maybe Double
$sel:limitValue:JobError' :: JobError -> Maybe Double
limitValue} -> Maybe Double
limitValue) (\s :: JobError
s@JobError' {} Maybe Double
a -> JobError
s {$sel:limitValue:JobError' :: Maybe Double
limitValue = Maybe Double
a} :: JobError)
jobError_message :: Lens.Lens' JobError Prelude.Text
jobError_message :: (Text -> f Text) -> JobError -> f JobError
jobError_message = (JobError -> Text)
-> (JobError -> Text -> JobError)
-> Lens JobError JobError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Text
message :: Text
$sel:message:JobError' :: JobError -> Text
message} -> Text
message) (\s :: JobError
s@JobError' {} Text
a -> JobError
s {$sel:message:JobError' :: Text
message = Text
a} :: JobError)
jobError_code :: Lens.Lens' JobError Code
jobError_code :: (Code -> f Code) -> JobError -> f JobError
jobError_code = (JobError -> Code)
-> (JobError -> Code -> JobError)
-> Lens JobError JobError Code Code
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobError' {Code
code :: Code
$sel:code:JobError' :: JobError -> Code
code} -> Code
code) (\s :: JobError
s@JobError' {} Code
a -> JobError
s {$sel:code:JobError' :: Code
code = Code
a} :: JobError)
instance Core.FromJSON JobError where
parseJSON :: Value -> Parser JobError
parseJSON =
String -> (Object -> Parser JobError) -> Value -> Parser JobError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JobError"
( \Object
x ->
Maybe Text
-> Maybe JobErrorLimitName
-> Maybe JobErrorResourceTypes
-> Maybe Details
-> Maybe Double
-> Text
-> Code
-> JobError
JobError'
(Maybe Text
-> Maybe JobErrorLimitName
-> Maybe JobErrorResourceTypes
-> Maybe Details
-> Maybe Double
-> Text
-> Code
-> JobError)
-> Parser (Maybe Text)
-> Parser
(Maybe JobErrorLimitName
-> Maybe JobErrorResourceTypes
-> Maybe Details
-> Maybe Double
-> Text
-> Code
-> JobError)
forall (f :: * -> *) a b. Functor 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
"ResourceId")
Parser
(Maybe JobErrorLimitName
-> Maybe JobErrorResourceTypes
-> Maybe Details
-> Maybe Double
-> Text
-> Code
-> JobError)
-> Parser (Maybe JobErrorLimitName)
-> Parser
(Maybe JobErrorResourceTypes
-> Maybe Details -> Maybe Double -> Text -> Code -> JobError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobErrorLimitName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LimitName")
Parser
(Maybe JobErrorResourceTypes
-> Maybe Details -> Maybe Double -> Text -> Code -> JobError)
-> Parser (Maybe JobErrorResourceTypes)
-> Parser
(Maybe Details -> Maybe Double -> Text -> Code -> JobError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobErrorResourceTypes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceType")
Parser (Maybe Details -> Maybe Double -> Text -> Code -> JobError)
-> Parser (Maybe Details)
-> Parser (Maybe Double -> Text -> Code -> JobError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Details)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Details")
Parser (Maybe Double -> Text -> Code -> JobError)
-> Parser (Maybe Double) -> Parser (Text -> Code -> JobError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LimitValue")
Parser (Text -> Code -> JobError)
-> Parser Text -> Parser (Code -> JobError)
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")
Parser (Code -> JobError) -> Parser Code -> Parser JobError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Code
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Code")
)
instance Prelude.Hashable JobError
instance Prelude.NFData JobError