{-# 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.CodeStar.UpdateUserProfile
(
updateUserProfile
, UpdateUserProfile
, uupSshPublicKey
, uupEmailAddress
, uupDisplayName
, uupUserARN
, updateUserProfileResponse
, UpdateUserProfileResponse
, uuprsLastModifiedTimestamp
, uuprsSshPublicKey
, uuprsEmailAddress
, uuprsDisplayName
, uuprsCreatedTimestamp
, uuprsResponseStatus
, uuprsUserARN
) where
import Network.AWS.CodeStar.Types
import Network.AWS.CodeStar.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateUserProfile = UpdateUserProfile'
{ _uupSshPublicKey :: !(Maybe Text)
, _uupEmailAddress :: !(Maybe (Sensitive Text))
, _uupDisplayName :: !(Maybe Text)
, _uupUserARN :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
updateUserProfile
:: Text
-> UpdateUserProfile
updateUserProfile pUserARN_ =
UpdateUserProfile'
{ _uupSshPublicKey = Nothing
, _uupEmailAddress = Nothing
, _uupDisplayName = Nothing
, _uupUserARN = pUserARN_
}
uupSshPublicKey :: Lens' UpdateUserProfile (Maybe Text)
uupSshPublicKey = lens _uupSshPublicKey (\ s a -> s{_uupSshPublicKey = a})
uupEmailAddress :: Lens' UpdateUserProfile (Maybe Text)
uupEmailAddress = lens _uupEmailAddress (\ s a -> s{_uupEmailAddress = a}) . mapping _Sensitive
uupDisplayName :: Lens' UpdateUserProfile (Maybe Text)
uupDisplayName = lens _uupDisplayName (\ s a -> s{_uupDisplayName = a})
uupUserARN :: Lens' UpdateUserProfile Text
uupUserARN = lens _uupUserARN (\ s a -> s{_uupUserARN = a})
instance AWSRequest UpdateUserProfile where
type Rs UpdateUserProfile = UpdateUserProfileResponse
request = postJSON codeStar
response
= receiveJSON
(\ s h x ->
UpdateUserProfileResponse' <$>
(x .?> "lastModifiedTimestamp") <*>
(x .?> "sshPublicKey")
<*> (x .?> "emailAddress")
<*> (x .?> "displayName")
<*> (x .?> "createdTimestamp")
<*> (pure (fromEnum s))
<*> (x .:> "userArn"))
instance Hashable UpdateUserProfile where
instance NFData UpdateUserProfile where
instance ToHeaders UpdateUserProfile where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeStar_20170419.UpdateUserProfile" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateUserProfile where
toJSON UpdateUserProfile'{..}
= object
(catMaybes
[("sshPublicKey" .=) <$> _uupSshPublicKey,
("emailAddress" .=) <$> _uupEmailAddress,
("displayName" .=) <$> _uupDisplayName,
Just ("userArn" .= _uupUserARN)])
instance ToPath UpdateUserProfile where
toPath = const "/"
instance ToQuery UpdateUserProfile where
toQuery = const mempty
data UpdateUserProfileResponse = UpdateUserProfileResponse'
{ _uuprsLastModifiedTimestamp :: !(Maybe POSIX)
, _uuprsSshPublicKey :: !(Maybe Text)
, _uuprsEmailAddress :: !(Maybe (Sensitive Text))
, _uuprsDisplayName :: !(Maybe Text)
, _uuprsCreatedTimestamp :: !(Maybe POSIX)
, _uuprsResponseStatus :: !Int
, _uuprsUserARN :: !Text
} deriving (Eq, Show, Data, Typeable, Generic)
updateUserProfileResponse
:: Int
-> Text
-> UpdateUserProfileResponse
updateUserProfileResponse pResponseStatus_ pUserARN_ =
UpdateUserProfileResponse'
{ _uuprsLastModifiedTimestamp = Nothing
, _uuprsSshPublicKey = Nothing
, _uuprsEmailAddress = Nothing
, _uuprsDisplayName = Nothing
, _uuprsCreatedTimestamp = Nothing
, _uuprsResponseStatus = pResponseStatus_
, _uuprsUserARN = pUserARN_
}
uuprsLastModifiedTimestamp :: Lens' UpdateUserProfileResponse (Maybe UTCTime)
uuprsLastModifiedTimestamp = lens _uuprsLastModifiedTimestamp (\ s a -> s{_uuprsLastModifiedTimestamp = a}) . mapping _Time
uuprsSshPublicKey :: Lens' UpdateUserProfileResponse (Maybe Text)
uuprsSshPublicKey = lens _uuprsSshPublicKey (\ s a -> s{_uuprsSshPublicKey = a})
uuprsEmailAddress :: Lens' UpdateUserProfileResponse (Maybe Text)
uuprsEmailAddress = lens _uuprsEmailAddress (\ s a -> s{_uuprsEmailAddress = a}) . mapping _Sensitive
uuprsDisplayName :: Lens' UpdateUserProfileResponse (Maybe Text)
uuprsDisplayName = lens _uuprsDisplayName (\ s a -> s{_uuprsDisplayName = a})
uuprsCreatedTimestamp :: Lens' UpdateUserProfileResponse (Maybe UTCTime)
uuprsCreatedTimestamp = lens _uuprsCreatedTimestamp (\ s a -> s{_uuprsCreatedTimestamp = a}) . mapping _Time
uuprsResponseStatus :: Lens' UpdateUserProfileResponse Int
uuprsResponseStatus = lens _uuprsResponseStatus (\ s a -> s{_uuprsResponseStatus = a})
uuprsUserARN :: Lens' UpdateUserProfileResponse Text
uuprsUserARN = lens _uuprsUserARN (\ s a -> s{_uuprsUserARN = a})
instance NFData UpdateUserProfileResponse where