module Network.AWS.CognitoSync.GetCognitoEvents
(
getCognitoEvents
, GetCognitoEvents
, gceIdentityPoolId
, getCognitoEventsResponse
, GetCognitoEventsResponse
, gcersEvents
, gcersResponseStatus
) where
import Network.AWS.CognitoSync.Types
import Network.AWS.CognitoSync.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetCognitoEvents = GetCognitoEvents'
{ _gceIdentityPoolId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCognitoEvents
:: Text
-> GetCognitoEvents
getCognitoEvents pIdentityPoolId_ =
GetCognitoEvents'
{ _gceIdentityPoolId = pIdentityPoolId_
}
gceIdentityPoolId :: Lens' GetCognitoEvents Text
gceIdentityPoolId = lens _gceIdentityPoolId (\ s a -> s{_gceIdentityPoolId = a});
instance AWSRequest GetCognitoEvents where
type Rs GetCognitoEvents = GetCognitoEventsResponse
request = get cognitoSync
response
= receiveJSON
(\ s h x ->
GetCognitoEventsResponse' <$>
(x .?> "Events" .!@ mempty) <*> (pure (fromEnum s)))
instance ToHeaders GetCognitoEvents where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetCognitoEvents where
toPath GetCognitoEvents'{..}
= mconcat
["/identitypools/", toBS _gceIdentityPoolId,
"/events"]
instance ToQuery GetCognitoEvents where
toQuery = const mempty
data GetCognitoEventsResponse = GetCognitoEventsResponse'
{ _gcersEvents :: !(Maybe (Map Text Text))
, _gcersResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getCognitoEventsResponse
:: Int
-> GetCognitoEventsResponse
getCognitoEventsResponse pResponseStatus_ =
GetCognitoEventsResponse'
{ _gcersEvents = Nothing
, _gcersResponseStatus = pResponseStatus_
}
gcersEvents :: Lens' GetCognitoEventsResponse (HashMap Text Text)
gcersEvents = lens _gcersEvents (\ s a -> s{_gcersEvents = a}) . _Default . _Map;
gcersResponseStatus :: Lens' GetCognitoEventsResponse Int
gcersResponseStatus = lens _gcersResponseStatus (\ s a -> s{_gcersResponseStatus = a});