{-# 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.ConfirmForgotPassword
(
confirmForgotPassword
, ConfirmForgotPassword
, cfpAnalyticsMetadata
, cfpUserContextData
, cfpSecretHash
, cfpClientId
, cfpUsername
, cfpConfirmationCode
, cfpPassword
, confirmForgotPasswordResponse
, ConfirmForgotPasswordResponse
, cfprsResponseStatus
) 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 ConfirmForgotPassword = ConfirmForgotPassword'
{ _cfpAnalyticsMetadata :: !(Maybe AnalyticsMetadataType)
, _cfpUserContextData :: !(Maybe UserContextDataType)
, _cfpSecretHash :: !(Maybe (Sensitive Text))
, _cfpClientId :: !(Sensitive Text)
, _cfpUsername :: !(Sensitive Text)
, _cfpConfirmationCode :: !Text
, _cfpPassword :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
confirmForgotPassword
:: Text
-> Text
-> Text
-> Text
-> ConfirmForgotPassword
confirmForgotPassword pClientId_ pUsername_ pConfirmationCode_ pPassword_ =
ConfirmForgotPassword'
{ _cfpAnalyticsMetadata = Nothing
, _cfpUserContextData = Nothing
, _cfpSecretHash = Nothing
, _cfpClientId = _Sensitive # pClientId_
, _cfpUsername = _Sensitive # pUsername_
, _cfpConfirmationCode = pConfirmationCode_
, _cfpPassword = _Sensitive # pPassword_
}
cfpAnalyticsMetadata :: Lens' ConfirmForgotPassword (Maybe AnalyticsMetadataType)
cfpAnalyticsMetadata = lens _cfpAnalyticsMetadata (\ s a -> s{_cfpAnalyticsMetadata = a})
cfpUserContextData :: Lens' ConfirmForgotPassword (Maybe UserContextDataType)
cfpUserContextData = lens _cfpUserContextData (\ s a -> s{_cfpUserContextData = a})
cfpSecretHash :: Lens' ConfirmForgotPassword (Maybe Text)
cfpSecretHash = lens _cfpSecretHash (\ s a -> s{_cfpSecretHash = a}) . mapping _Sensitive
cfpClientId :: Lens' ConfirmForgotPassword Text
cfpClientId = lens _cfpClientId (\ s a -> s{_cfpClientId = a}) . _Sensitive
cfpUsername :: Lens' ConfirmForgotPassword Text
cfpUsername = lens _cfpUsername (\ s a -> s{_cfpUsername = a}) . _Sensitive
cfpConfirmationCode :: Lens' ConfirmForgotPassword Text
cfpConfirmationCode = lens _cfpConfirmationCode (\ s a -> s{_cfpConfirmationCode = a})
cfpPassword :: Lens' ConfirmForgotPassword Text
cfpPassword = lens _cfpPassword (\ s a -> s{_cfpPassword = a}) . _Sensitive
instance AWSRequest ConfirmForgotPassword where
type Rs ConfirmForgotPassword =
ConfirmForgotPasswordResponse
request = postJSON cognitoIdentityProvider
response
= receiveEmpty
(\ s h x ->
ConfirmForgotPasswordResponse' <$>
(pure (fromEnum s)))
instance Hashable ConfirmForgotPassword where
instance NFData ConfirmForgotPassword where
instance ToHeaders ConfirmForgotPassword where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ConfirmForgotPassword"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ConfirmForgotPassword where
toJSON ConfirmForgotPassword'{..}
= object
(catMaybes
[("AnalyticsMetadata" .=) <$> _cfpAnalyticsMetadata,
("UserContextData" .=) <$> _cfpUserContextData,
("SecretHash" .=) <$> _cfpSecretHash,
Just ("ClientId" .= _cfpClientId),
Just ("Username" .= _cfpUsername),
Just ("ConfirmationCode" .= _cfpConfirmationCode),
Just ("Password" .= _cfpPassword)])
instance ToPath ConfirmForgotPassword where
toPath = const "/"
instance ToQuery ConfirmForgotPassword where
toQuery = const mempty
newtype ConfirmForgotPasswordResponse = ConfirmForgotPasswordResponse'
{ _cfprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
confirmForgotPasswordResponse
:: Int
-> ConfirmForgotPasswordResponse
confirmForgotPasswordResponse pResponseStatus_ =
ConfirmForgotPasswordResponse' {_cfprsResponseStatus = pResponseStatus_}
cfprsResponseStatus :: Lens' ConfirmForgotPasswordResponse Int
cfprsResponseStatus = lens _cfprsResponseStatus (\ s a -> s{_cfprsResponseStatus = a})
instance NFData ConfirmForgotPasswordResponse where