{-# 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.Lambda.Types.ImageConfigError
-- 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.Lambda.Types.ImageConfigError where

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

-- | Error response to GetFunctionConfiguration.
--
-- /See:/ 'newImageConfigError' smart constructor.
data ImageConfigError = ImageConfigError'
  { -- | Error code.
    ImageConfigError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | Error message.
    ImageConfigError -> Maybe (Sensitive Text)
message :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (ImageConfigError -> ImageConfigError -> Bool
(ImageConfigError -> ImageConfigError -> Bool)
-> (ImageConfigError -> ImageConfigError -> Bool)
-> Eq ImageConfigError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageConfigError -> ImageConfigError -> Bool
$c/= :: ImageConfigError -> ImageConfigError -> Bool
== :: ImageConfigError -> ImageConfigError -> Bool
$c== :: ImageConfigError -> ImageConfigError -> Bool
Prelude.Eq, Int -> ImageConfigError -> ShowS
[ImageConfigError] -> ShowS
ImageConfigError -> String
(Int -> ImageConfigError -> ShowS)
-> (ImageConfigError -> String)
-> ([ImageConfigError] -> ShowS)
-> Show ImageConfigError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageConfigError] -> ShowS
$cshowList :: [ImageConfigError] -> ShowS
show :: ImageConfigError -> String
$cshow :: ImageConfigError -> String
showsPrec :: Int -> ImageConfigError -> ShowS
$cshowsPrec :: Int -> ImageConfigError -> ShowS
Prelude.Show, (forall x. ImageConfigError -> Rep ImageConfigError x)
-> (forall x. Rep ImageConfigError x -> ImageConfigError)
-> Generic ImageConfigError
forall x. Rep ImageConfigError x -> ImageConfigError
forall x. ImageConfigError -> Rep ImageConfigError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageConfigError x -> ImageConfigError
$cfrom :: forall x. ImageConfigError -> Rep ImageConfigError x
Prelude.Generic)

-- |
-- Create a value of 'ImageConfigError' 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:
--
-- 'errorCode', 'imageConfigError_errorCode' - Error code.
--
-- 'message', 'imageConfigError_message' - Error message.
newImageConfigError ::
  ImageConfigError
newImageConfigError :: ImageConfigError
newImageConfigError =
  ImageConfigError' :: Maybe Text -> Maybe (Sensitive Text) -> ImageConfigError
ImageConfigError'
    { $sel:errorCode:ImageConfigError' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:ImageConfigError' :: Maybe (Sensitive Text)
message = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Error code.
imageConfigError_errorCode :: Lens.Lens' ImageConfigError (Prelude.Maybe Prelude.Text)
imageConfigError_errorCode :: (Maybe Text -> f (Maybe Text))
-> ImageConfigError -> f ImageConfigError
imageConfigError_errorCode = (ImageConfigError -> Maybe Text)
-> (ImageConfigError -> Maybe Text -> ImageConfigError)
-> Lens ImageConfigError ImageConfigError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfigError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:ImageConfigError' :: ImageConfigError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: ImageConfigError
s@ImageConfigError' {} Maybe Text
a -> ImageConfigError
s {$sel:errorCode:ImageConfigError' :: Maybe Text
errorCode = Maybe Text
a} :: ImageConfigError)

-- | Error message.
imageConfigError_message :: Lens.Lens' ImageConfigError (Prelude.Maybe Prelude.Text)
imageConfigError_message :: (Maybe Text -> f (Maybe Text))
-> ImageConfigError -> f ImageConfigError
imageConfigError_message = (ImageConfigError -> Maybe (Sensitive Text))
-> (ImageConfigError -> Maybe (Sensitive Text) -> ImageConfigError)
-> Lens
     ImageConfigError
     ImageConfigError
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfigError' {Maybe (Sensitive Text)
message :: Maybe (Sensitive Text)
$sel:message:ImageConfigError' :: ImageConfigError -> Maybe (Sensitive Text)
message} -> Maybe (Sensitive Text)
message) (\s :: ImageConfigError
s@ImageConfigError' {} Maybe (Sensitive Text)
a -> ImageConfigError
s {$sel:message:ImageConfigError' :: Maybe (Sensitive Text)
message = Maybe (Sensitive Text)
a} :: ImageConfigError) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ImageConfigError -> f ImageConfigError)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ImageConfigError
-> f ImageConfigError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON ImageConfigError where
  parseJSON :: Value -> Parser ImageConfigError
parseJSON =
    String
-> (Object -> Parser ImageConfigError)
-> Value
-> Parser ImageConfigError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageConfigError"
      ( \Object
x ->
          Maybe Text -> Maybe (Sensitive Text) -> ImageConfigError
ImageConfigError'
            (Maybe Text -> Maybe (Sensitive Text) -> ImageConfigError)
-> Parser (Maybe Text)
-> Parser (Maybe (Sensitive Text) -> ImageConfigError)
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
"ErrorCode")
            Parser (Maybe (Sensitive Text) -> ImageConfigError)
-> Parser (Maybe (Sensitive Text)) -> Parser ImageConfigError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Message")
      )

instance Prelude.Hashable ImageConfigError

instance Prelude.NFData ImageConfigError