{-# 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.MQ.UpdateUser
(
updateUser
, UpdateUser
, uuGroups
, uuConsoleAccess
, uuPassword
, uuUsername
, uuBrokerId
, updateUserResponse
, UpdateUserResponse
, uursResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MQ.Types
import Network.AWS.MQ.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateUser = UpdateUser'
{ _uuGroups :: !(Maybe [Text])
, _uuConsoleAccess :: !(Maybe Bool)
, _uuPassword :: !(Maybe Text)
, _uuUsername :: !Text
, _uuBrokerId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateUser
:: Text
-> Text
-> UpdateUser
updateUser pUsername_ pBrokerId_ =
UpdateUser'
{ _uuGroups = Nothing
, _uuConsoleAccess = Nothing
, _uuPassword = Nothing
, _uuUsername = pUsername_
, _uuBrokerId = pBrokerId_
}
uuGroups :: Lens' UpdateUser [Text]
uuGroups = lens _uuGroups (\ s a -> s{_uuGroups = a}) . _Default . _Coerce
uuConsoleAccess :: Lens' UpdateUser (Maybe Bool)
uuConsoleAccess = lens _uuConsoleAccess (\ s a -> s{_uuConsoleAccess = a})
uuPassword :: Lens' UpdateUser (Maybe Text)
uuPassword = lens _uuPassword (\ s a -> s{_uuPassword = a})
uuUsername :: Lens' UpdateUser Text
uuUsername = lens _uuUsername (\ s a -> s{_uuUsername = a})
uuBrokerId :: Lens' UpdateUser Text
uuBrokerId = lens _uuBrokerId (\ s a -> s{_uuBrokerId = a})
instance AWSRequest UpdateUser where
type Rs UpdateUser = UpdateUserResponse
request = putJSON mq
response
= receiveEmpty
(\ s h x ->
UpdateUserResponse' <$> (pure (fromEnum s)))
instance Hashable UpdateUser where
instance NFData UpdateUser where
instance ToHeaders UpdateUser where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateUser where
toJSON UpdateUser'{..}
= object
(catMaybes
[("groups" .=) <$> _uuGroups,
("consoleAccess" .=) <$> _uuConsoleAccess,
("password" .=) <$> _uuPassword])
instance ToPath UpdateUser where
toPath UpdateUser'{..}
= mconcat
["/v1/brokers/", toBS _uuBrokerId, "/users/",
toBS _uuUsername]
instance ToQuery UpdateUser where
toQuery = const mempty
newtype UpdateUserResponse = UpdateUserResponse'
{ _uursResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateUserResponse
:: Int
-> UpdateUserResponse
updateUserResponse pResponseStatus_ =
UpdateUserResponse' {_uursResponseStatus = pResponseStatus_}
uursResponseStatus :: Lens' UpdateUserResponse Int
uursResponseStatus = lens _uursResponseStatus (\ s a -> s{_uursResponseStatus = a})
instance NFData UpdateUserResponse where