{-# 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.CognitoIdentityProvider.CreateUserPool
(
createUserPool
, CreateUserPool
, cupEmailVerificationMessage
, cupSmsAuthenticationMessage
, cupEmailVerificationSubject
, cupAliasAttributes
, cupSchema
, cupEmailConfiguration
, cupSmsVerificationMessage
, cupMFAConfiguration
, cupLambdaConfig
, cupSmsConfiguration
, cupAdminCreateUserConfig
, cupDeviceConfiguration
, cupAutoVerifiedAttributes
, cupPolicies
, cupPoolName
, createUserPoolResponse
, CreateUserPoolResponse
, cuprsUserPool
, cuprsResponseStatus
) where
import Network.AWS.CognitoIdentityProvider.Types
import Network.AWS.CognitoIdentityProvider.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateUserPool = CreateUserPool'
{ _cupEmailVerificationMessage :: !(Maybe Text)
, _cupSmsAuthenticationMessage :: !(Maybe Text)
, _cupEmailVerificationSubject :: !(Maybe Text)
, _cupAliasAttributes :: !(Maybe [AliasAttributeType])
, _cupSchema :: !(Maybe (List1 SchemaAttributeType))
, _cupEmailConfiguration :: !(Maybe EmailConfigurationType)
, _cupSmsVerificationMessage :: !(Maybe Text)
, _cupMFAConfiguration :: !(Maybe UserPoolMFAType)
, _cupLambdaConfig :: !(Maybe LambdaConfigType)
, _cupSmsConfiguration :: !(Maybe SmsConfigurationType)
, _cupAdminCreateUserConfig :: !(Maybe AdminCreateUserConfigType)
, _cupDeviceConfiguration :: !(Maybe DeviceConfigurationType)
, _cupAutoVerifiedAttributes :: !(Maybe [VerifiedAttributeType])
, _cupPolicies :: !(Maybe UserPoolPolicyType)
, _cupPoolName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createUserPool
:: Text
-> CreateUserPool
createUserPool pPoolName_ =
CreateUserPool'
{ _cupEmailVerificationMessage = Nothing
, _cupSmsAuthenticationMessage = Nothing
, _cupEmailVerificationSubject = Nothing
, _cupAliasAttributes = Nothing
, _cupSchema = Nothing
, _cupEmailConfiguration = Nothing
, _cupSmsVerificationMessage = Nothing
, _cupMFAConfiguration = Nothing
, _cupLambdaConfig = Nothing
, _cupSmsConfiguration = Nothing
, _cupAdminCreateUserConfig = Nothing
, _cupDeviceConfiguration = Nothing
, _cupAutoVerifiedAttributes = Nothing
, _cupPolicies = Nothing
, _cupPoolName = pPoolName_
}
cupEmailVerificationMessage :: Lens' CreateUserPool (Maybe Text)
cupEmailVerificationMessage = lens _cupEmailVerificationMessage (\ s a -> s{_cupEmailVerificationMessage = a});
cupSmsAuthenticationMessage :: Lens' CreateUserPool (Maybe Text)
cupSmsAuthenticationMessage = lens _cupSmsAuthenticationMessage (\ s a -> s{_cupSmsAuthenticationMessage = a});
cupEmailVerificationSubject :: Lens' CreateUserPool (Maybe Text)
cupEmailVerificationSubject = lens _cupEmailVerificationSubject (\ s a -> s{_cupEmailVerificationSubject = a});
cupAliasAttributes :: Lens' CreateUserPool [AliasAttributeType]
cupAliasAttributes = lens _cupAliasAttributes (\ s a -> s{_cupAliasAttributes = a}) . _Default . _Coerce;
cupSchema :: Lens' CreateUserPool (Maybe (NonEmpty SchemaAttributeType))
cupSchema = lens _cupSchema (\ s a -> s{_cupSchema = a}) . mapping _List1;
cupEmailConfiguration :: Lens' CreateUserPool (Maybe EmailConfigurationType)
cupEmailConfiguration = lens _cupEmailConfiguration (\ s a -> s{_cupEmailConfiguration = a});
cupSmsVerificationMessage :: Lens' CreateUserPool (Maybe Text)
cupSmsVerificationMessage = lens _cupSmsVerificationMessage (\ s a -> s{_cupSmsVerificationMessage = a});
cupMFAConfiguration :: Lens' CreateUserPool (Maybe UserPoolMFAType)
cupMFAConfiguration = lens _cupMFAConfiguration (\ s a -> s{_cupMFAConfiguration = a});
cupLambdaConfig :: Lens' CreateUserPool (Maybe LambdaConfigType)
cupLambdaConfig = lens _cupLambdaConfig (\ s a -> s{_cupLambdaConfig = a});
cupSmsConfiguration :: Lens' CreateUserPool (Maybe SmsConfigurationType)
cupSmsConfiguration = lens _cupSmsConfiguration (\ s a -> s{_cupSmsConfiguration = a});
cupAdminCreateUserConfig :: Lens' CreateUserPool (Maybe AdminCreateUserConfigType)
cupAdminCreateUserConfig = lens _cupAdminCreateUserConfig (\ s a -> s{_cupAdminCreateUserConfig = a});
cupDeviceConfiguration :: Lens' CreateUserPool (Maybe DeviceConfigurationType)
cupDeviceConfiguration = lens _cupDeviceConfiguration (\ s a -> s{_cupDeviceConfiguration = a});
cupAutoVerifiedAttributes :: Lens' CreateUserPool [VerifiedAttributeType]
cupAutoVerifiedAttributes = lens _cupAutoVerifiedAttributes (\ s a -> s{_cupAutoVerifiedAttributes = a}) . _Default . _Coerce;
cupPolicies :: Lens' CreateUserPool (Maybe UserPoolPolicyType)
cupPolicies = lens _cupPolicies (\ s a -> s{_cupPolicies = a});
cupPoolName :: Lens' CreateUserPool Text
cupPoolName = lens _cupPoolName (\ s a -> s{_cupPoolName = a});
instance AWSRequest CreateUserPool where
type Rs CreateUserPool = CreateUserPoolResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
CreateUserPoolResponse' <$>
(x .?> "UserPool") <*> (pure (fromEnum s)))
instance Hashable CreateUserPool
instance NFData CreateUserPool
instance ToHeaders CreateUserPool where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.CreateUserPool"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateUserPool where
toJSON CreateUserPool'{..}
= object
(catMaybes
[("EmailVerificationMessage" .=) <$>
_cupEmailVerificationMessage,
("SmsAuthenticationMessage" .=) <$>
_cupSmsAuthenticationMessage,
("EmailVerificationSubject" .=) <$>
_cupEmailVerificationSubject,
("AliasAttributes" .=) <$> _cupAliasAttributes,
("Schema" .=) <$> _cupSchema,
("EmailConfiguration" .=) <$> _cupEmailConfiguration,
("SmsVerificationMessage" .=) <$>
_cupSmsVerificationMessage,
("MfaConfiguration" .=) <$> _cupMFAConfiguration,
("LambdaConfig" .=) <$> _cupLambdaConfig,
("SmsConfiguration" .=) <$> _cupSmsConfiguration,
("AdminCreateUserConfig" .=) <$>
_cupAdminCreateUserConfig,
("DeviceConfiguration" .=) <$>
_cupDeviceConfiguration,
("AutoVerifiedAttributes" .=) <$>
_cupAutoVerifiedAttributes,
("Policies" .=) <$> _cupPolicies,
Just ("PoolName" .= _cupPoolName)])
instance ToPath CreateUserPool where
toPath = const "/"
instance ToQuery CreateUserPool where
toQuery = const mempty
data CreateUserPoolResponse = CreateUserPoolResponse'
{ _cuprsUserPool :: !(Maybe UserPoolType)
, _cuprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createUserPoolResponse
:: Int
-> CreateUserPoolResponse
createUserPoolResponse pResponseStatus_ =
CreateUserPoolResponse'
{ _cuprsUserPool = Nothing
, _cuprsResponseStatus = pResponseStatus_
}
cuprsUserPool :: Lens' CreateUserPoolResponse (Maybe UserPoolType)
cuprsUserPool = lens _cuprsUserPool (\ s a -> s{_cuprsUserPool = a});
cuprsResponseStatus :: Lens' CreateUserPoolResponse Int
cuprsResponseStatus = lens _cuprsResponseStatus (\ s a -> s{_cuprsResponseStatus = a});
instance NFData CreateUserPoolResponse