{-# 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.SageMaker.Types.RenderingError
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.RenderingError where

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

-- | A description of an error that occurred while rendering the template.
--
-- /See:/ 'newRenderingError' smart constructor.
data RenderingError = RenderingError'
  { -- | A unique identifier for a specific class of errors.
    RenderingError -> Text
code :: Prelude.Text,
    -- | A human-readable message describing the error.
    RenderingError -> Text
message :: Prelude.Text
  }
  deriving (RenderingError -> RenderingError -> Bool
(RenderingError -> RenderingError -> Bool)
-> (RenderingError -> RenderingError -> Bool) -> Eq RenderingError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenderingError -> RenderingError -> Bool
$c/= :: RenderingError -> RenderingError -> Bool
== :: RenderingError -> RenderingError -> Bool
$c== :: RenderingError -> RenderingError -> Bool
Prelude.Eq, ReadPrec [RenderingError]
ReadPrec RenderingError
Int -> ReadS RenderingError
ReadS [RenderingError]
(Int -> ReadS RenderingError)
-> ReadS [RenderingError]
-> ReadPrec RenderingError
-> ReadPrec [RenderingError]
-> Read RenderingError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenderingError]
$creadListPrec :: ReadPrec [RenderingError]
readPrec :: ReadPrec RenderingError
$creadPrec :: ReadPrec RenderingError
readList :: ReadS [RenderingError]
$creadList :: ReadS [RenderingError]
readsPrec :: Int -> ReadS RenderingError
$creadsPrec :: Int -> ReadS RenderingError
Prelude.Read, Int -> RenderingError -> ShowS
[RenderingError] -> ShowS
RenderingError -> String
(Int -> RenderingError -> ShowS)
-> (RenderingError -> String)
-> ([RenderingError] -> ShowS)
-> Show RenderingError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenderingError] -> ShowS
$cshowList :: [RenderingError] -> ShowS
show :: RenderingError -> String
$cshow :: RenderingError -> String
showsPrec :: Int -> RenderingError -> ShowS
$cshowsPrec :: Int -> RenderingError -> ShowS
Prelude.Show, (forall x. RenderingError -> Rep RenderingError x)
-> (forall x. Rep RenderingError x -> RenderingError)
-> Generic RenderingError
forall x. Rep RenderingError x -> RenderingError
forall x. RenderingError -> Rep RenderingError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenderingError x -> RenderingError
$cfrom :: forall x. RenderingError -> Rep RenderingError x
Prelude.Generic)

-- |
-- Create a value of 'RenderingError' 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', 'renderingError_code' - A unique identifier for a specific class of errors.
--
-- 'message', 'renderingError_message' - A human-readable message describing the error.
newRenderingError ::
  -- | 'code'
  Prelude.Text ->
  -- | 'message'
  Prelude.Text ->
  RenderingError
newRenderingError :: Text -> Text -> RenderingError
newRenderingError Text
pCode_ Text
pMessage_ =
  RenderingError' :: Text -> Text -> RenderingError
RenderingError' {$sel:code:RenderingError' :: Text
code = Text
pCode_, $sel:message:RenderingError' :: Text
message = Text
pMessage_}

-- | A unique identifier for a specific class of errors.
renderingError_code :: Lens.Lens' RenderingError Prelude.Text
renderingError_code :: (Text -> f Text) -> RenderingError -> f RenderingError
renderingError_code = (RenderingError -> Text)
-> (RenderingError -> Text -> RenderingError)
-> Lens RenderingError RenderingError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderingError' {Text
code :: Text
$sel:code:RenderingError' :: RenderingError -> Text
code} -> Text
code) (\s :: RenderingError
s@RenderingError' {} Text
a -> RenderingError
s {$sel:code:RenderingError' :: Text
code = Text
a} :: RenderingError)

-- | A human-readable message describing the error.
renderingError_message :: Lens.Lens' RenderingError Prelude.Text
renderingError_message :: (Text -> f Text) -> RenderingError -> f RenderingError
renderingError_message = (RenderingError -> Text)
-> (RenderingError -> Text -> RenderingError)
-> Lens RenderingError RenderingError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenderingError' {Text
message :: Text
$sel:message:RenderingError' :: RenderingError -> Text
message} -> Text
message) (\s :: RenderingError
s@RenderingError' {} Text
a -> RenderingError
s {$sel:message:RenderingError' :: Text
message = Text
a} :: RenderingError)

instance Core.FromJSON RenderingError where
  parseJSON :: Value -> Parser RenderingError
parseJSON =
    String
-> (Object -> Parser RenderingError)
-> Value
-> Parser RenderingError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RenderingError"
      ( \Object
x ->
          Text -> Text -> RenderingError
RenderingError'
            (Text -> Text -> RenderingError)
-> Parser Text -> Parser (Text -> RenderingError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Code") Parser (Text -> RenderingError)
-> Parser Text -> Parser RenderingError
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 RenderingError

instance Prelude.NFData RenderingError