module Network.AWS.IAM.GetRolePolicy
(
GetRolePolicy
, getRolePolicy
, grpPolicyName
, grpRoleName
, GetRolePolicyResponse
, getRolePolicyResponse
, grprPolicyDocument
, grprPolicyName
, grprRoleName
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.IAM.Types
import qualified GHC.Exts
data GetRolePolicy = GetRolePolicy
{ _grpPolicyName :: Text
, _grpRoleName :: Text
} deriving (Eq, Ord, Show)
getRolePolicy :: Text
-> Text
-> GetRolePolicy
getRolePolicy p1 p2 = GetRolePolicy
{ _grpRoleName = p1
, _grpPolicyName = p2
}
grpPolicyName :: Lens' GetRolePolicy Text
grpPolicyName = lens _grpPolicyName (\s a -> s { _grpPolicyName = a })
grpRoleName :: Lens' GetRolePolicy Text
grpRoleName = lens _grpRoleName (\s a -> s { _grpRoleName = a })
data GetRolePolicyResponse = GetRolePolicyResponse
{ _grprPolicyDocument :: Text
, _grprPolicyName :: Text
, _grprRoleName :: Text
} deriving (Eq, Ord, Show)
getRolePolicyResponse :: Text
-> Text
-> Text
-> GetRolePolicyResponse
getRolePolicyResponse p1 p2 p3 = GetRolePolicyResponse
{ _grprRoleName = p1
, _grprPolicyName = p2
, _grprPolicyDocument = p3
}
grprPolicyDocument :: Lens' GetRolePolicyResponse Text
grprPolicyDocument =
lens _grprPolicyDocument (\s a -> s { _grprPolicyDocument = a })
grprPolicyName :: Lens' GetRolePolicyResponse Text
grprPolicyName = lens _grprPolicyName (\s a -> s { _grprPolicyName = a })
grprRoleName :: Lens' GetRolePolicyResponse Text
grprRoleName = lens _grprRoleName (\s a -> s { _grprRoleName = a })
instance ToPath GetRolePolicy where
toPath = const "/"
instance ToQuery GetRolePolicy where
toQuery GetRolePolicy{..} = mconcat
[ "PolicyName" =? _grpPolicyName
, "RoleName" =? _grpRoleName
]
instance ToHeaders GetRolePolicy
instance AWSRequest GetRolePolicy where
type Sv GetRolePolicy = IAM
type Rs GetRolePolicy = GetRolePolicyResponse
request = post "GetRolePolicy"
response = xmlResponse
instance FromXML GetRolePolicyResponse where
parseXML = withElement "GetRolePolicyResult" $ \x -> GetRolePolicyResponse
<$> x .@ "PolicyDocument"
<*> x .@ "PolicyName"
<*> x .@ "RoleName"