module Network.AWS.CognitoIdentityProvider.ListGroups
(
listGroups
, ListGroups
, lgNextToken
, lgLimit
, lgUserPoolId
, listGroupsResponse
, ListGroupsResponse
, lgrsGroups
, lgrsNextToken
, lgrsResponseStatus
) 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 ListGroups = ListGroups'
{ _lgNextToken :: !(Maybe Text)
, _lgLimit :: !(Maybe Nat)
, _lgUserPoolId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listGroups
:: Text
-> ListGroups
listGroups pUserPoolId_ =
ListGroups'
{_lgNextToken = Nothing, _lgLimit = Nothing, _lgUserPoolId = pUserPoolId_}
lgNextToken :: Lens' ListGroups (Maybe Text)
lgNextToken = lens _lgNextToken (\ s a -> s{_lgNextToken = a});
lgLimit :: Lens' ListGroups (Maybe Natural)
lgLimit = lens _lgLimit (\ s a -> s{_lgLimit = a}) . mapping _Nat;
lgUserPoolId :: Lens' ListGroups Text
lgUserPoolId = lens _lgUserPoolId (\ s a -> s{_lgUserPoolId = a});
instance AWSRequest ListGroups where
type Rs ListGroups = ListGroupsResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
ListGroupsResponse' <$>
(x .?> "Groups" .!@ mempty) <*> (x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListGroups where
instance NFData ListGroups where
instance ToHeaders ListGroups where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ListGroups" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListGroups where
toJSON ListGroups'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lgNextToken,
("Limit" .=) <$> _lgLimit,
Just ("UserPoolId" .= _lgUserPoolId)])
instance ToPath ListGroups where
toPath = const "/"
instance ToQuery ListGroups where
toQuery = const mempty
data ListGroupsResponse = ListGroupsResponse'
{ _lgrsGroups :: !(Maybe [GroupType])
, _lgrsNextToken :: !(Maybe Text)
, _lgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listGroupsResponse
:: Int
-> ListGroupsResponse
listGroupsResponse pResponseStatus_ =
ListGroupsResponse'
{ _lgrsGroups = Nothing
, _lgrsNextToken = Nothing
, _lgrsResponseStatus = pResponseStatus_
}
lgrsGroups :: Lens' ListGroupsResponse [GroupType]
lgrsGroups = lens _lgrsGroups (\ s a -> s{_lgrsGroups = a}) . _Default . _Coerce;
lgrsNextToken :: Lens' ListGroupsResponse (Maybe Text)
lgrsNextToken = lens _lgrsNextToken (\ s a -> s{_lgrsNextToken = a});
lgrsResponseStatus :: Lens' ListGroupsResponse Int
lgrsResponseStatus = lens _lgrsResponseStatus (\ s a -> s{_lgrsResponseStatus = a});
instance NFData ListGroupsResponse where