{-# 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.ImageConfigResponse
-- 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.ImageConfigResponse where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types.ImageConfig
import Amazonka.Lambda.Types.ImageConfigError
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Response to GetFunctionConfiguration request.
--
-- /See:/ 'newImageConfigResponse' smart constructor.
data ImageConfigResponse = ImageConfigResponse'
  { -- | Configuration values that override the container image Dockerfile.
    ImageConfigResponse -> Maybe ImageConfig
imageConfig :: Prelude.Maybe ImageConfig,
    -- | Error response to GetFunctionConfiguration.
    ImageConfigResponse -> Maybe ImageConfigError
error :: Prelude.Maybe ImageConfigError
  }
  deriving (ImageConfigResponse -> ImageConfigResponse -> Bool
(ImageConfigResponse -> ImageConfigResponse -> Bool)
-> (ImageConfigResponse -> ImageConfigResponse -> Bool)
-> Eq ImageConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageConfigResponse -> ImageConfigResponse -> Bool
$c/= :: ImageConfigResponse -> ImageConfigResponse -> Bool
== :: ImageConfigResponse -> ImageConfigResponse -> Bool
$c== :: ImageConfigResponse -> ImageConfigResponse -> Bool
Prelude.Eq, Int -> ImageConfigResponse -> ShowS
[ImageConfigResponse] -> ShowS
ImageConfigResponse -> String
(Int -> ImageConfigResponse -> ShowS)
-> (ImageConfigResponse -> String)
-> ([ImageConfigResponse] -> ShowS)
-> Show ImageConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageConfigResponse] -> ShowS
$cshowList :: [ImageConfigResponse] -> ShowS
show :: ImageConfigResponse -> String
$cshow :: ImageConfigResponse -> String
showsPrec :: Int -> ImageConfigResponse -> ShowS
$cshowsPrec :: Int -> ImageConfigResponse -> ShowS
Prelude.Show, (forall x. ImageConfigResponse -> Rep ImageConfigResponse x)
-> (forall x. Rep ImageConfigResponse x -> ImageConfigResponse)
-> Generic ImageConfigResponse
forall x. Rep ImageConfigResponse x -> ImageConfigResponse
forall x. ImageConfigResponse -> Rep ImageConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageConfigResponse x -> ImageConfigResponse
$cfrom :: forall x. ImageConfigResponse -> Rep ImageConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'ImageConfigResponse' 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:
--
-- 'imageConfig', 'imageConfigResponse_imageConfig' - Configuration values that override the container image Dockerfile.
--
-- 'error', 'imageConfigResponse_error' - Error response to GetFunctionConfiguration.
newImageConfigResponse ::
  ImageConfigResponse
newImageConfigResponse :: ImageConfigResponse
newImageConfigResponse =
  ImageConfigResponse' :: Maybe ImageConfig -> Maybe ImageConfigError -> ImageConfigResponse
ImageConfigResponse'
    { $sel:imageConfig:ImageConfigResponse' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:error:ImageConfigResponse' :: Maybe ImageConfigError
error = Maybe ImageConfigError
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration values that override the container image Dockerfile.
imageConfigResponse_imageConfig :: Lens.Lens' ImageConfigResponse (Prelude.Maybe ImageConfig)
imageConfigResponse_imageConfig :: (Maybe ImageConfig -> f (Maybe ImageConfig))
-> ImageConfigResponse -> f ImageConfigResponse
imageConfigResponse_imageConfig = (ImageConfigResponse -> Maybe ImageConfig)
-> (ImageConfigResponse
    -> Maybe ImageConfig -> ImageConfigResponse)
-> Lens
     ImageConfigResponse
     ImageConfigResponse
     (Maybe ImageConfig)
     (Maybe ImageConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfigResponse' {Maybe ImageConfig
imageConfig :: Maybe ImageConfig
$sel:imageConfig:ImageConfigResponse' :: ImageConfigResponse -> Maybe ImageConfig
imageConfig} -> Maybe ImageConfig
imageConfig) (\s :: ImageConfigResponse
s@ImageConfigResponse' {} Maybe ImageConfig
a -> ImageConfigResponse
s {$sel:imageConfig:ImageConfigResponse' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
a} :: ImageConfigResponse)

-- | Error response to GetFunctionConfiguration.
imageConfigResponse_error :: Lens.Lens' ImageConfigResponse (Prelude.Maybe ImageConfigError)
imageConfigResponse_error :: (Maybe ImageConfigError -> f (Maybe ImageConfigError))
-> ImageConfigResponse -> f ImageConfigResponse
imageConfigResponse_error = (ImageConfigResponse -> Maybe ImageConfigError)
-> (ImageConfigResponse
    -> Maybe ImageConfigError -> ImageConfigResponse)
-> Lens
     ImageConfigResponse
     ImageConfigResponse
     (Maybe ImageConfigError)
     (Maybe ImageConfigError)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfigResponse' {Maybe ImageConfigError
error :: Maybe ImageConfigError
$sel:error:ImageConfigResponse' :: ImageConfigResponse -> Maybe ImageConfigError
error} -> Maybe ImageConfigError
error) (\s :: ImageConfigResponse
s@ImageConfigResponse' {} Maybe ImageConfigError
a -> ImageConfigResponse
s {$sel:error:ImageConfigResponse' :: Maybe ImageConfigError
error = Maybe ImageConfigError
a} :: ImageConfigResponse)

instance Core.FromJSON ImageConfigResponse where
  parseJSON :: Value -> Parser ImageConfigResponse
parseJSON =
    String
-> (Object -> Parser ImageConfigResponse)
-> Value
-> Parser ImageConfigResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageConfigResponse"
      ( \Object
x ->
          Maybe ImageConfig -> Maybe ImageConfigError -> ImageConfigResponse
ImageConfigResponse'
            (Maybe ImageConfig
 -> Maybe ImageConfigError -> ImageConfigResponse)
-> Parser (Maybe ImageConfig)
-> Parser (Maybe ImageConfigError -> ImageConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ImageConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ImageConfig")
            Parser (Maybe ImageConfigError -> ImageConfigResponse)
-> Parser (Maybe ImageConfigError) -> Parser ImageConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ImageConfigError)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Error")
      )

instance Prelude.Hashable ImageConfigResponse

instance Prelude.NFData ImageConfigResponse