{-# 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.IdentityStore.Types.User where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data User = User'
{
User -> Sensitive Text
userName :: Core.Sensitive Prelude.Text,
User -> Text
userId :: Prelude.Text
}
deriving (User -> User -> Bool
(User -> User -> Bool) -> (User -> User -> Bool) -> Eq User
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Prelude.Eq, Int -> User -> ShowS
[User] -> ShowS
User -> String
(Int -> User -> ShowS)
-> (User -> String) -> ([User] -> ShowS) -> Show User
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Prelude.Show, (forall x. User -> Rep User x)
-> (forall x. Rep User x -> User) -> Generic User
forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Prelude.Generic)
newUser ::
Prelude.Text ->
Prelude.Text ->
User
newUser :: Text -> Text -> User
newUser Text
pUserName_ Text
pUserId_ =
User' :: Sensitive Text -> Text -> User
User'
{ $sel:userName:User' :: Sensitive Text
userName = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUserName_,
$sel:userId:User' :: Text
userId = Text
pUserId_
}
user_userName :: Lens.Lens' User Prelude.Text
user_userName :: (Text -> f Text) -> User -> f User
user_userName = (User -> Sensitive Text)
-> (User -> Sensitive Text -> User)
-> Lens User User (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Sensitive Text
userName :: Sensitive Text
$sel:userName:User' :: User -> Sensitive Text
userName} -> Sensitive Text
userName) (\s :: User
s@User' {} Sensitive Text
a -> User
s {$sel:userName:User' :: Sensitive Text
userName = Sensitive Text
a} :: User) ((Sensitive Text -> f (Sensitive Text)) -> User -> f User)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
user_userId :: Lens.Lens' User Prelude.Text
user_userId :: (Text -> f Text) -> User -> f User
user_userId = (User -> Text)
-> (User -> Text -> User) -> Lens User User Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Text
userId :: Text
$sel:userId:User' :: User -> Text
userId} -> Text
userId) (\s :: User
s@User' {} Text
a -> User
s {$sel:userId:User' :: Text
userId = Text
a} :: User)
instance Core.FromJSON User where
parseJSON :: Value -> Parser User
parseJSON =
String -> (Object -> Parser User) -> Value -> Parser User
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"User"
( \Object
x ->
Sensitive Text -> Text -> User
User'
(Sensitive Text -> Text -> User)
-> Parser (Sensitive Text) -> Parser (Text -> User)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserName")
Parser (Text -> User) -> Parser Text -> Parser User
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserId")
)
instance Prelude.Hashable User
instance Prelude.NFData User