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