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