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