module Network.AWS.IAM.GetUserPolicy
(
getUserPolicy
, GetUserPolicy
, gupUserName
, gupPolicyName
, getUserPolicyResponse
, GetUserPolicyResponse
, guprsStatus
, guprsUserName
, guprsPolicyName
, guprsPolicyDocument
) where
import Network.AWS.IAM.Types
import Network.AWS.IAM.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetUserPolicy = GetUserPolicy'
{ _gupUserName :: !Text
, _gupPolicyName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUserPolicy
:: Text
-> Text
-> GetUserPolicy
getUserPolicy pUserName_ pPolicyName_ =
GetUserPolicy'
{ _gupUserName = pUserName_
, _gupPolicyName = pPolicyName_
}
gupUserName :: Lens' GetUserPolicy Text
gupUserName = lens _gupUserName (\ s a -> s{_gupUserName = a});
gupPolicyName :: Lens' GetUserPolicy Text
gupPolicyName = lens _gupPolicyName (\ s a -> s{_gupPolicyName = a});
instance AWSRequest GetUserPolicy where
type Sv GetUserPolicy = IAM
type Rs GetUserPolicy = GetUserPolicyResponse
request = postQuery
response
= receiveXMLWrapper "GetUserPolicyResult"
(\ s h x ->
GetUserPolicyResponse' <$>
(pure (fromEnum s)) <*> (x .@ "UserName") <*>
(x .@ "PolicyName")
<*> (x .@ "PolicyDocument"))
instance ToHeaders GetUserPolicy where
toHeaders = const mempty
instance ToPath GetUserPolicy where
toPath = const "/"
instance ToQuery GetUserPolicy where
toQuery GetUserPolicy'{..}
= mconcat
["Action" =: ("GetUserPolicy" :: ByteString),
"Version" =: ("2010-05-08" :: ByteString),
"UserName" =: _gupUserName,
"PolicyName" =: _gupPolicyName]
data GetUserPolicyResponse = GetUserPolicyResponse'
{ _guprsStatus :: !Int
, _guprsUserName :: !Text
, _guprsPolicyName :: !Text
, _guprsPolicyDocument :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUserPolicyResponse
:: Int
-> Text
-> Text
-> Text
-> GetUserPolicyResponse
getUserPolicyResponse pStatus_ pUserName_ pPolicyName_ pPolicyDocument_ =
GetUserPolicyResponse'
{ _guprsStatus = pStatus_
, _guprsUserName = pUserName_
, _guprsPolicyName = pPolicyName_
, _guprsPolicyDocument = pPolicyDocument_
}
guprsStatus :: Lens' GetUserPolicyResponse Int
guprsStatus = lens _guprsStatus (\ s a -> s{_guprsStatus = a});
guprsUserName :: Lens' GetUserPolicyResponse Text
guprsUserName = lens _guprsUserName (\ s a -> s{_guprsUserName = a});
guprsPolicyName :: Lens' GetUserPolicyResponse Text
guprsPolicyName = lens _guprsPolicyName (\ s a -> s{_guprsPolicyName = a});
guprsPolicyDocument :: Lens' GetUserPolicyResponse Text
guprsPolicyDocument = lens _guprsPolicyDocument (\ s a -> s{_guprsPolicyDocument = a});