module Network.AWS.IAM.GetUserPolicy
(
GetUserPolicy
, getUserPolicy
, gupPolicyName
, gupUserName
, GetUserPolicyResponse
, getUserPolicyResponse
, guprPolicyDocument
, guprPolicyName
, guprUserName
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.IAM.Types
import qualified GHC.Exts
data GetUserPolicy = GetUserPolicy
{ _gupPolicyName :: Text
, _gupUserName :: Text
} deriving (Eq, Ord, Show)
getUserPolicy :: Text
-> Text
-> GetUserPolicy
getUserPolicy p1 p2 = GetUserPolicy
{ _gupUserName = p1
, _gupPolicyName = p2
}
gupPolicyName :: Lens' GetUserPolicy Text
gupPolicyName = lens _gupPolicyName (\s a -> s { _gupPolicyName = a })
gupUserName :: Lens' GetUserPolicy Text
gupUserName = lens _gupUserName (\s a -> s { _gupUserName = a })
data GetUserPolicyResponse = GetUserPolicyResponse
{ _guprPolicyDocument :: Text
, _guprPolicyName :: Text
, _guprUserName :: Text
} deriving (Eq, Ord, Show)
getUserPolicyResponse :: Text
-> Text
-> Text
-> GetUserPolicyResponse
getUserPolicyResponse p1 p2 p3 = GetUserPolicyResponse
{ _guprUserName = p1
, _guprPolicyName = p2
, _guprPolicyDocument = p3
}
guprPolicyDocument :: Lens' GetUserPolicyResponse Text
guprPolicyDocument =
lens _guprPolicyDocument (\s a -> s { _guprPolicyDocument = a })
guprPolicyName :: Lens' GetUserPolicyResponse Text
guprPolicyName = lens _guprPolicyName (\s a -> s { _guprPolicyName = a })
guprUserName :: Lens' GetUserPolicyResponse Text
guprUserName = lens _guprUserName (\s a -> s { _guprUserName = a })
instance ToPath GetUserPolicy where
toPath = const "/"
instance ToQuery GetUserPolicy where
toQuery GetUserPolicy{..} = mconcat
[ "PolicyName" =? _gupPolicyName
, "UserName" =? _gupUserName
]
instance ToHeaders GetUserPolicy
instance AWSRequest GetUserPolicy where
type Sv GetUserPolicy = IAM
type Rs GetUserPolicy = GetUserPolicyResponse
request = post "GetUserPolicy"
response = xmlResponse
instance FromXML GetUserPolicyResponse where
parseXML = withElement "GetUserPolicyResult" $ \x -> GetUserPolicyResponse
<$> x .@ "PolicyDocument"
<*> x .@ "PolicyName"
<*> x .@ "UserName"