{-# 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.UpdateUserAttributes
(
updateUserAttributes
, UpdateUserAttributes
, uuaUserAttributes
, uuaAccessToken
, updateUserAttributesResponse
, UpdateUserAttributesResponse
, uuarsCodeDeliveryDetailsList
, uuarsResponseStatus
) 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 UpdateUserAttributes = UpdateUserAttributes'
{ _uuaUserAttributes :: ![AttributeType]
, _uuaAccessToken :: !(Sensitive Text)
} deriving (Eq, Show, Data, Typeable, Generic)
updateUserAttributes
:: Text
-> UpdateUserAttributes
updateUserAttributes pAccessToken_ =
UpdateUserAttributes'
{_uuaUserAttributes = mempty, _uuaAccessToken = _Sensitive # pAccessToken_}
uuaUserAttributes :: Lens' UpdateUserAttributes [AttributeType]
uuaUserAttributes = lens _uuaUserAttributes (\ s a -> s{_uuaUserAttributes = a}) . _Coerce
uuaAccessToken :: Lens' UpdateUserAttributes Text
uuaAccessToken = lens _uuaAccessToken (\ s a -> s{_uuaAccessToken = a}) . _Sensitive
instance AWSRequest UpdateUserAttributes where
type Rs UpdateUserAttributes =
UpdateUserAttributesResponse
request = postJSON cognitoIdentityProvider
response
= receiveJSON
(\ s h x ->
UpdateUserAttributesResponse' <$>
(x .?> "CodeDeliveryDetailsList" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable UpdateUserAttributes where
instance NFData UpdateUserAttributes where
instance ToHeaders UpdateUserAttributes where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSCognitoIdentityProviderService.UpdateUserAttributes"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateUserAttributes where
toJSON UpdateUserAttributes'{..}
= object
(catMaybes
[Just ("UserAttributes" .= _uuaUserAttributes),
Just ("AccessToken" .= _uuaAccessToken)])
instance ToPath UpdateUserAttributes where
toPath = const "/"
instance ToQuery UpdateUserAttributes where
toQuery = const mempty
data UpdateUserAttributesResponse = UpdateUserAttributesResponse'
{ _uuarsCodeDeliveryDetailsList :: !(Maybe [CodeDeliveryDetailsType])
, _uuarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateUserAttributesResponse
:: Int
-> UpdateUserAttributesResponse
updateUserAttributesResponse pResponseStatus_ =
UpdateUserAttributesResponse'
{ _uuarsCodeDeliveryDetailsList = Nothing
, _uuarsResponseStatus = pResponseStatus_
}
uuarsCodeDeliveryDetailsList :: Lens' UpdateUserAttributesResponse [CodeDeliveryDetailsType]
uuarsCodeDeliveryDetailsList = lens _uuarsCodeDeliveryDetailsList (\ s a -> s{_uuarsCodeDeliveryDetailsList = a}) . _Default . _Coerce
uuarsResponseStatus :: Lens' UpdateUserAttributesResponse Int
uuarsResponseStatus = lens _uuarsResponseStatus (\ s a -> s{_uuarsResponseStatus = a})
instance NFData UpdateUserAttributesResponse where