{-# 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.IAM.Types.User where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.AttachedPermissionsBoundary
import Amazonka.IAM.Types.Tag
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data User = User'
{
User -> Maybe ISO8601
passwordLastUsed :: Prelude.Maybe Core.ISO8601,
User -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
User -> Maybe AttachedPermissionsBoundary
permissionsBoundary :: Prelude.Maybe AttachedPermissionsBoundary,
User -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
User -> Text
userName :: Prelude.Text,
User -> Text
userId :: Prelude.Text,
User -> Text
arn :: Prelude.Text,
User -> ISO8601
createDate :: Core.ISO8601
}
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, ReadPrec [User]
ReadPrec User
Int -> ReadS User
ReadS [User]
(Int -> ReadS User)
-> ReadS [User] -> ReadPrec User -> ReadPrec [User] -> Read User
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [User]
$creadListPrec :: ReadPrec [User]
readPrec :: ReadPrec User
$creadPrec :: ReadPrec User
readList :: ReadS [User]
$creadList :: ReadS [User]
readsPrec :: Int -> ReadS User
$creadsPrec :: Int -> ReadS User
Prelude.Read, 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 ->
Prelude.Text ->
Prelude.UTCTime ->
User
newUser :: Text -> Text -> Text -> UTCTime -> User
newUser Text
pUserName_ Text
pUserId_ Text
pArn_ UTCTime
pCreateDate_ =
User' :: Maybe ISO8601
-> Maybe Text
-> Maybe AttachedPermissionsBoundary
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> ISO8601
-> User
User'
{ $sel:passwordLastUsed:User' :: Maybe ISO8601
passwordLastUsed = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:path:User' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:permissionsBoundary:User' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
forall a. Maybe a
Prelude.Nothing,
$sel:tags:User' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:userName:User' :: Text
userName = Text
pUserName_,
$sel:userId:User' :: Text
userId = Text
pUserId_,
$sel:arn:User' :: Text
arn = Text
pArn_,
$sel:createDate:User' :: ISO8601
createDate = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateDate_
}
user_passwordLastUsed :: Lens.Lens' User (Prelude.Maybe Prelude.UTCTime)
user_passwordLastUsed :: (Maybe UTCTime -> f (Maybe UTCTime)) -> User -> f User
user_passwordLastUsed = (User -> Maybe ISO8601)
-> (User -> Maybe ISO8601 -> User)
-> Lens User User (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe ISO8601
passwordLastUsed :: Maybe ISO8601
$sel:passwordLastUsed:User' :: User -> Maybe ISO8601
passwordLastUsed} -> Maybe ISO8601
passwordLastUsed) (\s :: User
s@User' {} Maybe ISO8601
a -> User
s {$sel:passwordLastUsed:User' :: Maybe ISO8601
passwordLastUsed = Maybe ISO8601
a} :: User) ((Maybe ISO8601 -> f (Maybe ISO8601)) -> User -> f User)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
user_path :: Lens.Lens' User (Prelude.Maybe Prelude.Text)
user_path :: (Maybe Text -> f (Maybe Text)) -> User -> f User
user_path = (User -> Maybe Text)
-> (User -> Maybe Text -> User)
-> Lens User User (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Text
path :: Maybe Text
$sel:path:User' :: User -> Maybe Text
path} -> Maybe Text
path) (\s :: User
s@User' {} Maybe Text
a -> User
s {$sel:path:User' :: Maybe Text
path = Maybe Text
a} :: User)
user_permissionsBoundary :: Lens.Lens' User (Prelude.Maybe AttachedPermissionsBoundary)
user_permissionsBoundary :: (Maybe AttachedPermissionsBoundary
-> f (Maybe AttachedPermissionsBoundary))
-> User -> f User
user_permissionsBoundary = (User -> Maybe AttachedPermissionsBoundary)
-> (User -> Maybe AttachedPermissionsBoundary -> User)
-> Lens
User
User
(Maybe AttachedPermissionsBoundary)
(Maybe AttachedPermissionsBoundary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe AttachedPermissionsBoundary
permissionsBoundary :: Maybe AttachedPermissionsBoundary
$sel:permissionsBoundary:User' :: User -> Maybe AttachedPermissionsBoundary
permissionsBoundary} -> Maybe AttachedPermissionsBoundary
permissionsBoundary) (\s :: User
s@User' {} Maybe AttachedPermissionsBoundary
a -> User
s {$sel:permissionsBoundary:User' :: Maybe AttachedPermissionsBoundary
permissionsBoundary = Maybe AttachedPermissionsBoundary
a} :: User)
user_tags :: Lens.Lens' User (Prelude.Maybe [Tag])
user_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> User -> f User
user_tags = (User -> Maybe [Tag])
-> (User -> Maybe [Tag] -> User)
-> Lens User User (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:User' :: User -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: User
s@User' {} Maybe [Tag]
a -> User
s {$sel:tags:User' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: User) ((Maybe [Tag] -> f (Maybe [Tag])) -> User -> f User)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
user_userName :: Lens.Lens' User Prelude.Text
user_userName :: (Text -> f Text) -> User -> f User
user_userName = (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
userName :: Text
$sel:userName:User' :: User -> Text
userName} -> Text
userName) (\s :: User
s@User' {} Text
a -> User
s {$sel:userName:User' :: Text
userName = Text
a} :: User)
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)
user_arn :: Lens.Lens' User Prelude.Text
user_arn :: (Text -> f Text) -> User -> f User
user_arn = (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
arn :: Text
$sel:arn:User' :: User -> Text
arn} -> Text
arn) (\s :: User
s@User' {} Text
a -> User
s {$sel:arn:User' :: Text
arn = Text
a} :: User)
user_createDate :: Lens.Lens' User Prelude.UTCTime
user_createDate :: (UTCTime -> f UTCTime) -> User -> f User
user_createDate = (User -> ISO8601)
-> (User -> ISO8601 -> User) -> Lens User User ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {ISO8601
createDate :: ISO8601
$sel:createDate:User' :: User -> ISO8601
createDate} -> ISO8601
createDate) (\s :: User
s@User' {} ISO8601
a -> User
s {$sel:createDate:User' :: ISO8601
createDate = ISO8601
a} :: User) ((ISO8601 -> f ISO8601) -> User -> f User)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> User
-> f User
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromXML User where
parseXML :: [Node] -> Either String User
parseXML [Node]
x =
Maybe ISO8601
-> Maybe Text
-> Maybe AttachedPermissionsBoundary
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> ISO8601
-> User
User'
(Maybe ISO8601
-> Maybe Text
-> Maybe AttachedPermissionsBoundary
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> ISO8601
-> User)
-> Either String (Maybe ISO8601)
-> Either
String
(Maybe Text
-> Maybe AttachedPermissionsBoundary
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> ISO8601
-> User)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PasswordLastUsed")
Either
String
(Maybe Text
-> Maybe AttachedPermissionsBoundary
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> ISO8601
-> User)
-> Either String (Maybe Text)
-> Either
String
(Maybe AttachedPermissionsBoundary
-> Maybe [Tag] -> Text -> Text -> Text -> ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Path")
Either
String
(Maybe AttachedPermissionsBoundary
-> Maybe [Tag] -> Text -> Text -> Text -> ISO8601 -> User)
-> Either String (Maybe AttachedPermissionsBoundary)
-> Either
String (Maybe [Tag] -> Text -> Text -> Text -> ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AttachedPermissionsBoundary)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PermissionsBoundary")
Either
String (Maybe [Tag] -> Text -> Text -> Text -> ISO8601 -> User)
-> Either String (Maybe [Tag])
-> Either String (Text -> Text -> Text -> ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Tags" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Text -> Text -> Text -> ISO8601 -> User)
-> Either String Text
-> Either String (Text -> Text -> ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserName")
Either String (Text -> Text -> ISO8601 -> User)
-> Either String Text -> Either String (Text -> ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserId")
Either String (Text -> ISO8601 -> User)
-> Either String Text -> Either String (ISO8601 -> User)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Arn")
Either String (ISO8601 -> User)
-> Either String ISO8601 -> Either String User
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreateDate")
instance Prelude.Hashable User
instance Prelude.NFData User