{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A custom SMS sender Lambda configuration type.
--
-- /See:/ 'newCustomSMSLambdaVersionConfigType' smart constructor.
data CustomSMSLambdaVersionConfigType = CustomSMSLambdaVersionConfigType'
  { -- | Signature of the \"request\" attribute in the \"event\" information that
    -- Amazon Cognito passes to your custom SMS Lambda function. The only
    -- supported value is @V1_0@.
    CustomSMSLambdaVersionConfigType
-> CustomSMSSenderLambdaVersionType
lambdaVersion :: CustomSMSSenderLambdaVersionType,
    -- | The Amazon Resource Name (ARN) of the Lambda function that Amazon
    -- Cognito activates to send SMS notifications to users.
    CustomSMSLambdaVersionConfigType -> Text
lambdaArn :: Prelude.Text
  }
  deriving (CustomSMSLambdaVersionConfigType
-> CustomSMSLambdaVersionConfigType -> Bool
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]
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
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.
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' - Signature of the \"request\" attribute in the \"event\" information that
-- Amazon Cognito passes to your custom SMS Lambda function. The only
-- supported value is @V1_0@.
--
-- 'lambdaArn', 'customSMSLambdaVersionConfigType_lambdaArn' - The Amazon Resource Name (ARN) of the Lambda function that Amazon
-- Cognito activates to send SMS notifications to users.
newCustomSMSLambdaVersionConfigType ::
  -- | 'lambdaVersion'
  CustomSMSSenderLambdaVersionType ->
  -- | 'lambdaArn'
  Prelude.Text ->
  CustomSMSLambdaVersionConfigType
newCustomSMSLambdaVersionConfigType :: CustomSMSSenderLambdaVersionType
-> Text -> CustomSMSLambdaVersionConfigType
newCustomSMSLambdaVersionConfigType
  CustomSMSSenderLambdaVersionType
pLambdaVersion_
  Text
pLambdaArn_ =
    CustomSMSLambdaVersionConfigType'
      { $sel:lambdaVersion:CustomSMSLambdaVersionConfigType' :: CustomSMSSenderLambdaVersionType
lambdaVersion =
          CustomSMSSenderLambdaVersionType
pLambdaVersion_,
        $sel:lambdaArn:CustomSMSLambdaVersionConfigType' :: Text
lambdaArn = Text
pLambdaArn_
      }

-- | Signature of the \"request\" attribute in the \"event\" information that
-- Amazon Cognito passes to your custom SMS Lambda function. The only
-- supported value is @V1_0@.
customSMSLambdaVersionConfigType_lambdaVersion :: Lens.Lens' CustomSMSLambdaVersionConfigType CustomSMSSenderLambdaVersionType
customSMSLambdaVersionConfigType_lambdaVersion :: Lens'
  CustomSMSLambdaVersionConfigType CustomSMSSenderLambdaVersionType
customSMSLambdaVersionConfigType_lambdaVersion = 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 Amazon Resource Name (ARN) of the Lambda function that Amazon
-- Cognito activates to send SMS notifications to users.
customSMSLambdaVersionConfigType_lambdaArn :: Lens.Lens' CustomSMSLambdaVersionConfigType Prelude.Text
customSMSLambdaVersionConfigType_lambdaArn :: Lens' CustomSMSLambdaVersionConfigType Text
customSMSLambdaVersionConfigType_lambdaArn = 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
  Data.FromJSON
    CustomSMSLambdaVersionConfigType
  where
  parseJSON :: Value -> Parser CustomSMSLambdaVersionConfigType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomSMSLambdaVersionConfigType"
      ( \Object
x ->
          CustomSMSSenderLambdaVersionType
-> Text -> CustomSMSLambdaVersionConfigType
CustomSMSLambdaVersionConfigType'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LambdaVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LambdaArn")
      )

instance
  Prelude.Hashable
    CustomSMSLambdaVersionConfigType
  where
  hashWithSalt :: Int -> CustomSMSLambdaVersionConfigType -> Int
hashWithSalt
    Int
_salt
    CustomSMSLambdaVersionConfigType' {Text
CustomSMSSenderLambdaVersionType
lambdaArn :: Text
lambdaVersion :: CustomSMSSenderLambdaVersionType
$sel:lambdaArn:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType -> Text
$sel:lambdaVersion:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType
-> CustomSMSSenderLambdaVersionType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CustomSMSSenderLambdaVersionType
lambdaVersion
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
lambdaArn

instance
  Prelude.NFData
    CustomSMSLambdaVersionConfigType
  where
  rnf :: CustomSMSLambdaVersionConfigType -> ()
rnf CustomSMSLambdaVersionConfigType' {Text
CustomSMSSenderLambdaVersionType
lambdaArn :: Text
lambdaVersion :: CustomSMSSenderLambdaVersionType
$sel:lambdaArn:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType -> Text
$sel:lambdaVersion:CustomSMSLambdaVersionConfigType' :: CustomSMSLambdaVersionConfigType
-> CustomSMSSenderLambdaVersionType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf CustomSMSSenderLambdaVersionType
lambdaVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
lambdaArn

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"LambdaVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CustomSMSSenderLambdaVersionType
lambdaVersion),
            forall a. a -> Maybe a
Prelude.Just (Key
"LambdaArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
lambdaArn)
          ]
      )