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