{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
module Aws.Iam.Commands.ListUsers
( ListUsers(..)
, ListUsersResponse(..)
, User(..)
) where
import Aws.Core
import Aws.Iam.Core
import Aws.Iam.Internal
import Control.Applicative
import Data.Text (Text)
import Data.Typeable
import Prelude
import Text.XML.Cursor (laxElement, ($//), (&|))
data ListUsers
= ListUsers {
ListUsers -> Maybe Text
luPathPrefix :: Maybe Text
, ListUsers -> Maybe Text
luMarker :: Maybe Text
, ListUsers -> Maybe Integer
luMaxItems :: Maybe Integer
}
deriving (ListUsers -> ListUsers -> Bool
(ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> Bool) -> Eq ListUsers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListUsers -> ListUsers -> Bool
== :: ListUsers -> ListUsers -> Bool
$c/= :: ListUsers -> ListUsers -> Bool
/= :: ListUsers -> ListUsers -> Bool
Eq, Eq ListUsers
Eq ListUsers =>
(ListUsers -> ListUsers -> Ordering)
-> (ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> ListUsers)
-> (ListUsers -> ListUsers -> ListUsers)
-> Ord ListUsers
ListUsers -> ListUsers -> Bool
ListUsers -> ListUsers -> Ordering
ListUsers -> ListUsers -> ListUsers
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ListUsers -> ListUsers -> Ordering
compare :: ListUsers -> ListUsers -> Ordering
$c< :: ListUsers -> ListUsers -> Bool
< :: ListUsers -> ListUsers -> Bool
$c<= :: ListUsers -> ListUsers -> Bool
<= :: ListUsers -> ListUsers -> Bool
$c> :: ListUsers -> ListUsers -> Bool
> :: ListUsers -> ListUsers -> Bool
$c>= :: ListUsers -> ListUsers -> Bool
>= :: ListUsers -> ListUsers -> Bool
$cmax :: ListUsers -> ListUsers -> ListUsers
max :: ListUsers -> ListUsers -> ListUsers
$cmin :: ListUsers -> ListUsers -> ListUsers
min :: ListUsers -> ListUsers -> ListUsers
Ord, Int -> ListUsers -> ShowS
[ListUsers] -> ShowS
ListUsers -> String
(Int -> ListUsers -> ShowS)
-> (ListUsers -> String)
-> ([ListUsers] -> ShowS)
-> Show ListUsers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListUsers -> ShowS
showsPrec :: Int -> ListUsers -> ShowS
$cshow :: ListUsers -> String
show :: ListUsers -> String
$cshowList :: [ListUsers] -> ShowS
showList :: [ListUsers] -> ShowS
Show, Typeable)
instance SignQuery ListUsers where
type ServiceConfiguration ListUsers = IamConfiguration
signQuery :: forall queryType.
ListUsers
-> ServiceConfiguration ListUsers queryType
-> SignatureData
-> SignedQuery
signQuery ListUsers{Maybe Integer
Maybe Text
luPathPrefix :: ListUsers -> Maybe Text
luMarker :: ListUsers -> Maybe Text
luMaxItems :: ListUsers -> Maybe Integer
luPathPrefix :: Maybe Text
luMarker :: Maybe Text
luMaxItems :: Maybe Integer
..}
= ByteString
-> [Maybe (ByteString, Text)]
-> IamConfiguration queryType
-> SignatureData
-> SignedQuery
forall qt.
ByteString
-> [Maybe (ByteString, Text)]
-> IamConfiguration qt
-> SignatureData
-> SignedQuery
iamAction' ByteString
"ListUsers" ([Maybe (ByteString, Text)]
-> IamConfiguration queryType -> SignatureData -> SignedQuery)
-> [Maybe (ByteString, Text)]
-> IamConfiguration queryType
-> SignatureData
-> SignedQuery
forall a b. (a -> b) -> a -> b
$ [
(ByteString
"PathPrefix",) (Text -> (ByteString, Text))
-> Maybe Text -> Maybe (ByteString, Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
luPathPrefix
] [Maybe (ByteString, Text)]
-> [Maybe (ByteString, Text)] -> [Maybe (ByteString, Text)]
forall a. Semigroup a => a -> a -> a
<> Maybe Text -> Maybe Integer -> [Maybe (ByteString, Text)]
markedIter Maybe Text
luMarker Maybe Integer
luMaxItems
data ListUsersResponse
= ListUsersResponse {
ListUsersResponse -> [User]
lurUsers :: [User]
, ListUsersResponse -> Bool
lurIsTruncated :: Bool
, ListUsersResponse -> Maybe Text
lurMarker :: Maybe Text
}
deriving (ListUsersResponse -> ListUsersResponse -> Bool
(ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> Eq ListUsersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListUsersResponse -> ListUsersResponse -> Bool
== :: ListUsersResponse -> ListUsersResponse -> Bool
$c/= :: ListUsersResponse -> ListUsersResponse -> Bool
/= :: ListUsersResponse -> ListUsersResponse -> Bool
Eq, Eq ListUsersResponse
Eq ListUsersResponse =>
(ListUsersResponse -> ListUsersResponse -> Ordering)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> ListUsersResponse)
-> (ListUsersResponse -> ListUsersResponse -> ListUsersResponse)
-> Ord ListUsersResponse
ListUsersResponse -> ListUsersResponse -> Bool
ListUsersResponse -> ListUsersResponse -> Ordering
ListUsersResponse -> ListUsersResponse -> ListUsersResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ListUsersResponse -> ListUsersResponse -> Ordering
compare :: ListUsersResponse -> ListUsersResponse -> Ordering
$c< :: ListUsersResponse -> ListUsersResponse -> Bool
< :: ListUsersResponse -> ListUsersResponse -> Bool
$c<= :: ListUsersResponse -> ListUsersResponse -> Bool
<= :: ListUsersResponse -> ListUsersResponse -> Bool
$c> :: ListUsersResponse -> ListUsersResponse -> Bool
> :: ListUsersResponse -> ListUsersResponse -> Bool
$c>= :: ListUsersResponse -> ListUsersResponse -> Bool
>= :: ListUsersResponse -> ListUsersResponse -> Bool
$cmax :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
max :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
$cmin :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
min :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
Ord, Int -> ListUsersResponse -> ShowS
[ListUsersResponse] -> ShowS
ListUsersResponse -> String
(Int -> ListUsersResponse -> ShowS)
-> (ListUsersResponse -> String)
-> ([ListUsersResponse] -> ShowS)
-> Show ListUsersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListUsersResponse -> ShowS
showsPrec :: Int -> ListUsersResponse -> ShowS
$cshow :: ListUsersResponse -> String
show :: ListUsersResponse -> String
$cshowList :: [ListUsersResponse] -> ShowS
showList :: [ListUsersResponse] -> ShowS
Show, Typeable)
instance ResponseConsumer ListUsers ListUsersResponse where
type ResponseMetadata ListUsersResponse = IamMetadata
responseConsumer :: Request
-> ListUsers
-> IORef (ResponseMetadata ListUsersResponse)
-> HTTPResponseConsumer ListUsersResponse
responseConsumer Request
_ ListUsers
_
= (Cursor -> Response IamMetadata ListUsersResponse)
-> IORef IamMetadata -> HTTPResponseConsumer ListUsersResponse
forall a.
(Cursor -> Response IamMetadata a)
-> IORef IamMetadata -> HTTPResponseConsumer a
iamResponseConsumer ((Cursor -> Response IamMetadata ListUsersResponse)
-> IORef IamMetadata -> HTTPResponseConsumer ListUsersResponse)
-> (Cursor -> Response IamMetadata ListUsersResponse)
-> IORef IamMetadata
-> HTTPResponseConsumer ListUsersResponse
forall a b. (a -> b) -> a -> b
$ \Cursor
cursor -> do
(Bool
lurIsTruncated, Maybe Text
lurMarker) <- Cursor -> Response IamMetadata (Bool, Maybe Text)
forall (m :: * -> *).
MonadThrow m =>
Cursor -> m (Bool, Maybe Text)
markedIterResponse Cursor
cursor
[User]
lurUsers <- [Response IamMetadata User] -> Response IamMetadata [User]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
forall (m :: * -> *) a. Monad m => [m a] -> m [a]
sequence ([Response IamMetadata User] -> Response IamMetadata [User])
-> [Response IamMetadata User] -> Response IamMetadata [User]
forall a b. (a -> b) -> a -> b
$
Cursor
cursor Cursor
-> (Cursor -> [Response IamMetadata User])
-> [Response IamMetadata User]
forall node a. Cursor node -> (Cursor node -> [a]) -> [a]
$// Text -> Axis
laxElement Text
"member" Axis
-> (Cursor -> Response IamMetadata User)
-> Cursor
-> [Response IamMetadata User]
forall node a b.
(Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b]
&| Cursor -> Response IamMetadata User
forall (m :: * -> *). MonadThrow m => Cursor -> m User
parseUser
ListUsersResponse -> Response IamMetadata ListUsersResponse
forall a. a -> Response IamMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return ListUsersResponse{Bool
[User]
Maybe Text
lurUsers :: [User]
lurIsTruncated :: Bool
lurMarker :: Maybe Text
lurIsTruncated :: Bool
lurMarker :: Maybe Text
lurUsers :: [User]
..}
instance Transaction ListUsers ListUsersResponse
instance IteratedTransaction ListUsers ListUsersResponse where
nextIteratedRequest :: ListUsers -> ListUsersResponse -> Maybe ListUsers
nextIteratedRequest ListUsers
request ListUsersResponse
response
= case ListUsersResponse -> Maybe Text
lurMarker ListUsersResponse
response of
Maybe Text
Nothing -> Maybe ListUsers
forall a. Maybe a
Nothing
Just Text
marker -> ListUsers -> Maybe ListUsers
forall a. a -> Maybe a
Just (ListUsers -> Maybe ListUsers) -> ListUsers -> Maybe ListUsers
forall a b. (a -> b) -> a -> b
$ ListUsers
request { luMarker = Just marker }
instance AsMemoryResponse ListUsersResponse where
type MemoryResponse ListUsersResponse = ListUsersResponse
loadToMemory :: ListUsersResponse
-> ResourceT IO (MemoryResponse ListUsersResponse)
loadToMemory = ListUsersResponse
-> ResourceT IO (MemoryResponse ListUsersResponse)
ListUsersResponse -> ResourceT IO ListUsersResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return