amazonka-cognito-idp-1.4.3: gen/Network/AWS/CognitoIdentityProvider/ConfirmForgotPassword.hs
{-# 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 #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.CognitoIdentityProvider.ConfirmForgotPassword
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Allows a user to enter a code provided when they reset their password to update their password.
module Network.AWS.CognitoIdentityProvider.ConfirmForgotPassword
(
-- * Creating a Request
confirmForgotPassword
, ConfirmForgotPassword
-- * Request Lenses
, cfpSecretHash
, cfpClientId
, cfpUsername
, cfpConfirmationCode
, cfpPassword
-- * Destructuring the Response
, confirmForgotPasswordResponse
, ConfirmForgotPasswordResponse
-- * Response Lenses
, 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
-- | The request representing the confirmation for a password reset.
--
-- /See:/ 'confirmForgotPassword' smart constructor.
data ConfirmForgotPassword = ConfirmForgotPassword'
{ _cfpSecretHash :: !(Maybe (Sensitive Text))
, _cfpClientId :: !(Sensitive Text)
, _cfpUsername :: !(Sensitive Text)
, _cfpConfirmationCode :: !Text
, _cfpPassword :: !(Sensitive Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'ConfirmForgotPassword' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfpSecretHash'
--
-- * 'cfpClientId'
--
-- * 'cfpUsername'
--
-- * 'cfpConfirmationCode'
--
-- * 'cfpPassword'
confirmForgotPassword
:: Text -- ^ 'cfpClientId'
-> Text -- ^ 'cfpUsername'
-> Text -- ^ 'cfpConfirmationCode'
-> Text -- ^ 'cfpPassword'
-> ConfirmForgotPassword
confirmForgotPassword pClientId_ pUsername_ pConfirmationCode_ pPassword_ =
ConfirmForgotPassword'
{ _cfpSecretHash = Nothing
, _cfpClientId = _Sensitive # pClientId_
, _cfpUsername = _Sensitive # pUsername_
, _cfpConfirmationCode = pConfirmationCode_
, _cfpPassword = _Sensitive # pPassword_
}
-- | A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message.
cfpSecretHash :: Lens' ConfirmForgotPassword (Maybe Text)
cfpSecretHash = lens _cfpSecretHash (\ s a -> s{_cfpSecretHash = a}) . mapping _Sensitive;
-- | The ID of the client associated with the user pool.
cfpClientId :: Lens' ConfirmForgotPassword Text
cfpClientId = lens _cfpClientId (\ s a -> s{_cfpClientId = a}) . _Sensitive;
-- | The user name of the user for whom you want to enter a code to retrieve a forgotten password.
cfpUsername :: Lens' ConfirmForgotPassword Text
cfpUsername = lens _cfpUsername (\ s a -> s{_cfpUsername = a}) . _Sensitive;
-- | The confirmation code sent by a user\'s request to retrieve a forgotten password.
cfpConfirmationCode :: Lens' ConfirmForgotPassword Text
cfpConfirmationCode = lens _cfpConfirmationCode (\ s a -> s{_cfpConfirmationCode = a});
-- | The password sent by sent by a user\'s request to retrieve a forgotten password.
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
instance NFData ConfirmForgotPassword
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
[("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
-- | The response from the server that results from a user\'s request to retrieve a forgotten password.
--
-- /See:/ 'confirmForgotPasswordResponse' smart constructor.
newtype ConfirmForgotPasswordResponse = ConfirmForgotPasswordResponse'
{ _cfprsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'ConfirmForgotPasswordResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfprsResponseStatus'
confirmForgotPasswordResponse
:: Int -- ^ 'cfprsResponseStatus'
-> ConfirmForgotPasswordResponse
confirmForgotPasswordResponse pResponseStatus_ =
ConfirmForgotPasswordResponse'
{ _cfprsResponseStatus = pResponseStatus_
}
-- | The response status code.
cfprsResponseStatus :: Lens' ConfirmForgotPasswordResponse Int
cfprsResponseStatus = lens _cfprsResponseStatus (\ s a -> s{_cfprsResponseStatus = a});
instance NFData ConfirmForgotPasswordResponse