module Network.AWS.CognitoIdentity.CreateIdentityPool
(
createIdentityPool
, CreateIdentityPool
, cipSupportedLoginProviders
, cipDeveloperProviderName
, cipOpenIdConnectProviderARNs
, cipIdentityPoolName
, cipAllowUnauthenticatedIdentities
, identityPool
, IdentityPool
, ipSupportedLoginProviders
, ipDeveloperProviderName
, ipOpenIdConnectProviderARNs
, ipIdentityPoolId
, ipIdentityPoolName
, ipAllowUnauthenticatedIdentities
) 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 CreateIdentityPool = CreateIdentityPool'
{ _cipSupportedLoginProviders :: !(Maybe (Map Text Text))
, _cipDeveloperProviderName :: !(Maybe Text)
, _cipOpenIdConnectProviderARNs :: !(Maybe [Text])
, _cipIdentityPoolName :: !Text
, _cipAllowUnauthenticatedIdentities :: !Bool
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createIdentityPool
:: Text
-> Bool
-> CreateIdentityPool
createIdentityPool pIdentityPoolName_ pAllowUnauthenticatedIdentities_ =
CreateIdentityPool'
{ _cipSupportedLoginProviders = Nothing
, _cipDeveloperProviderName = Nothing
, _cipOpenIdConnectProviderARNs = Nothing
, _cipIdentityPoolName = pIdentityPoolName_
, _cipAllowUnauthenticatedIdentities = pAllowUnauthenticatedIdentities_
}
cipSupportedLoginProviders :: Lens' CreateIdentityPool (HashMap Text Text)
cipSupportedLoginProviders = lens _cipSupportedLoginProviders (\ s a -> s{_cipSupportedLoginProviders = a}) . _Default . _Map;
cipDeveloperProviderName :: Lens' CreateIdentityPool (Maybe Text)
cipDeveloperProviderName = lens _cipDeveloperProviderName (\ s a -> s{_cipDeveloperProviderName = a});
cipOpenIdConnectProviderARNs :: Lens' CreateIdentityPool [Text]
cipOpenIdConnectProviderARNs = lens _cipOpenIdConnectProviderARNs (\ s a -> s{_cipOpenIdConnectProviderARNs = a}) . _Default . _Coerce;
cipIdentityPoolName :: Lens' CreateIdentityPool Text
cipIdentityPoolName = lens _cipIdentityPoolName (\ s a -> s{_cipIdentityPoolName = a});
cipAllowUnauthenticatedIdentities :: Lens' CreateIdentityPool Bool
cipAllowUnauthenticatedIdentities = lens _cipAllowUnauthenticatedIdentities (\ s a -> s{_cipAllowUnauthenticatedIdentities = a});
instance AWSRequest CreateIdentityPool where
type Rs CreateIdentityPool = IdentityPool
request = postJSON cognitoIdentity
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance ToHeaders CreateIdentityPool where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityService.CreateIdentityPool" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateIdentityPool where
toJSON CreateIdentityPool'{..}
= object
(catMaybes
[("SupportedLoginProviders" .=) <$>
_cipSupportedLoginProviders,
("DeveloperProviderName" .=) <$>
_cipDeveloperProviderName,
("OpenIdConnectProviderARNs" .=) <$>
_cipOpenIdConnectProviderARNs,
Just ("IdentityPoolName" .= _cipIdentityPoolName),
Just
("AllowUnauthenticatedIdentities" .=
_cipAllowUnauthenticatedIdentities)])
instance ToPath CreateIdentityPool where
toPath = const "/"
instance ToQuery CreateIdentityPool where
toQuery = const mempty