{-# 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.UserType where
import Amazonka.CognitoIdentityProvider.Types.AttributeType
import Amazonka.CognitoIdentityProvider.Types.MFAOptionType
import Amazonka.CognitoIdentityProvider.Types.UserStatusType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UserType = UserType'
{
UserType -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
UserType -> Maybe UserStatusType
userStatus :: Prelude.Maybe UserStatusType,
UserType -> Maybe (Sensitive Text)
username :: Prelude.Maybe (Core.Sensitive Prelude.Text),
UserType -> Maybe POSIX
userCreateDate :: Prelude.Maybe Core.POSIX,
UserType -> Maybe [AttributeType]
attributes :: Prelude.Maybe [AttributeType],
UserType -> Maybe [MFAOptionType]
mfaOptions :: Prelude.Maybe [MFAOptionType],
UserType -> Maybe POSIX
userLastModifiedDate :: Prelude.Maybe Core.POSIX
}
deriving (UserType -> UserType -> Bool
(UserType -> UserType -> Bool)
-> (UserType -> UserType -> Bool) -> Eq UserType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserType -> UserType -> Bool
$c/= :: UserType -> UserType -> Bool
== :: UserType -> UserType -> Bool
$c== :: UserType -> UserType -> Bool
Prelude.Eq, Int -> UserType -> ShowS
[UserType] -> ShowS
UserType -> String
(Int -> UserType -> ShowS)
-> (UserType -> String) -> ([UserType] -> ShowS) -> Show UserType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserType] -> ShowS
$cshowList :: [UserType] -> ShowS
show :: UserType -> String
$cshow :: UserType -> String
showsPrec :: Int -> UserType -> ShowS
$cshowsPrec :: Int -> UserType -> ShowS
Prelude.Show, (forall x. UserType -> Rep UserType x)
-> (forall x. Rep UserType x -> UserType) -> Generic UserType
forall x. Rep UserType x -> UserType
forall x. UserType -> Rep UserType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserType x -> UserType
$cfrom :: forall x. UserType -> Rep UserType x
Prelude.Generic)
newUserType ::
UserType
newUserType :: UserType
newUserType =
UserType' :: Maybe Bool
-> Maybe UserStatusType
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType
UserType'
{ $sel:enabled:UserType' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:userStatus:UserType' :: Maybe UserStatusType
userStatus = Maybe UserStatusType
forall a. Maybe a
Prelude.Nothing,
$sel:username:UserType' :: Maybe (Sensitive Text)
username = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:userCreateDate:UserType' :: Maybe POSIX
userCreateDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:UserType' :: Maybe [AttributeType]
attributes = Maybe [AttributeType]
forall a. Maybe a
Prelude.Nothing,
$sel:mfaOptions:UserType' :: Maybe [MFAOptionType]
mfaOptions = Maybe [MFAOptionType]
forall a. Maybe a
Prelude.Nothing,
$sel:userLastModifiedDate:UserType' :: Maybe POSIX
userLastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
userType_enabled :: Lens.Lens' UserType (Prelude.Maybe Prelude.Bool)
userType_enabled :: (Maybe Bool -> f (Maybe Bool)) -> UserType -> f UserType
userType_enabled = (UserType -> Maybe Bool)
-> (UserType -> Maybe Bool -> UserType)
-> Lens UserType UserType (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:UserType' :: UserType -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: UserType
s@UserType' {} Maybe Bool
a -> UserType
s {$sel:enabled:UserType' :: Maybe Bool
enabled = Maybe Bool
a} :: UserType)
userType_userStatus :: Lens.Lens' UserType (Prelude.Maybe UserStatusType)
userType_userStatus :: (Maybe UserStatusType -> f (Maybe UserStatusType))
-> UserType -> f UserType
userType_userStatus = (UserType -> Maybe UserStatusType)
-> (UserType -> Maybe UserStatusType -> UserType)
-> Lens
UserType UserType (Maybe UserStatusType) (Maybe UserStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe UserStatusType
userStatus :: Maybe UserStatusType
$sel:userStatus:UserType' :: UserType -> Maybe UserStatusType
userStatus} -> Maybe UserStatusType
userStatus) (\s :: UserType
s@UserType' {} Maybe UserStatusType
a -> UserType
s {$sel:userStatus:UserType' :: Maybe UserStatusType
userStatus = Maybe UserStatusType
a} :: UserType)
userType_username :: Lens.Lens' UserType (Prelude.Maybe Prelude.Text)
userType_username :: (Maybe Text -> f (Maybe Text)) -> UserType -> f UserType
userType_username = (UserType -> Maybe (Sensitive Text))
-> (UserType -> Maybe (Sensitive Text) -> UserType)
-> Lens
UserType UserType (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe (Sensitive Text)
username :: Maybe (Sensitive Text)
$sel:username:UserType' :: UserType -> Maybe (Sensitive Text)
username} -> Maybe (Sensitive Text)
username) (\s :: UserType
s@UserType' {} Maybe (Sensitive Text)
a -> UserType
s {$sel:username:UserType' :: Maybe (Sensitive Text)
username = Maybe (Sensitive Text)
a} :: UserType) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> UserType -> f UserType)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UserType
-> f UserType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
userType_userCreateDate :: Lens.Lens' UserType (Prelude.Maybe Prelude.UTCTime)
userType_userCreateDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> UserType -> f UserType
userType_userCreateDate = (UserType -> Maybe POSIX)
-> (UserType -> Maybe POSIX -> UserType)
-> Lens UserType UserType (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe POSIX
userCreateDate :: Maybe POSIX
$sel:userCreateDate:UserType' :: UserType -> Maybe POSIX
userCreateDate} -> Maybe POSIX
userCreateDate) (\s :: UserType
s@UserType' {} Maybe POSIX
a -> UserType
s {$sel:userCreateDate:UserType' :: Maybe POSIX
userCreateDate = Maybe POSIX
a} :: UserType) ((Maybe POSIX -> f (Maybe POSIX)) -> UserType -> f UserType)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UserType
-> f UserType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
userType_attributes :: Lens.Lens' UserType (Prelude.Maybe [AttributeType])
userType_attributes :: (Maybe [AttributeType] -> f (Maybe [AttributeType]))
-> UserType -> f UserType
userType_attributes = (UserType -> Maybe [AttributeType])
-> (UserType -> Maybe [AttributeType] -> UserType)
-> Lens
UserType UserType (Maybe [AttributeType]) (Maybe [AttributeType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe [AttributeType]
attributes :: Maybe [AttributeType]
$sel:attributes:UserType' :: UserType -> Maybe [AttributeType]
attributes} -> Maybe [AttributeType]
attributes) (\s :: UserType
s@UserType' {} Maybe [AttributeType]
a -> UserType
s {$sel:attributes:UserType' :: Maybe [AttributeType]
attributes = Maybe [AttributeType]
a} :: UserType) ((Maybe [AttributeType] -> f (Maybe [AttributeType]))
-> UserType -> f UserType)
-> ((Maybe [AttributeType] -> f (Maybe [AttributeType]))
-> Maybe [AttributeType] -> f (Maybe [AttributeType]))
-> (Maybe [AttributeType] -> f (Maybe [AttributeType]))
-> UserType
-> f UserType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AttributeType] [AttributeType] [AttributeType] [AttributeType]
-> Iso
(Maybe [AttributeType])
(Maybe [AttributeType])
(Maybe [AttributeType])
(Maybe [AttributeType])
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
[AttributeType] [AttributeType] [AttributeType] [AttributeType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
userType_mfaOptions :: Lens.Lens' UserType (Prelude.Maybe [MFAOptionType])
userType_mfaOptions :: (Maybe [MFAOptionType] -> f (Maybe [MFAOptionType]))
-> UserType -> f UserType
userType_mfaOptions = (UserType -> Maybe [MFAOptionType])
-> (UserType -> Maybe [MFAOptionType] -> UserType)
-> Lens
UserType UserType (Maybe [MFAOptionType]) (Maybe [MFAOptionType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe [MFAOptionType]
mfaOptions :: Maybe [MFAOptionType]
$sel:mfaOptions:UserType' :: UserType -> Maybe [MFAOptionType]
mfaOptions} -> Maybe [MFAOptionType]
mfaOptions) (\s :: UserType
s@UserType' {} Maybe [MFAOptionType]
a -> UserType
s {$sel:mfaOptions:UserType' :: Maybe [MFAOptionType]
mfaOptions = Maybe [MFAOptionType]
a} :: UserType) ((Maybe [MFAOptionType] -> f (Maybe [MFAOptionType]))
-> UserType -> f UserType)
-> ((Maybe [MFAOptionType] -> f (Maybe [MFAOptionType]))
-> Maybe [MFAOptionType] -> f (Maybe [MFAOptionType]))
-> (Maybe [MFAOptionType] -> f (Maybe [MFAOptionType]))
-> UserType
-> f UserType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MFAOptionType] [MFAOptionType] [MFAOptionType] [MFAOptionType]
-> Iso
(Maybe [MFAOptionType])
(Maybe [MFAOptionType])
(Maybe [MFAOptionType])
(Maybe [MFAOptionType])
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
[MFAOptionType] [MFAOptionType] [MFAOptionType] [MFAOptionType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
userType_userLastModifiedDate :: Lens.Lens' UserType (Prelude.Maybe Prelude.UTCTime)
userType_userLastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> UserType -> f UserType
userType_userLastModifiedDate = (UserType -> Maybe POSIX)
-> (UserType -> Maybe POSIX -> UserType)
-> Lens UserType UserType (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserType' {Maybe POSIX
userLastModifiedDate :: Maybe POSIX
$sel:userLastModifiedDate:UserType' :: UserType -> Maybe POSIX
userLastModifiedDate} -> Maybe POSIX
userLastModifiedDate) (\s :: UserType
s@UserType' {} Maybe POSIX
a -> UserType
s {$sel:userLastModifiedDate:UserType' :: Maybe POSIX
userLastModifiedDate = Maybe POSIX
a} :: UserType) ((Maybe POSIX -> f (Maybe POSIX)) -> UserType -> f UserType)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UserType
-> f UserType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON UserType where
parseJSON :: Value -> Parser UserType
parseJSON =
String -> (Object -> Parser UserType) -> Value -> Parser UserType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"UserType"
( \Object
x ->
Maybe Bool
-> Maybe UserStatusType
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType
UserType'
(Maybe Bool
-> Maybe UserStatusType
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
-> Parser (Maybe Bool)
-> Parser
(Maybe UserStatusType
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
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
"Enabled")
Parser
(Maybe UserStatusType
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
-> Parser (Maybe UserStatusType)
-> Parser
(Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UserStatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserStatus")
Parser
(Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
-> Parser (Maybe (Sensitive Text))
-> Parser
(Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Username")
Parser
(Maybe POSIX
-> Maybe [AttributeType]
-> Maybe [MFAOptionType]
-> Maybe POSIX
-> UserType)
-> Parser (Maybe POSIX)
-> Parser
(Maybe [AttributeType]
-> Maybe [MFAOptionType] -> Maybe POSIX -> UserType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserCreateDate")
Parser
(Maybe [AttributeType]
-> Maybe [MFAOptionType] -> Maybe POSIX -> UserType)
-> Parser (Maybe [AttributeType])
-> Parser (Maybe [MFAOptionType] -> Maybe POSIX -> UserType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AttributeType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes" Parser (Maybe (Maybe [AttributeType]))
-> Maybe [AttributeType] -> Parser (Maybe [AttributeType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AttributeType]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [MFAOptionType] -> Maybe POSIX -> UserType)
-> Parser (Maybe [MFAOptionType])
-> Parser (Maybe POSIX -> UserType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [MFAOptionType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MFAOptions" Parser (Maybe (Maybe [MFAOptionType]))
-> Maybe [MFAOptionType] -> Parser (Maybe [MFAOptionType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MFAOptionType]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe POSIX -> UserType)
-> Parser (Maybe POSIX) -> Parser UserType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserLastModifiedDate")
)
instance Prelude.Hashable UserType
instance Prelude.NFData UserType