module Network.AWS.CognitoIdentity.ListIdentityPools
(
listIdentityPools
, ListIdentityPools
, lipNextToken
, lipMaxResults
, listIdentityPoolsResponse
, ListIdentityPoolsResponse
, liprsIdentityPools
, liprsNextToken
, liprsStatus
) 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 ListIdentityPools = ListIdentityPools'
{ _lipNextToken :: !(Maybe Text)
, _lipMaxResults :: !Nat
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIdentityPools
:: Natural
-> ListIdentityPools
listIdentityPools pMaxResults_ =
ListIdentityPools'
{ _lipNextToken = Nothing
, _lipMaxResults = _Nat # pMaxResults_
}
lipNextToken :: Lens' ListIdentityPools (Maybe Text)
lipNextToken = lens _lipNextToken (\ s a -> s{_lipNextToken = a});
lipMaxResults :: Lens' ListIdentityPools Natural
lipMaxResults = lens _lipMaxResults (\ s a -> s{_lipMaxResults = a}) . _Nat;
instance AWSRequest ListIdentityPools where
type Rs ListIdentityPools = ListIdentityPoolsResponse
request = postJSON cognitoIdentity
response
= receiveJSON
(\ s h x ->
ListIdentityPoolsResponse' <$>
(x .?> "IdentityPools" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance ToHeaders ListIdentityPools where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityService.ListIdentityPools" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListIdentityPools where
toJSON ListIdentityPools'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lipNextToken,
Just ("MaxResults" .= _lipMaxResults)])
instance ToPath ListIdentityPools where
toPath = const "/"
instance ToQuery ListIdentityPools where
toQuery = const mempty
data ListIdentityPoolsResponse = ListIdentityPoolsResponse'
{ _liprsIdentityPools :: !(Maybe [IdentityPoolShortDescription])
, _liprsNextToken :: !(Maybe Text)
, _liprsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listIdentityPoolsResponse
:: Int
-> ListIdentityPoolsResponse
listIdentityPoolsResponse pStatus_ =
ListIdentityPoolsResponse'
{ _liprsIdentityPools = Nothing
, _liprsNextToken = Nothing
, _liprsStatus = pStatus_
}
liprsIdentityPools :: Lens' ListIdentityPoolsResponse [IdentityPoolShortDescription]
liprsIdentityPools = lens _liprsIdentityPools (\ s a -> s{_liprsIdentityPools = a}) . _Default . _Coerce;
liprsNextToken :: Lens' ListIdentityPoolsResponse (Maybe Text)
liprsNextToken = lens _liprsNextToken (\ s a -> s{_liprsNextToken = a});
liprsStatus :: Lens' ListIdentityPoolsResponse Int
liprsStatus = lens _liprsStatus (\ s a -> s{_liprsStatus = a});