{-# 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.CognitoIdentityProvider.Types.CustomEmailLambdaVersionConfigType
-- 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.CognitoIdentityProvider.Types.CustomEmailLambdaVersionConfigType where

import Amazonka.CognitoIdentityProvider.Types.CustomEmailSenderLambdaVersionType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A custom email sender Lambda configuration type.
--
-- /See:/ 'newCustomEmailLambdaVersionConfigType' smart constructor.
data CustomEmailLambdaVersionConfigType = CustomEmailLambdaVersionConfigType'
  { -- | The Lambda version represents the signature of the \"request\" attribute
    -- in the \"event\" information Amazon Cognito passes to your custom email
    -- Lambda function. The only supported value is @V1_0@.
    CustomEmailLambdaVersionConfigType
-> CustomEmailSenderLambdaVersionType
lambdaVersion :: CustomEmailSenderLambdaVersionType,
    -- | The Lambda Amazon Resource Name of the Lambda function that Amazon
    -- Cognito triggers to send email notifications to users.
    CustomEmailLambdaVersionConfigType -> Text
lambdaArn :: Prelude.Text
  }
  deriving (CustomEmailLambdaVersionConfigType
-> CustomEmailLambdaVersionConfigType -> Bool
(CustomEmailLambdaVersionConfigType
 -> CustomEmailLambdaVersionConfigType -> Bool)
-> (CustomEmailLambdaVersionConfigType
    -> CustomEmailLambdaVersionConfigType -> Bool)
-> Eq CustomEmailLambdaVersionConfigType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomEmailLambdaVersionConfigType
-> CustomEmailLambdaVersionConfigType -> Bool
$c/= :: CustomEmailLambdaVersionConfigType
-> CustomEmailLambdaVersionConfigType -> Bool
== :: CustomEmailLambdaVersionConfigType
-> CustomEmailLambdaVersionConfigType -> Bool
$c== :: CustomEmailLambdaVersionConfigType
-> CustomEmailLambdaVersionConfigType -> Bool
Prelude.Eq, ReadPrec [CustomEmailLambdaVersionConfigType]
ReadPrec CustomEmailLambdaVersionConfigType
Int -> ReadS CustomEmailLambdaVersionConfigType
ReadS [CustomEmailLambdaVersionConfigType]
(Int -> ReadS CustomEmailLambdaVersionConfigType)
-> ReadS [CustomEmailLambdaVersionConfigType]
-> ReadPrec CustomEmailLambdaVersionConfigType
-> ReadPrec [CustomEmailLambdaVersionConfigType]
-> Read CustomEmailLambdaVersionConfigType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomEmailLambdaVersionConfigType]
$creadListPrec :: ReadPrec [CustomEmailLambdaVersionConfigType]
readPrec :: ReadPrec CustomEmailLambdaVersionConfigType
$creadPrec :: ReadPrec CustomEmailLambdaVersionConfigType
readList :: ReadS [CustomEmailLambdaVersionConfigType]
$creadList :: ReadS [CustomEmailLambdaVersionConfigType]
readsPrec :: Int -> ReadS CustomEmailLambdaVersionConfigType
$creadsPrec :: Int -> ReadS CustomEmailLambdaVersionConfigType
Prelude.Read, Int -> CustomEmailLambdaVersionConfigType -> ShowS
[CustomEmailLambdaVersionConfigType] -> ShowS
CustomEmailLambdaVersionConfigType -> String
(Int -> CustomEmailLambdaVersionConfigType -> ShowS)
-> (CustomEmailLambdaVersionConfigType -> String)
-> ([CustomEmailLambdaVersionConfigType] -> ShowS)
-> Show CustomEmailLambdaVersionConfigType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomEmailLambdaVersionConfigType] -> ShowS
$cshowList :: [CustomEmailLambdaVersionConfigType] -> ShowS
show :: CustomEmailLambdaVersionConfigType -> String
$cshow :: CustomEmailLambdaVersionConfigType -> String
showsPrec :: Int -> CustomEmailLambdaVersionConfigType -> ShowS
$cshowsPrec :: Int -> CustomEmailLambdaVersionConfigType -> ShowS
Prelude.Show, (forall x.
 CustomEmailLambdaVersionConfigType
 -> Rep CustomEmailLambdaVersionConfigType x)
-> (forall x.
    Rep CustomEmailLambdaVersionConfigType x
    -> CustomEmailLambdaVersionConfigType)
-> Generic CustomEmailLambdaVersionConfigType
forall x.
Rep CustomEmailLambdaVersionConfigType x
-> CustomEmailLambdaVersionConfigType
forall x.
CustomEmailLambdaVersionConfigType
-> Rep CustomEmailLambdaVersionConfigType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomEmailLambdaVersionConfigType x
-> CustomEmailLambdaVersionConfigType
$cfrom :: forall x.
CustomEmailLambdaVersionConfigType
-> Rep CustomEmailLambdaVersionConfigType x
Prelude.Generic)

-- |
-- Create a value of 'CustomEmailLambdaVersionConfigType' 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:
--
-- 'lambdaVersion', 'customEmailLambdaVersionConfigType_lambdaVersion' - The Lambda version represents the signature of the \"request\" attribute
-- in the \"event\" information Amazon Cognito passes to your custom email
-- Lambda function. The only supported value is @V1_0@.
--
-- 'lambdaArn', 'customEmailLambdaVersionConfigType_lambdaArn' - The Lambda Amazon Resource Name of the Lambda function that Amazon
-- Cognito triggers to send email notifications to users.
newCustomEmailLambdaVersionConfigType ::
  -- | 'lambdaVersion'
  CustomEmailSenderLambdaVersionType ->
  -- | 'lambdaArn'
  Prelude.Text ->
  CustomEmailLambdaVersionConfigType
