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