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