{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MigrationHubStrategy.Types.ServerError
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MigrationHubStrategy.Types.ServerError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.ServerErrorCategory
import qualified Amazonka.Prelude as Prelude

-- | The error in server analysis.
--
-- /See:/ 'newServerError' smart constructor.
data ServerError = ServerError'
  { -- | The error category of server analysis.
    ServerError -> Maybe ServerErrorCategory
serverErrorCategory :: Prelude.Maybe ServerErrorCategory
  }
  deriving (ServerError -> ServerError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerError -> ServerError -> Bool
$c/= :: ServerError -> ServerError -> Bool
== :: ServerError -> ServerError -> Bool
$c== :: ServerError -> ServerError -> Bool
Prelude.Eq, ReadPrec [ServerError]
ReadPrec ServerError
Int -> ReadS ServerError
ReadS [ServerError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerError]
$creadListPrec :: ReadPrec [ServerError]
readPrec :: ReadPrec ServerError
$creadPrec :: ReadPrec ServerError
readList :: ReadS [ServerError]
$creadList :: ReadS [ServerError]
readsPrec :: Int -> ReadS ServerError
$creadsPrec :: Int -> ReadS ServerError
Prelude.Read, Int -> ServerError -> ShowS
[ServerError] -> ShowS
ServerError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerError] -> ShowS
$cshowList :: [ServerError] -> ShowS
show :: ServerError -> String
$cshow :: ServerError -> String
showsPrec :: Int -> ServerError -> ShowS
$cshowsPrec :: Int -> ServerError -> ShowS
Prelude.Show, forall x. Rep ServerError x -> ServerError
forall x. ServerError -> Rep ServerError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServerError x -> ServerError
$cfrom :: forall x. ServerError -> Rep ServerError x
Prelude.Generic)

-- |
-- Create a value of 'ServerError' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'serverErrorCategory', 'serverError_serverErrorCategory' - The error category of server analysis.
newServerError ::
  ServerError
newServerError :: ServerError
newServerError =
  ServerError' {$sel:serverErrorCategory:ServerError' :: Maybe ServerErrorCategory
serverErrorCategory = forall a. Maybe a
Prelude.Nothing}

-- | The error category of server analysis.
serverError_serverErrorCategory :: Lens.Lens' ServerError (Prelude.Maybe ServerErrorCategory)
serverError_serverErrorCategory :: Lens' ServerError (Maybe ServerErrorCategory)
serverError_serverErrorCategory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerError' {Maybe ServerErrorCategory
serverErrorCategory :: Maybe ServerErrorCategory
$sel:serverErrorCategory:ServerError' :: ServerError -> Maybe ServerErrorCategory
serverErrorCategory} -> Maybe ServerErrorCategory
serverErrorCategory) (\s :: ServerError
s@ServerError' {} Maybe ServerErrorCategory
a -> ServerError
s {$sel:serverErrorCategory:ServerError' :: Maybe ServerErrorCategory
serverErrorCategory = Maybe ServerErrorCategory
a} :: ServerError)

instance Data.FromJSON ServerError where
  parseJSON :: Value -> Parser ServerError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerError"
      ( \Object
x ->
          Maybe ServerErrorCategory -> ServerError
ServerError'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serverErrorCategory")
      )

instance Prelude.Hashable ServerError where
  hashWithSalt :: Int -> ServerError -> Int
hashWithSalt Int
_salt ServerError' {Maybe ServerErrorCategory
serverErrorCategory :: Maybe ServerErrorCategory
$sel:serverErrorCategory:ServerError' :: ServerError -> Maybe ServerErrorCategory
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServerErrorCategory
serverErrorCategory

instance Prelude.NFData ServerError where
  rnf :: ServerError -> ()
rnf ServerError' {Maybe ServerErrorCategory
serverErrorCategory :: Maybe ServerErrorCategory
$sel:serverErrorCategory:ServerError' :: ServerError -> Maybe ServerErrorCategory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ServerErrorCategory
serverErrorCategory