{-# 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 #-}
module Amazonka.AmplifyBackend.Types.CreateBackendAuthForgotPasswordConfig where
import Amazonka.AmplifyBackend.Types.DeliveryMethod
import Amazonka.AmplifyBackend.Types.EmailSettings
import Amazonka.AmplifyBackend.Types.SmsSettings
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CreateBackendAuthForgotPasswordConfig = CreateBackendAuthForgotPasswordConfig'
{
CreateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
emailSettings :: Prelude.Maybe EmailSettings,
CreateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
smsSettings :: Prelude.Maybe SmsSettings,
CreateBackendAuthForgotPasswordConfig -> DeliveryMethod
deliveryMethod :: DeliveryMethod
}
deriving (CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool
(CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool)
-> (CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool)
-> Eq CreateBackendAuthForgotPasswordConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool
$c/= :: CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool
== :: CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool
$c== :: CreateBackendAuthForgotPasswordConfig
-> CreateBackendAuthForgotPasswordConfig -> Bool
Prelude.Eq, ReadPrec [CreateBackendAuthForgotPasswordConfig]
ReadPrec CreateBackendAuthForgotPasswordConfig
Int -> ReadS CreateBackendAuthForgotPasswordConfig
ReadS [CreateBackendAuthForgotPasswordConfig]
(Int -> ReadS CreateBackendAuthForgotPasswordConfig)
-> ReadS [CreateBackendAuthForgotPasswordConfig]
-> ReadPrec CreateBackendAuthForgotPasswordConfig
-> ReadPrec [CreateBackendAuthForgotPasswordConfig]
-> Read CreateBackendAuthForgotPasswordConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendAuthForgotPasswordConfig]
$creadListPrec :: ReadPrec [CreateBackendAuthForgotPasswordConfig]
readPrec :: ReadPrec CreateBackendAuthForgotPasswordConfig
$creadPrec :: ReadPrec CreateBackendAuthForgotPasswordConfig
readList :: ReadS [CreateBackendAuthForgotPasswordConfig]
$creadList :: ReadS [CreateBackendAuthForgotPasswordConfig]
readsPrec :: Int -> ReadS CreateBackendAuthForgotPasswordConfig
$creadsPrec :: Int -> ReadS CreateBackendAuthForgotPasswordConfig
Prelude.Read, Int -> CreateBackendAuthForgotPasswordConfig -> ShowS
[CreateBackendAuthForgotPasswordConfig] -> ShowS
CreateBackendAuthForgotPasswordConfig -> String
(Int -> CreateBackendAuthForgotPasswordConfig -> ShowS)
-> (CreateBackendAuthForgotPasswordConfig -> String)
-> ([CreateBackendAuthForgotPasswordConfig] -> ShowS)
-> Show CreateBackendAuthForgotPasswordConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendAuthForgotPasswordConfig] -> ShowS
$cshowList :: [CreateBackendAuthForgotPasswordConfig] -> ShowS
show :: CreateBackendAuthForgotPasswordConfig -> String
$cshow :: CreateBackendAuthForgotPasswordConfig -> String
showsPrec :: Int -> CreateBackendAuthForgotPasswordConfig -> ShowS
$cshowsPrec :: Int -> CreateBackendAuthForgotPasswordConfig -> ShowS
Prelude.Show, (forall x.
CreateBackendAuthForgotPasswordConfig
-> Rep CreateBackendAuthForgotPasswordConfig x)
-> (forall x.
Rep CreateBackendAuthForgotPasswordConfig x
-> CreateBackendAuthForgotPasswordConfig)
-> Generic CreateBackendAuthForgotPasswordConfig
forall x.
Rep CreateBackendAuthForgotPasswordConfig x
-> CreateBackendAuthForgotPasswordConfig
forall x.
CreateBackendAuthForgotPasswordConfig
-> Rep CreateBackendAuthForgotPasswordConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendAuthForgotPasswordConfig x
-> CreateBackendAuthForgotPasswordConfig
$cfrom :: forall x.
CreateBackendAuthForgotPasswordConfig
-> Rep CreateBackendAuthForgotPasswordConfig x
Prelude.Generic)
newCreateBackendAuthForgotPasswordConfig ::
DeliveryMethod ->
CreateBackendAuthForgotPasswordConfig
newCreateBackendAuthForgotPasswordConfig :: DeliveryMethod -> CreateBackendAuthForgotPasswordConfig
newCreateBackendAuthForgotPasswordConfig
DeliveryMethod
pDeliveryMethod_ =
CreateBackendAuthForgotPasswordConfig' :: Maybe EmailSettings
-> Maybe SmsSettings
-> DeliveryMethod
-> CreateBackendAuthForgotPasswordConfig
CreateBackendAuthForgotPasswordConfig'
{ $sel:emailSettings:CreateBackendAuthForgotPasswordConfig' :: Maybe EmailSettings
emailSettings =
Maybe EmailSettings
forall a. Maybe a
Prelude.Nothing,
$sel:smsSettings:CreateBackendAuthForgotPasswordConfig' :: Maybe SmsSettings
smsSettings = Maybe SmsSettings
forall a. Maybe a
Prelude.Nothing,
$sel:deliveryMethod:CreateBackendAuthForgotPasswordConfig' :: DeliveryMethod
deliveryMethod = DeliveryMethod
pDeliveryMethod_
}
createBackendAuthForgotPasswordConfig_emailSettings :: Lens.Lens' CreateBackendAuthForgotPasswordConfig (Prelude.Maybe EmailSettings)
createBackendAuthForgotPasswordConfig_emailSettings :: (Maybe EmailSettings -> f (Maybe EmailSettings))
-> CreateBackendAuthForgotPasswordConfig
-> f CreateBackendAuthForgotPasswordConfig
createBackendAuthForgotPasswordConfig_emailSettings = (CreateBackendAuthForgotPasswordConfig -> Maybe EmailSettings)
-> (CreateBackendAuthForgotPasswordConfig
-> Maybe EmailSettings -> CreateBackendAuthForgotPasswordConfig)
-> Lens
CreateBackendAuthForgotPasswordConfig
CreateBackendAuthForgotPasswordConfig
(Maybe EmailSettings)
(Maybe EmailSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthForgotPasswordConfig' {Maybe EmailSettings
emailSettings :: Maybe EmailSettings
$sel:emailSettings:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
emailSettings} -> Maybe EmailSettings
emailSettings) (\s :: CreateBackendAuthForgotPasswordConfig
s@CreateBackendAuthForgotPasswordConfig' {} Maybe EmailSettings
a -> CreateBackendAuthForgotPasswordConfig
s {$sel:emailSettings:CreateBackendAuthForgotPasswordConfig' :: Maybe EmailSettings
emailSettings = Maybe EmailSettings
a} :: CreateBackendAuthForgotPasswordConfig)
createBackendAuthForgotPasswordConfig_smsSettings :: Lens.Lens' CreateBackendAuthForgotPasswordConfig (Prelude.Maybe SmsSettings)
createBackendAuthForgotPasswordConfig_smsSettings :: (Maybe SmsSettings -> f (Maybe SmsSettings))
-> CreateBackendAuthForgotPasswordConfig
-> f CreateBackendAuthForgotPasswordConfig
createBackendAuthForgotPasswordConfig_smsSettings = (CreateBackendAuthForgotPasswordConfig -> Maybe SmsSettings)
-> (CreateBackendAuthForgotPasswordConfig
-> Maybe SmsSettings -> CreateBackendAuthForgotPasswordConfig)
-> Lens
CreateBackendAuthForgotPasswordConfig
CreateBackendAuthForgotPasswordConfig
(Maybe SmsSettings)
(Maybe SmsSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthForgotPasswordConfig' {Maybe SmsSettings
smsSettings :: Maybe SmsSettings
$sel:smsSettings:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
smsSettings} -> Maybe SmsSettings
smsSettings) (\s :: CreateBackendAuthForgotPasswordConfig
s@CreateBackendAuthForgotPasswordConfig' {} Maybe SmsSettings
a -> CreateBackendAuthForgotPasswordConfig
s {$sel:smsSettings:CreateBackendAuthForgotPasswordConfig' :: Maybe SmsSettings
smsSettings = Maybe SmsSettings
a} :: CreateBackendAuthForgotPasswordConfig)
createBackendAuthForgotPasswordConfig_deliveryMethod :: Lens.Lens' CreateBackendAuthForgotPasswordConfig DeliveryMethod
createBackendAuthForgotPasswordConfig_deliveryMethod :: (DeliveryMethod -> f DeliveryMethod)
-> CreateBackendAuthForgotPasswordConfig
-> f CreateBackendAuthForgotPasswordConfig
createBackendAuthForgotPasswordConfig_deliveryMethod = (CreateBackendAuthForgotPasswordConfig -> DeliveryMethod)
-> (CreateBackendAuthForgotPasswordConfig
-> DeliveryMethod -> CreateBackendAuthForgotPasswordConfig)
-> Lens
CreateBackendAuthForgotPasswordConfig
CreateBackendAuthForgotPasswordConfig
DeliveryMethod
DeliveryMethod
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthForgotPasswordConfig' {DeliveryMethod
deliveryMethod :: DeliveryMethod
$sel:deliveryMethod:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> DeliveryMethod
deliveryMethod} -> DeliveryMethod
deliveryMethod) (\s :: CreateBackendAuthForgotPasswordConfig
s@CreateBackendAuthForgotPasswordConfig' {} DeliveryMethod
a -> CreateBackendAuthForgotPasswordConfig
s {$sel:deliveryMethod:CreateBackendAuthForgotPasswordConfig' :: DeliveryMethod
deliveryMethod = DeliveryMethod
a} :: CreateBackendAuthForgotPasswordConfig)
instance
Core.FromJSON
CreateBackendAuthForgotPasswordConfig
where
parseJSON :: Value -> Parser CreateBackendAuthForgotPasswordConfig
parseJSON =
String
-> (Object -> Parser CreateBackendAuthForgotPasswordConfig)
-> Value
-> Parser CreateBackendAuthForgotPasswordConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CreateBackendAuthForgotPasswordConfig"
( \Object
x ->
Maybe EmailSettings
-> Maybe SmsSettings
-> DeliveryMethod
-> CreateBackendAuthForgotPasswordConfig
CreateBackendAuthForgotPasswordConfig'
(Maybe EmailSettings
-> Maybe SmsSettings
-> DeliveryMethod
-> CreateBackendAuthForgotPasswordConfig)
-> Parser (Maybe EmailSettings)
-> Parser
(Maybe SmsSettings
-> DeliveryMethod -> CreateBackendAuthForgotPasswordConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EmailSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"emailSettings")
Parser
(Maybe SmsSettings
-> DeliveryMethod -> CreateBackendAuthForgotPasswordConfig)
-> Parser (Maybe SmsSettings)
-> Parser (DeliveryMethod -> CreateBackendAuthForgotPasswordConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SmsSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"smsSettings")
Parser (DeliveryMethod -> CreateBackendAuthForgotPasswordConfig)
-> Parser DeliveryMethod
-> Parser CreateBackendAuthForgotPasswordConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DeliveryMethod
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"deliveryMethod")
)
instance
Prelude.Hashable
CreateBackendAuthForgotPasswordConfig
instance
Prelude.NFData
CreateBackendAuthForgotPasswordConfig
instance
Core.ToJSON
CreateBackendAuthForgotPasswordConfig
where
toJSON :: CreateBackendAuthForgotPasswordConfig -> Value
toJSON CreateBackendAuthForgotPasswordConfig' {Maybe EmailSettings
Maybe SmsSettings
DeliveryMethod
deliveryMethod :: DeliveryMethod
smsSettings :: Maybe SmsSettings
emailSettings :: Maybe EmailSettings
$sel:deliveryMethod:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> DeliveryMethod
$sel:smsSettings:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> Maybe SmsSettings
$sel:emailSettings:CreateBackendAuthForgotPasswordConfig' :: CreateBackendAuthForgotPasswordConfig -> Maybe EmailSettings
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"emailSettings" Text -> EmailSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EmailSettings -> Pair) -> Maybe EmailSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EmailSettings
emailSettings,
(Text
"smsSettings" Text -> SmsSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SmsSettings -> Pair) -> Maybe SmsSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SmsSettings
smsSettings,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"deliveryMethod" Text -> DeliveryMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeliveryMethod
deliveryMethod)
]
)