{-# 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.ComputeOptimizer.Types.GetRecommendationError
-- 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.ComputeOptimizer.Types.GetRecommendationError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes an error experienced when getting recommendations.
--
-- For example, an error is returned if you request recommendations for an
-- unsupported Auto Scaling group, or if you request recommendations for an
-- instance of an unsupported instance family.
--
-- /See:/ 'newGetRecommendationError' smart constructor.
data GetRecommendationError = GetRecommendationError'
  { -- | The error code.
    GetRecommendationError -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | The ID of the error.
    GetRecommendationError -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | The message, or reason, for the error.
    GetRecommendationError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (GetRecommendationError -> GetRecommendationError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommendationError -> GetRecommendationError -> Bool
$c/= :: GetRecommendationError -> GetRecommendationError -> Bool
== :: GetRecommendationError -> GetRecommendationError -> Bool
$c== :: GetRecommendationError -> GetRecommendationError -> Bool
Prelude.Eq, ReadPrec [GetRecommendationError]
ReadPrec GetRecommendationError
Int -> ReadS GetRecommendationError
ReadS [GetRecommendationError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommendationError]
$creadListPrec :: ReadPrec [GetRecommendationError]
readPrec :: ReadPrec GetRecommendationError
$creadPrec :: ReadPrec GetRecommendationError
readList :: ReadS [GetRecommendationError]
$creadList :: ReadS [GetRecommendationError]
readsPrec :: Int -> ReadS GetRecommendationError
$creadsPrec :: Int -> ReadS GetRecommendationError
Prelude.Read, Int -> GetRecommendationError -> ShowS
[GetRecommendationError] -> ShowS
GetRecommendationError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommendationError] -> ShowS
$cshowList :: [GetRecommendationError] -> ShowS
show :: GetRecommendationError -> String
$cshow :: GetRecommendationError -> String
showsPrec :: Int -> GetRecommendationError -> ShowS
$cshowsPrec :: Int -> GetRecommendationError -> ShowS
Prelude.Show, forall x. Rep GetRecommendationError x -> GetRecommendationError
forall x. GetRecommendationError -> Rep GetRecommendationError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRecommendationError x -> GetRecommendationError
$cfrom :: forall x. GetRecommendationError -> Rep GetRecommendationError x
Prelude.Generic)

-- |
-- Create a value of 'GetRecommendationError' 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:
--
-- 'code', 'getRecommendationError_code' - The error code.
--
-- 'identifier', 'getRecommendationError_identifier' - The ID of the error.
--
-- 'message', 'getRecommendationError_message' - The message, or reason, for the error.
newGetRecommendationError ::
  GetRecommendationError
newGetRecommendationError :: GetRecommendationError
newGetRecommendationError =
  GetRecommendationError'
    { $sel:code:GetRecommendationError' :: Maybe Text
code = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:GetRecommendationError' :: Maybe Text
identifier = forall a. Maybe a
Prelude.Nothing,
      $sel:message:GetRecommendationError' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
getRecommendationError_code :: Lens.Lens' GetRecommendationError (Prelude.Maybe Prelude.Text)
getRecommendationError_code :: Lens' GetRecommendationError (Maybe Text)
getRecommendationError_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationError' {Maybe Text
code :: Maybe Text
$sel:code:GetRecommendationError' :: GetRecommendationError -> Maybe Text
code} -> Maybe Text
code) (\s :: GetRecommendationError
s@GetRecommendationError' {} Maybe Text
a -> GetRecommendationError
s {$sel:code:GetRecommendationError' :: Maybe Text
code = Maybe Text
a} :: GetRecommendationError)

-- | The ID of the error.
getRecommendationError_identifier :: Lens.Lens' GetRecommendationError (Prelude.Maybe Prelude.Text)
getRecommendationError_identifier :: Lens' GetRecommendationError (Maybe Text)
getRecommendationError_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationError' {Maybe Text
identifier :: Maybe Text
$sel:identifier:GetRecommendationError' :: GetRecommendationError -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: GetRecommendationError
s@GetRecommendationError' {} Maybe Text
a -> GetRecommendationError
s {$sel:identifier:GetRecommendationError' :: Maybe Text
identifier = Maybe Text
a} :: GetRecommendationError)

-- | The message, or reason, for the error.
getRecommendationError_message :: Lens.Lens' GetRecommendationError (Prelude.Maybe Prelude.Text)
getRecommendationError_message :: Lens' GetRecommendationError (Maybe Text)
getRecommendationError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationError' {Maybe Text
message :: Maybe Text
$sel:message:GetRecommendationError' :: GetRecommendationError -> Maybe Text
message} -> Maybe Text
message) (\s :: GetRecommendationError
s@GetRecommendationError' {} Maybe Text
a -> GetRecommendationError
s {$sel:message:GetRecommendationError' :: Maybe Text
message = Maybe Text
a} :: GetRecommendationError)

instance Data.FromJSON GetRecommendationError where
  parseJSON :: Value -> Parser GetRecommendationError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GetRecommendationError"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> GetRecommendationError
GetRecommendationError'
            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
"code")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"identifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"message")
      )

instance Prelude.Hashable GetRecommendationError where
  hashWithSalt :: Int -> GetRecommendationError -> Int
hashWithSalt Int
_salt GetRecommendationError' {Maybe Text
message :: Maybe Text
identifier :: Maybe Text
code :: Maybe Text
$sel:message:GetRecommendationError' :: GetRecommendationError -> Maybe Text
$sel:identifier:GetRecommendationError' :: GetRecommendationError -> Maybe Text
$sel:code:GetRecommendationError' :: GetRecommendationError -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance Prelude.NFData GetRecommendationError where
  rnf :: GetRecommendationError -> ()
rnf GetRecommendationError' {Maybe Text
message :: Maybe Text
identifier :: Maybe Text
code :: Maybe Text
$sel:message:GetRecommendationError' :: GetRecommendationError -> Maybe Text
$sel:identifier:GetRecommendationError' :: GetRecommendationError -> Maybe Text
$sel:code:GetRecommendationError' :: GetRecommendationError -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
code
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message