module Network.AWS.CognitoIdentityProvider.ListUsers
(
listUsers
, ListUsers
, luPaginationToken
, luAttributesToGet
, luUserStatus
, luLimit
, luUserPoolId
, listUsersResponse
, ListUsersResponse
, lursPaginationToken
, lursUsers
, lursResponseStatus
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListUsers = ListUsers'
{ _luPaginationToken :: !(Maybe Text)
, _luAttributesToGet :: !(Maybe [Text])
, _luUserStatus :: !(Maybe UserStatusType)
, _luLimit :: !(Maybe Nat)
, _luUserPoolId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listUsers
:: Text
-> ListUsers
listUsers pUserPoolId_ =
ListUsers'
{ _luPaginationToken = Nothing
, _luAttributesToGet = Nothing
, _luUserStatus = Nothing
, _luLimit = Nothing
, _luUserPoolId = pUserPoolId_
}
luPaginationToken :: Lens' ListUsers (Maybe Text)
luPaginationToken = lens _luPaginationToken (\ s a -> s{_luPaginationToken = a});
luAttributesToGet :: Lens' ListUsers [Text]
luAttributesToGet = lens _luAttributesToGet (\ s a -> s{_luAttributesToGet = a}) . _Default . _Coerce;
luUserStatus :: Lens' ListUsers (Maybe UserStatusType)
luUserStatus = lens _luUserStatus (\ s a -> s{_luUserStatus = a});
luLimit :: Lens' ListUsers (Maybe Natural)
luLimit = lens _luLimit (\ s a -> s{_luLimit = a}) . mapping _Nat;
luUserPoolId :: Lens' ListUsers Text
luUserPoolId = lens _luUserPoolId (\ s a -> s{_luUserPoolId = a});
instance AWSRequest ListUsers where
type Rs ListUsers = ListUsersResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
ListUsersResponse' <$>
(x .?> "PaginationToken") <*>
(x .?> "Users" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListUsers
instance NFData ListUsers
instance ToHeaders ListUsers where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ListUsers" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListUsers where
toJSON ListUsers'{..}
= object
(catMaybes
[("PaginationToken" .=) <$> _luPaginationToken,
("AttributesToGet" .=) <$> _luAttributesToGet,
("UserStatus" .=) <$> _luUserStatus,
("Limit" .=) <$> _luLimit,
Just ("UserPoolId" .= _luUserPoolId)])
instance ToPath ListUsers where
toPath = const "/"
instance ToQuery ListUsers where
toQuery = const mempty
data ListUsersResponse = ListUsersResponse'
{ _lursPaginationToken :: !(Maybe Text)
, _lursUsers :: !(Maybe [UserType])
, _lursResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listUsersResponse
:: Int
-> ListUsersResponse
listUsersResponse pResponseStatus_ =
ListUsersResponse'
{ _lursPaginationToken = Nothing
, _lursUsers = Nothing
, _lursResponseStatus = pResponseStatus_
}
lursPaginationToken :: Lens' ListUsersResponse (Maybe Text)
lursPaginationToken = lens _lursPaginationToken (\ s a -> s{_lursPaginationToken = a});
lursUsers :: Lens' ListUsersResponse [UserType]
lursUsers = lens _lursUsers (\ s a -> s{_lursUsers = a}) . _Default . _Coerce;
lursResponseStatus :: Lens' ListUsersResponse Int
lursResponseStatus = lens _lursResponseStatus (\ s a -> s{_lursResponseStatus = a});
instance NFData ListUsersResponse