{-# 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.WorkDocs.UpdateUser
(
updateUser
, UpdateUser
, uuGivenName
, uuGrantPoweruserPrivileges
, uuLocale
, uuAuthenticationToken
, uuStorageRule
, uuType
, uuSurname
, uuTimeZoneId
, uuUserId
, updateUserResponse
, UpdateUserResponse
, uursUser
, uursResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WorkDocs.Types
import Network.AWS.WorkDocs.Types.Product
data UpdateUser = UpdateUser'
{ _uuGivenName :: !(Maybe Text)
, _uuGrantPoweruserPrivileges :: !(Maybe BooleanEnumType)
, _uuLocale :: !(Maybe LocaleType)
, _uuAuthenticationToken :: !(Maybe (Sensitive Text))
, _uuStorageRule :: !(Maybe StorageRuleType)
, _uuType :: !(Maybe UserType)
, _uuSurname :: !(Maybe Text)
, _uuTimeZoneId :: !(Maybe Text)
, _uuUserId :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
updateUser
:: Text
-> UpdateUser
updateUser pUserId_ =
UpdateUser'
{ _uuGivenName = Nothing
, _uuGrantPoweruserPrivileges = Nothing
, _uuLocale = Nothing
, _uuAuthenticationToken = Nothing
, _uuStorageRule = Nothing
, _uuType = Nothing
, _uuSurname = Nothing
, _uuTimeZoneId = Nothing
, _uuUserId = pUserId_
}
uuGivenName :: Lens' UpdateUser (Maybe Text)
uuGivenName = lens _uuGivenName (\ s a -> s{_uuGivenName = a})
uuGrantPoweruserPrivileges :: Lens' UpdateUser (Maybe BooleanEnumType)
uuGrantPoweruserPrivileges = lens _uuGrantPoweruserPrivileges (\ s a -> s{_uuGrantPoweruserPrivileges = a})
uuLocale :: Lens' UpdateUser (Maybe LocaleType)
uuLocale = lens _uuLocale (\ s a -> s{_uuLocale = a})
uuAuthenticationToken :: Lens' UpdateUser (Maybe Text)
uuAuthenticationToken = lens _uuAuthenticationToken (\ s a -> s{_uuAuthenticationToken = a}) . mapping _Sensitive
uuStorageRule :: Lens' UpdateUser (Maybe StorageRuleType)
uuStorageRule = lens _uuStorageRule (\ s a -> s{_uuStorageRule = a})
uuType :: Lens' UpdateUser (Maybe UserType)
uuType = lens _uuType (\ s a -> s{_uuType = a})
uuSurname :: Lens' UpdateUser (Maybe Text)
uuSurname = lens _uuSurname (\ s a -> s{_uuSurname = a})
uuTimeZoneId :: Lens' UpdateUser (Maybe Text)
uuTimeZoneId = lens _uuTimeZoneId (\ s a -> s{_uuTimeZoneId = a})
uuUserId :: Lens' UpdateUser Text
uuUserId = lens _uuUserId (\ s a -> s{_uuUserId = a})
instance AWSRequest UpdateUser where
type Rs UpdateUser = UpdateUserResponse
request = patchJSON workDocs
response
= receiveJSON
(\ s h x ->
UpdateUserResponse' <$>
(x .?> "User") <*> (pure (fromEnum s)))
instance Hashable UpdateUser where
instance NFData UpdateUser where
instance ToHeaders UpdateUser where
toHeaders UpdateUser'{..}
= mconcat
["Authentication" =# _uuAuthenticationToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON UpdateUser where
toJSON UpdateUser'{..}
= object
(catMaybes
[("GivenName" .=) <$> _uuGivenName,
("GrantPoweruserPrivileges" .=) <$>
_uuGrantPoweruserPrivileges,
("Locale" .=) <$> _uuLocale,
("StorageRule" .=) <$> _uuStorageRule,
("Type" .=) <$> _uuType,
("Surname" .=) <$> _uuSurname,
("TimeZoneId" .=) <$> _uuTimeZoneId])
instance ToPath UpdateUser where
toPath UpdateUser'{..}
= mconcat ["/api/v1/users/", toBS _uuUserId]
instance ToQuery UpdateUser where
toQuery = const mempty
data UpdateUserResponse = UpdateUserResponse'
{ _uursUser :: !(Maybe User)
, _uursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateUserResponse
:: Int
-> UpdateUserResponse
updateUserResponse pResponseStatus_ =
UpdateUserResponse'
{_uursUser = Nothing, _uursResponseStatus = pResponseStatus_}
uursUser :: Lens' UpdateUserResponse (Maybe User)
uursUser = lens _uursUser (\ s a -> s{_uursUser = a})
uursResponseStatus :: Lens' UpdateUserResponse Int
uursResponseStatus = lens _uursResponseStatus (\ s a -> s{_uursResponseStatus = a})
instance NFData UpdateUserResponse where