newCustomEmailLambdaVersionConfigType :: CustomEmailSenderLambdaVersionType
-> Text -> CustomEmailLambdaVersionConfigType
newCustomEmailLambdaVersionConfigType
  CustomEmailSenderLambdaVersionType
pLambdaVersion_
  Text
pLambdaArn_ =
    CustomEmailLambdaVersionConfigType' :: CustomEmailSenderLambdaVersionType
-> Text -> CustomEmailLambdaVersionConfigType
CustomEmailLambdaVersionConfigType'
      { $sel:lambdaVersion:CustomEmailLambdaVersionConfigType' :: CustomEmailSenderLambdaVersionType
lambdaVersion =
          CustomEmailSenderLambdaVersionType
pLambdaVersion_,
        $sel:lambdaArn:CustomEmailLambdaVersionConfigType' :: Text
lambdaArn = Text
pLambdaArn_
      }

-- | The Lambda version represents the signature of the \"request\" attribute
-- in the \"event\" information Amazon Cognito passes to your custom email
-- Lambda function. The only supported value is @V1_0@.
customEmailLambdaVersionConfigType_lambdaVersion :: Lens.Lens' CustomEmailLambdaVersionConfigType CustomEmailSenderLambdaVersionType
customEmailLambdaVersionConfigType_lambdaVersion :: (CustomEmailSenderLambdaVersionType
 -> f CustomEmailSenderLambdaVersionType)
-> CustomEmailLambdaVersionConfigType
-> f CustomEmailLambdaVersionConfigType
customEmailLambdaVersionConfigType_lambdaVersion = (CustomEmailLambdaVersionConfigType
 -> CustomEmailSenderLambdaVersionType)
-> (CustomEmailLambdaVersionConfigType
    -> CustomEmailSenderLambdaVersionType
    -> CustomEmailLambdaVersionConfigType)
-> Lens
     CustomEmailLambdaVersionConfigType
     CustomEmailLambdaVersionConfigType
     CustomEmailSenderLambdaVersionType
     CustomEmailSenderLambdaVersionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomEmailLambdaVersionConfigType' {CustomEmailSenderLambdaVersionType
lambdaVersion :: CustomEmailSenderLambdaVersionType
$sel:lambdaVersion:CustomEmailLambdaVersionConfigType' :: CustomEmailLambdaVersionConfigType
-> CustomEmailSenderLambdaVersionType
lambdaVersion} -> CustomEmailSenderLambdaVersionType
lambdaVersion) (\s :: CustomEmailLambdaVersionConfigType
s@CustomEmailLambdaVersionConfigType' {} CustomEmailSenderLambdaVersionType
a -> CustomEmailLambdaVersionConfigType
s {$sel:lambdaVersion:CustomEmailLambdaVersionConfigType' :: CustomEmailSenderLambdaVersionType
lambdaVersion = CustomEmailSenderLambdaVersionType
a} :: CustomEmailLambdaVersionConfigType)

-- | The Lambda Amazon Resource Name of the Lambda function that Amazon
-- Cognito triggers to send email notifications to users.
customEmailLambdaVersionConfigType_lambdaArn :: Lens.Lens' CustomEmailLambdaVersionConfigType Prelude.Text
customEmailLambdaVersionConfigType_lambdaArn :: (Text -> f Text)
-> CustomEmailLambdaVersionConfigType
-> f CustomEmailLambdaVersionConfigType
customEmailLambdaVersionConfigType_lambdaArn = (CustomEmailLambdaVersionConfigType -> Text)
-> (CustomEmailLambdaVersionConfigType
    -> Text -> CustomEmailLambdaVersionConfigType)
-> Lens
     CustomEmailLambdaVersionConfigType
     CustomEmailLambdaVersionConfigType
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomEmailLambdaVersionConfigType' {Text
lambdaArn :: Text
$sel:lambdaArn:CustomEmailLambdaVersionConfigType' :: CustomEmailLambdaVersionConfigType -> Text
lambdaArn} -> Text
lambdaArn) (\s :: CustomEmailLambdaVersionConfigType
s@CustomEmailLambdaVersionConfigType' {} Text
a -> CustomEmailLambdaVersionConfigType
s {$sel:lambdaArn:CustomEmailLambdaVersionConfigType' :: Text
lambdaArn = Text
a} :: CustomEmailLambdaVersionConfigType)

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

instance
  Prelude.Hashable
    CustomEmailLambdaVersionConfigType

instance
  Prelude.NFData
    CustomEmailLambdaVersionConfigType

instance
  Core.ToJSON
    CustomEmailLambdaVersionConfigType
  where
  toJSON :: CustomEmailLambdaVersionConfigType -> Value
toJSON CustomEmailLambdaVersionConfigType' {Text
CustomEmailSenderLambdaVersionType
lambdaArn :: Text
lambdaVersion :: CustomEmailSenderLambdaVersionType
$sel:lambdaArn:CustomEmailLambdaVersionConfigType' :: CustomEmailLambdaVersionConfigType -> Text
$sel:lambdaVersion:CustomEmailLambdaVersionConfigType' :: CustomEmailLambdaVersionConfigType
-> CustomEmailSenderLambdaVersionType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"LambdaVersion" Text -> CustomEmailSenderLambdaVersionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CustomEmailSenderLambdaVersionType
lambdaVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LambdaArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
lambdaArn)
          ]
      )