module Network.AWS.OpsWorks.CreateUserProfile
(
createUserProfile
, CreateUserProfile
, cupAllowSelfManagement
, cupSSHPublicKey
, cupSSHUsername
, cupIAMUserARN
, createUserProfileResponse
, CreateUserProfileResponse
, cuprsIAMUserARN
, cuprsResponseStatus
) where
import Network.AWS.OpsWorks.Types
import Network.AWS.OpsWorks.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateUserProfile = CreateUserProfile'
{ _cupAllowSelfManagement :: !(Maybe Bool)
, _cupSSHPublicKey :: !(Maybe Text)
, _cupSSHUsername :: !(Maybe Text)
, _cupIAMUserARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createUserProfile
:: Text
-> CreateUserProfile
createUserProfile pIAMUserARN_ =
CreateUserProfile'
{ _cupAllowSelfManagement = Nothing
, _cupSSHPublicKey = Nothing
, _cupSSHUsername = Nothing
, _cupIAMUserARN = pIAMUserARN_
}
cupAllowSelfManagement :: Lens' CreateUserProfile (Maybe Bool)
cupAllowSelfManagement = lens _cupAllowSelfManagement (\ s a -> s{_cupAllowSelfManagement = a});
cupSSHPublicKey :: Lens' CreateUserProfile (Maybe Text)
cupSSHPublicKey = lens _cupSSHPublicKey (\ s a -> s{_cupSSHPublicKey = a});
cupSSHUsername :: Lens' CreateUserProfile (Maybe Text)
cupSSHUsername = lens _cupSSHUsername (\ s a -> s{_cupSSHUsername = a});
cupIAMUserARN :: Lens' CreateUserProfile Text
cupIAMUserARN = lens _cupIAMUserARN (\ s a -> s{_cupIAMUserARN = a});
instance AWSRequest CreateUserProfile where
type Rs CreateUserProfile = CreateUserProfileResponse
request = postJSON opsWorks
response
= receiveJSON
(\ s h x ->
CreateUserProfileResponse' <$>
(x .?> "IamUserArn") <*> (pure (fromEnum s)))
instance ToHeaders CreateUserProfile where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorks_20130218.CreateUserProfile" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateUserProfile where
toJSON CreateUserProfile'{..}
= object
(catMaybes
[("AllowSelfManagement" .=) <$>
_cupAllowSelfManagement,
("SshPublicKey" .=) <$> _cupSSHPublicKey,
("SshUsername" .=) <$> _cupSSHUsername,
Just ("IamUserArn" .= _cupIAMUserARN)])
instance ToPath CreateUserProfile where
toPath = const "/"
instance ToQuery CreateUserProfile where
toQuery = const mempty
data CreateUserProfileResponse = CreateUserProfileResponse'
{ _cuprsIAMUserARN :: !(Maybe Text)
, _cuprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createUserProfileResponse
:: Int
-> CreateUserProfileResponse
createUserProfileResponse pResponseStatus_ =
CreateUserProfileResponse'
{ _cuprsIAMUserARN = Nothing
, _cuprsResponseStatus = pResponseStatus_
}
cuprsIAMUserARN :: Lens' CreateUserProfileResponse (Maybe Text)
cuprsIAMUserARN = lens _cuprsIAMUserARN (\ s a -> s{_cuprsIAMUserARN = a});
cuprsResponseStatus :: Lens' CreateUserProfileResponse Int
cuprsResponseStatus = lens _cuprsResponseStatus (\ s a -> s{_cuprsResponseStatus = a});