{-# 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.CognitoSync.SetIdentityPoolConfiguration
(
setIdentityPoolConfiguration
, SetIdentityPoolConfiguration
, sipcCognitoStreams
, sipcPushSync
, sipcIdentityPoolId
, setIdentityPoolConfigurationResponse
, SetIdentityPoolConfigurationResponse
, sipcrsIdentityPoolId
, sipcrsCognitoStreams
, sipcrsPushSync
, sipcrsResponseStatus
) where
import Network.AWS.CognitoSync.Types
import Network.AWS.CognitoSync.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data SetIdentityPoolConfiguration = SetIdentityPoolConfiguration'
{ _sipcCognitoStreams :: !(Maybe CognitoStreams)
, _sipcPushSync :: !(Maybe PushSync)
, _sipcIdentityPoolId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
setIdentityPoolConfiguration
:: Text
-> SetIdentityPoolConfiguration
setIdentityPoolConfiguration pIdentityPoolId_ =
SetIdentityPoolConfiguration'
{ _sipcCognitoStreams = Nothing
, _sipcPushSync = Nothing
, _sipcIdentityPoolId = pIdentityPoolId_
}
sipcCognitoStreams :: Lens' SetIdentityPoolConfiguration (Maybe CognitoStreams)
sipcCognitoStreams = lens _sipcCognitoStreams (\ s a -> s{_sipcCognitoStreams = a})
sipcPushSync :: Lens' SetIdentityPoolConfiguration (Maybe PushSync)
sipcPushSync = lens _sipcPushSync (\ s a -> s{_sipcPushSync = a})
sipcIdentityPoolId :: Lens' SetIdentityPoolConfiguration Text
sipcIdentityPoolId = lens _sipcIdentityPoolId (\ s a -> s{_sipcIdentityPoolId = a})
instance AWSRequest SetIdentityPoolConfiguration
where
type Rs SetIdentityPoolConfiguration =
SetIdentityPoolConfigurationResponse
request = postJSON cognitoSync
response
= receiveJSON
(\ s h x ->
SetIdentityPoolConfigurationResponse' <$>
(x .?> "IdentityPoolId") <*> (x .?> "CognitoStreams")
<*> (x .?> "PushSync")
<*> (pure (fromEnum s)))
instance Hashable SetIdentityPoolConfiguration where
instance NFData SetIdentityPoolConfiguration where
instance ToHeaders SetIdentityPoolConfiguration where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON SetIdentityPoolConfiguration where
toJSON SetIdentityPoolConfiguration'{..}
= object
(catMaybes
[("CognitoStreams" .=) <$> _sipcCognitoStreams,
("PushSync" .=) <$> _sipcPushSync])
instance ToPath SetIdentityPoolConfiguration where
toPath SetIdentityPoolConfiguration'{..}
= mconcat
["/identitypools/", toBS _sipcIdentityPoolId,
"/configuration"]
instance ToQuery SetIdentityPoolConfiguration where
toQuery = const mempty
data SetIdentityPoolConfigurationResponse = SetIdentityPoolConfigurationResponse'
{ _sipcrsIdentityPoolId :: !(Maybe Text)
, _sipcrsCognitoStreams :: !(Maybe CognitoStreams)
, _sipcrsPushSync :: !(Maybe PushSync)
, _sipcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
setIdentityPoolConfigurationResponse
:: Int
-> SetIdentityPoolConfigurationResponse
setIdentityPoolConfigurationResponse pResponseStatus_ =
SetIdentityPoolConfigurationResponse'
{ _sipcrsIdentityPoolId = Nothing
, _sipcrsCognitoStreams = Nothing
, _sipcrsPushSync = Nothing
, _sipcrsResponseStatus = pResponseStatus_
}
sipcrsIdentityPoolId :: Lens' SetIdentityPoolConfigurationResponse (Maybe Text)
sipcrsIdentityPoolId = lens _sipcrsIdentityPoolId (\ s a -> s{_sipcrsIdentityPoolId = a})
sipcrsCognitoStreams :: Lens' SetIdentityPoolConfigurationResponse (Maybe CognitoStreams)
sipcrsCognitoStreams = lens _sipcrsCognitoStreams (\ s a -> s{_sipcrsCognitoStreams = a})
sipcrsPushSync :: Lens' SetIdentityPoolConfigurationResponse (Maybe PushSync)
sipcrsPushSync = lens _sipcrsPushSync (\ s a -> s{_sipcrsPushSync = a})
sipcrsResponseStatus :: Lens' SetIdentityPoolConfigurationResponse Int
sipcrsResponseStatus = lens _sipcrsResponseStatus (\ s a -> s{_sipcrsResponseStatus = a})
instance NFData SetIdentityPoolConfigurationResponse
where