module Network.AWS.CognitoIdentity.ListIdentities
(
listIdentities
, ListIdentities
, liHideDisabled
, liNextToken
, liIdentityPoolId
, liMaxResults
, listIdentitiesResponse
, ListIdentitiesResponse
, lirsIdentityPoolId
, lirsNextToken
, lirsIdentities
, lirsResponseStatus
) where
import Network.AWS.CognitoIdentity.Types
import Network.AWS.CognitoIdentity.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListIdentities = ListIdentities'
{ _liHideDisabled :: !(Maybe Bool)
, _liNextToken :: !(Maybe Text)
, _liIdentityPoolId :: !Text
, _liMaxResults :: !Nat
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIdentities
:: Text
-> Natural
-> ListIdentities
listIdentities pIdentityPoolId_ pMaxResults_ =
ListIdentities'
{ _liHideDisabled = Nothing
, _liNextToken = Nothing
, _liIdentityPoolId = pIdentityPoolId_
, _liMaxResults = _Nat # pMaxResults_
}
liHideDisabled :: Lens' ListIdentities (Maybe Bool)
liHideDisabled = lens _liHideDisabled (\ s a -> s{_liHideDisabled = a});
liNextToken :: Lens' ListIdentities (Maybe Text)
liNextToken = lens _liNextToken (\ s a -> s{_liNextToken = a});
liIdentityPoolId :: Lens' ListIdentities Text
liIdentityPoolId = lens _liIdentityPoolId (\ s a -> s{_liIdentityPoolId = a});
liMaxResults :: Lens' ListIdentities Natural
liMaxResults = lens _liMaxResults (\ s a -> s{_liMaxResults = a}) . _Nat;
instance AWSRequest ListIdentities where
type Rs ListIdentities = ListIdentitiesResponse
request = postJSON cognitoIdentity
response
= receiveJSON
(\ s h x ->
ListIdentitiesResponse' <$>
(x .?> "IdentityPoolId") <*> (x .?> "NextToken") <*>
(x .?> "Identities" .!@ mempty)
<*> (pure (fromEnum s)))
instance ToHeaders ListIdentities where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityService.ListIdentities" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListIdentities where
toJSON ListIdentities'{..}
= object
(catMaybes
[("HideDisabled" .=) <$> _liHideDisabled,
("NextToken" .=) <$> _liNextToken,
Just ("IdentityPoolId" .= _liIdentityPoolId),
Just ("MaxResults" .= _liMaxResults)])
instance ToPath ListIdentities where
toPath = const "/"
instance ToQuery ListIdentities where
toQuery = const mempty
data ListIdentitiesResponse = ListIdentitiesResponse'
{ _lirsIdentityPoolId :: !(Maybe Text)
, _lirsNextToken :: !(Maybe Text)
, _lirsIdentities :: !(Maybe [IdentityDescription])
, _lirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIdentitiesResponse
:: Int
-> ListIdentitiesResponse
listIdentitiesResponse pResponseStatus_ =
ListIdentitiesResponse'
{ _lirsIdentityPoolId = Nothing
, _lirsNextToken = Nothing
, _lirsIdentities = Nothing
, _lirsResponseStatus = pResponseStatus_
}
lirsIdentityPoolId :: Lens' ListIdentitiesResponse (Maybe Text)
lirsIdentityPoolId = lens _lirsIdentityPoolId (\ s a -> s{_lirsIdentityPoolId = a});
lirsNextToken :: Lens' ListIdentitiesResponse (Maybe Text)
lirsNextToken = lens _lirsNextToken (\ s a -> s{_lirsNextToken = a});
lirsIdentities :: Lens' ListIdentitiesResponse [IdentityDescription]
lirsIdentities = lens _lirsIdentities (\ s a -> s{_lirsIdentities = a}) . _Default . _Coerce;
lirsResponseStatus :: Lens' ListIdentitiesResponse Int
lirsResponseStatus = lens _lirsResponseStatus (\ s a -> s{_lirsResponseStatus = a});