{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CognitoIdentity.ListIdentityPools
(
listIdentityPools
, ListIdentityPools
, lipNextToken
, lipMaxResults
, listIdentityPoolsResponse
, ListIdentityPoolsResponse
, liprsIdentityPools
, liprsNextToken
, liprsResponseStatus
) where
import Network.AWS.CognitoIdentity.Types
import Network.AWS.CognitoIdentity.Types.Product
import Network.AWS.Lens
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 Hashable ListIdentityPools where
instance NFData ListIdentityPools where
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)
, _liprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listIdentityPoolsResponse
:: Int
-> ListIdentityPoolsResponse
listIdentityPoolsResponse pResponseStatus_ =
ListIdentityPoolsResponse'
{ _liprsIdentityPools = Nothing
, _liprsNextToken = Nothing
, _liprsResponseStatus = pResponseStatus_
}
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})
liprsResponseStatus :: Lens' ListIdentityPoolsResponse Int
liprsResponseStatus = lens _liprsResponseStatus (\ s a -> s{_liprsResponseStatus = a})
instance NFData ListIdentityPoolsResponse where