{-# 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
, cpPreviousPassword
, cpProposedPassword
, cpAccessToken
, 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'
{ _cpPreviousPassword :: !(Sensitive Text)
, _cpProposedPassword :: !(Sensitive Text)
, _cpAccessToken :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
changePassword
:: Text
-> Text
-> Text
-> ChangePassword
changePassword pPreviousPassword_ pProposedPassword_ pAccessToken_ =
ChangePassword'
{ _cpPreviousPassword = _Sensitive # pPreviousPassword_
, _cpProposedPassword = _Sensitive # pProposedPassword_
, _cpAccessToken = _Sensitive # pAccessToken_
}
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
cpAccessToken :: Lens' ChangePassword Text
cpAccessToken = lens _cpAccessToken (\ s a -> s{_cpAccessToken = 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 where
instance NFData ChangePassword where
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
[Just ("PreviousPassword" .= _cpPreviousPassword),
Just ("ProposedPassword" .= _cpProposedPassword),
Just ("AccessToken" .= _cpAccessToken)])
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 where