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