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

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

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

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

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

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

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

instance
  Prelude.NFData
    CustomSMSLambdaVersionConfigType

instance Core.ToJSON CustomSMSLambdaVersionConfigType where
  toJSON :: CustomSMSLambdaVersionConfigType -> Value
toJSON CustomSMSLambdaVersionConfigType' {Text
CustomSMSSenderLambdaVersionType
lambdaArn :: Text
lambdaVersion :: CustomSMSSenderLambdaVersionType
$sel:lambdaArn:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType -> Text
$sel:lambdaVersion:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType
-> CustomSMSSenderLambdaVersionType
..} =
    [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 -> CustomSMSSenderLambdaVersionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CustomSMSSenderLambdaVersionType
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)
          ]
      )