{-# 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.PasswordPolicyType where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PasswordPolicyType = PasswordPolicyType'
{
PasswordPolicyType -> Maybe Bool
requireNumbers :: Prelude.Maybe Prelude.Bool,
PasswordPolicyType -> Maybe Bool
requireUppercase :: Prelude.Maybe Prelude.Bool,
PasswordPolicyType -> Maybe Bool
requireLowercase :: Prelude.Maybe Prelude.Bool,
PasswordPolicyType -> Maybe Natural
minimumLength :: Prelude.Maybe Prelude.Natural,
PasswordPolicyType -> Maybe Bool
requireSymbols :: Prelude.Maybe Prelude.Bool,
PasswordPolicyType -> Maybe Natural
temporaryPasswordValidityDays :: Prelude.Maybe Prelude.Natural
}
deriving (PasswordPolicyType -> PasswordPolicyType -> Bool
(PasswordPolicyType -> PasswordPolicyType -> Bool)
-> (PasswordPolicyType -> PasswordPolicyType -> Bool)
-> Eq PasswordPolicyType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PasswordPolicyType -> PasswordPolicyType -> Bool
$c/= :: PasswordPolicyType -> PasswordPolicyType -> Bool
== :: PasswordPolicyType -> PasswordPolicyType -> Bool
$c== :: PasswordPolicyType -> PasswordPolicyType -> Bool
Prelude.Eq, ReadPrec [PasswordPolicyType]
ReadPrec PasswordPolicyType
Int -> ReadS PasswordPolicyType
ReadS [PasswordPolicyType]
(Int -> ReadS PasswordPolicyType)
-> ReadS [PasswordPolicyType]
-> ReadPrec PasswordPolicyType
-> ReadPrec [PasswordPolicyType]
-> Read PasswordPolicyType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PasswordPolicyType]
$creadListPrec :: ReadPrec [PasswordPolicyType]
readPrec :: ReadPrec PasswordPolicyType
$creadPrec :: ReadPrec PasswordPolicyType
readList :: ReadS [PasswordPolicyType]
$creadList :: ReadS [PasswordPolicyType]
readsPrec :: Int -> ReadS PasswordPolicyType
$creadsPrec :: Int -> ReadS PasswordPolicyType
Prelude.Read, Int -> PasswordPolicyType -> ShowS
[PasswordPolicyType] -> ShowS
PasswordPolicyType -> String
(Int -> PasswordPolicyType -> ShowS)
-> (PasswordPolicyType -> String)
-> ([PasswordPolicyType] -> ShowS)
-> Show PasswordPolicyType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PasswordPolicyType] -> ShowS
$cshowList :: [PasswordPolicyType] -> ShowS
show :: PasswordPolicyType -> String
$cshow :: PasswordPolicyType -> String
showsPrec :: Int -> PasswordPolicyType -> ShowS
$cshowsPrec :: Int -> PasswordPolicyType -> ShowS
Prelude.Show, (forall x. PasswordPolicyType -> Rep PasswordPolicyType x)
-> (forall x. Rep PasswordPolicyType x -> PasswordPolicyType)
-> Generic PasswordPolicyType
forall x. Rep PasswordPolicyType x -> PasswordPolicyType
forall x. PasswordPolicyType -> Rep PasswordPolicyType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PasswordPolicyType x -> PasswordPolicyType
$cfrom :: forall x. PasswordPolicyType -> Rep PasswordPolicyType x
Prelude.Generic)
newPasswordPolicyType ::
PasswordPolicyType
newPasswordPolicyType :: PasswordPolicyType
newPasswordPolicyType =
PasswordPolicyType' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType
PasswordPolicyType'
{ $sel:requireNumbers:PasswordPolicyType' :: Maybe Bool
requireNumbers =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:requireUppercase:PasswordPolicyType' :: Maybe Bool
requireUppercase = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:requireLowercase:PasswordPolicyType' :: Maybe Bool
requireLowercase = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:minimumLength:PasswordPolicyType' :: Maybe Natural
minimumLength = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:requireSymbols:PasswordPolicyType' :: Maybe Bool
requireSymbols = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:temporaryPasswordValidityDays:PasswordPolicyType' :: Maybe Natural
temporaryPasswordValidityDays = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
passwordPolicyType_requireNumbers :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Bool)
passwordPolicyType_requireNumbers :: (Maybe Bool -> f (Maybe Bool))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_requireNumbers = (PasswordPolicyType -> Maybe Bool)
-> (PasswordPolicyType -> Maybe Bool -> PasswordPolicyType)
-> Lens
PasswordPolicyType PasswordPolicyType (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Bool
requireNumbers :: Maybe Bool
$sel:requireNumbers:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
requireNumbers} -> Maybe Bool
requireNumbers) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Bool
a -> PasswordPolicyType
s {$sel:requireNumbers:PasswordPolicyType' :: Maybe Bool
requireNumbers = Maybe Bool
a} :: PasswordPolicyType)
passwordPolicyType_requireUppercase :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Bool)
passwordPolicyType_requireUppercase :: (Maybe Bool -> f (Maybe Bool))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_requireUppercase = (PasswordPolicyType -> Maybe Bool)
-> (PasswordPolicyType -> Maybe Bool -> PasswordPolicyType)
-> Lens
PasswordPolicyType PasswordPolicyType (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Bool
requireUppercase :: Maybe Bool
$sel:requireUppercase:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
requireUppercase} -> Maybe Bool
requireUppercase) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Bool
a -> PasswordPolicyType
s {$sel:requireUppercase:PasswordPolicyType' :: Maybe Bool
requireUppercase = Maybe Bool
a} :: PasswordPolicyType)
passwordPolicyType_requireLowercase :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Bool)
passwordPolicyType_requireLowercase :: (Maybe Bool -> f (Maybe Bool))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_requireLowercase = (PasswordPolicyType -> Maybe Bool)
-> (PasswordPolicyType -> Maybe Bool -> PasswordPolicyType)
-> Lens
PasswordPolicyType PasswordPolicyType (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Bool
requireLowercase :: Maybe Bool
$sel:requireLowercase:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
requireLowercase} -> Maybe Bool
requireLowercase) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Bool
a -> PasswordPolicyType
s {$sel:requireLowercase:PasswordPolicyType' :: Maybe Bool
requireLowercase = Maybe Bool
a} :: PasswordPolicyType)
passwordPolicyType_minimumLength :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Natural)
passwordPolicyType_minimumLength :: (Maybe Natural -> f (Maybe Natural))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_minimumLength = (PasswordPolicyType -> Maybe Natural)
-> (PasswordPolicyType -> Maybe Natural -> PasswordPolicyType)
-> Lens
PasswordPolicyType
PasswordPolicyType
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Natural
minimumLength :: Maybe Natural
$sel:minimumLength:PasswordPolicyType' :: PasswordPolicyType -> Maybe Natural
minimumLength} -> Maybe Natural
minimumLength) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Natural
a -> PasswordPolicyType
s {$sel:minimumLength:PasswordPolicyType' :: Maybe Natural
minimumLength = Maybe Natural
a} :: PasswordPolicyType)
passwordPolicyType_requireSymbols :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Bool)
passwordPolicyType_requireSymbols :: (Maybe Bool -> f (Maybe Bool))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_requireSymbols = (PasswordPolicyType -> Maybe Bool)
-> (PasswordPolicyType -> Maybe Bool -> PasswordPolicyType)
-> Lens
PasswordPolicyType PasswordPolicyType (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Bool
requireSymbols :: Maybe Bool
$sel:requireSymbols:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
requireSymbols} -> Maybe Bool
requireSymbols) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Bool
a -> PasswordPolicyType
s {$sel:requireSymbols:PasswordPolicyType' :: Maybe Bool
requireSymbols = Maybe Bool
a} :: PasswordPolicyType)
passwordPolicyType_temporaryPasswordValidityDays :: Lens.Lens' PasswordPolicyType (Prelude.Maybe Prelude.Natural)
passwordPolicyType_temporaryPasswordValidityDays :: (Maybe Natural -> f (Maybe Natural))
-> PasswordPolicyType -> f PasswordPolicyType
passwordPolicyType_temporaryPasswordValidityDays = (PasswordPolicyType -> Maybe Natural)
-> (PasswordPolicyType -> Maybe Natural -> PasswordPolicyType)
-> Lens
PasswordPolicyType
PasswordPolicyType
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PasswordPolicyType' {Maybe Natural
temporaryPasswordValidityDays :: Maybe Natural
$sel:temporaryPasswordValidityDays:PasswordPolicyType' :: PasswordPolicyType -> Maybe Natural
temporaryPasswordValidityDays} -> Maybe Natural
temporaryPasswordValidityDays) (\s :: PasswordPolicyType
s@PasswordPolicyType' {} Maybe Natural
a -> PasswordPolicyType
s {$sel:temporaryPasswordValidityDays:PasswordPolicyType' :: Maybe Natural
temporaryPasswordValidityDays = Maybe Natural
a} :: PasswordPolicyType)
instance Core.FromJSON PasswordPolicyType where
parseJSON :: Value -> Parser PasswordPolicyType
parseJSON =
String
-> (Object -> Parser PasswordPolicyType)
-> Value
-> Parser PasswordPolicyType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PasswordPolicyType"
( \Object
x ->
Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType
PasswordPolicyType'
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequireNumbers")
Parser
(Maybe Bool
-> Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType)
-> Parser (Maybe Bool)
-> Parser
(Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequireUppercase")
Parser
(Maybe Bool
-> Maybe Natural
-> Maybe Bool
-> Maybe Natural
-> PasswordPolicyType)
-> Parser (Maybe Bool)
-> Parser
(Maybe Natural
-> Maybe Bool -> Maybe Natural -> PasswordPolicyType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequireLowercase")
Parser
(Maybe Natural
-> Maybe Bool -> Maybe Natural -> PasswordPolicyType)
-> Parser (Maybe Natural)
-> Parser (Maybe Bool -> Maybe Natural -> PasswordPolicyType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MinimumLength")
Parser (Maybe Bool -> Maybe Natural -> PasswordPolicyType)
-> Parser (Maybe Bool)
-> Parser (Maybe Natural -> PasswordPolicyType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequireSymbols")
Parser (Maybe Natural -> PasswordPolicyType)
-> Parser (Maybe Natural) -> Parser PasswordPolicyType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TemporaryPasswordValidityDays")
)
instance Prelude.Hashable PasswordPolicyType
instance Prelude.NFData PasswordPolicyType
instance Core.ToJSON PasswordPolicyType where
toJSON :: PasswordPolicyType -> Value
toJSON PasswordPolicyType' {Maybe Bool
Maybe Natural
temporaryPasswordValidityDays :: Maybe Natural
requireSymbols :: Maybe Bool
minimumLength :: Maybe Natural
requireLowercase :: Maybe Bool
requireUppercase :: Maybe Bool
requireNumbers :: Maybe Bool
$sel:temporaryPasswordValidityDays:PasswordPolicyType' :: PasswordPolicyType -> Maybe Natural
$sel:requireSymbols:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
$sel:minimumLength:PasswordPolicyType' :: PasswordPolicyType -> Maybe Natural
$sel:requireLowercase:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
$sel:requireUppercase:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
$sel:requireNumbers:PasswordPolicyType' :: PasswordPolicyType -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RequireNumbers" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requireNumbers,
(Text
"RequireUppercase" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requireUppercase,
(Text
"RequireLowercase" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requireLowercase,
(Text
"MinimumLength" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minimumLength,
(Text
"RequireSymbols" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requireSymbols,
(Text
"TemporaryPasswordValidityDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
temporaryPasswordValidityDays
]
)