{-# 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.ChangePassword
(
changePassword
, ChangePassword
, cpAccessToken
, cpPreviousPassword
, cpProposedPassword
, changePasswordResponse
, ChangePasswordResponse
, cprsResponseStatus
) 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 ChangePassword = ChangePassword'
{ _cpAccessToken :: !(Maybe (Sensitive Text))
, _cpPreviousPassword :: !(Sensitive Text)
, _cpProposedPassword :: !(Sensitive Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
changePassword
:: Text
-> Text
-> ChangePassword
changePassword pPreviousPassword_ pProposedPassword_ =
ChangePassword'
{ _cpAccessToken = Nothing
, _cpPreviousPassword = _Sensitive # pPreviousPassword_
, _cpProposedPassword = _Sensitive # pProposedPassword_
}
cpAccessToken :: Lens' ChangePassword (Maybe Text)
cpAccessToken = lens _cpAccessToken (\ s a -> s{_cpAccessToken = a}) . mapping _Sensitive;
cpPreviousPassword :: Lens' ChangePassword Text
cpPreviousPassword = lens _cpPreviousPassword (\ s a -> s{_cpPreviousPassword = a}) . _Sensitive;
cpProposedPassword :: Lens' ChangePassword Text
cpProposedPassword = lens _cpProposedPassword (\ s a -> s{_cpProposedPassword = a}) . _Sensitive;
instance AWSRequest ChangePassword where
type Rs ChangePassword = ChangePasswordResponse
request = postJSON cognitoIdentityProvider
response
= receiveEmpty
(\ s h x ->
ChangePasswordResponse' <$> (pure (fromEnum s)))
instance Hashable ChangePassword
instance NFData ChangePassword
instance ToHeaders ChangePassword where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.ChangePassword"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ChangePassword where
toJSON ChangePassword'{..}
= object
(catMaybes
[("AccessToken" .=) <$> _cpAccessToken,
Just ("PreviousPassword" .= _cpPreviousPassword),
Just ("ProposedPassword" .= _cpProposedPassword)])
instance ToPath ChangePassword where
toPath = const "/"
instance ToQuery ChangePassword where
toQuery = const mempty
newtype ChangePasswordResponse = ChangePasswordResponse'
{ _cprsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
changePasswordResponse
:: Int
-> ChangePasswordResponse
changePasswordResponse pResponseStatus_ =
ChangePasswordResponse'
{ _cprsResponseStatus = pResponseStatus_
}
cprsResponseStatus :: Lens' ChangePasswordResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a});
instance NFData ChangePasswordResponse