module Network.AWS.IAM.ListEntitiesForPolicy
(
listEntitiesForPolicy
, ListEntitiesForPolicy
, lefpPathPrefix
, lefpEntityFilter
, lefpMarker
, lefpMaxItems
, lefpPolicyARN
, listEntitiesForPolicyResponse
, ListEntitiesForPolicyResponse
, lefprsPolicyGroups
, lefprsPolicyRoles
, lefprsMarker
, lefprsPolicyUsers
, lefprsIsTruncated
, lefprsResponseStatus
) 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 ListEntitiesForPolicy = ListEntitiesForPolicy'
{ _lefpPathPrefix :: !(Maybe Text)
, _lefpEntityFilter :: !(Maybe EntityType)
, _lefpMarker :: !(Maybe Text)
, _lefpMaxItems :: !(Maybe Nat)
, _lefpPolicyARN :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listEntitiesForPolicy
:: Text
-> ListEntitiesForPolicy
listEntitiesForPolicy pPolicyARN_ =
ListEntitiesForPolicy'
{ _lefpPathPrefix = Nothing
, _lefpEntityFilter = Nothing
, _lefpMarker = Nothing
, _lefpMaxItems = Nothing
, _lefpPolicyARN = pPolicyARN_
}
lefpPathPrefix :: Lens' ListEntitiesForPolicy (Maybe Text)
lefpPathPrefix = lens _lefpPathPrefix (\ s a -> s{_lefpPathPrefix = a});
lefpEntityFilter :: Lens' ListEntitiesForPolicy (Maybe EntityType)
lefpEntityFilter = lens _lefpEntityFilter (\ s a -> s{_lefpEntityFilter = a});
lefpMarker :: Lens' ListEntitiesForPolicy (Maybe Text)
lefpMarker = lens _lefpMarker (\ s a -> s{_lefpMarker = a});
lefpMaxItems :: Lens' ListEntitiesForPolicy (Maybe Natural)
lefpMaxItems = lens _lefpMaxItems (\ s a -> s{_lefpMaxItems = a}) . mapping _Nat;
lefpPolicyARN :: Lens' ListEntitiesForPolicy Text
lefpPolicyARN = lens _lefpPolicyARN (\ s a -> s{_lefpPolicyARN = a});
instance AWSRequest ListEntitiesForPolicy where
type Rs ListEntitiesForPolicy =
ListEntitiesForPolicyResponse
request = postQuery iAM
response
= receiveXMLWrapper "ListEntitiesForPolicyResult"
(\ s h x ->
ListEntitiesForPolicyResponse' <$>
(x .@? "PolicyGroups" .!@ mempty >>=
may (parseXMLList "member"))
<*>
(x .@? "PolicyRoles" .!@ mempty >>=
may (parseXMLList "member"))
<*> (x .@? "Marker")
<*>
(x .@? "PolicyUsers" .!@ mempty >>=
may (parseXMLList "member"))
<*> (x .@? "IsTruncated")
<*> (pure (fromEnum s)))
instance ToHeaders ListEntitiesForPolicy where
toHeaders = const mempty
instance ToPath ListEntitiesForPolicy where
toPath = const "/"
instance ToQuery ListEntitiesForPolicy where
toQuery ListEntitiesForPolicy'{..}
= mconcat
["Action" =: ("ListEntitiesForPolicy" :: ByteString),
"Version" =: ("2010-05-08" :: ByteString),
"PathPrefix" =: _lefpPathPrefix,
"EntityFilter" =: _lefpEntityFilter,
"Marker" =: _lefpMarker, "MaxItems" =: _lefpMaxItems,
"PolicyArn" =: _lefpPolicyARN]
data ListEntitiesForPolicyResponse = ListEntitiesForPolicyResponse'
{ _lefprsPolicyGroups :: !(Maybe [PolicyGroup])
, _lefprsPolicyRoles :: !(Maybe [PolicyRole])
, _lefprsMarker :: !(Maybe Text)
, _lefprsPolicyUsers :: !(Maybe [PolicyUser])
, _lefprsIsTruncated :: !(Maybe Bool)
, _lefprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listEntitiesForPolicyResponse
:: Int
-> ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse pResponseStatus_ =
ListEntitiesForPolicyResponse'
{ _lefprsPolicyGroups = Nothing
, _lefprsPolicyRoles = Nothing
, _lefprsMarker = Nothing
, _lefprsPolicyUsers = Nothing
, _lefprsIsTruncated = Nothing
, _lefprsResponseStatus = pResponseStatus_
}
lefprsPolicyGroups :: Lens' ListEntitiesForPolicyResponse [PolicyGroup]
lefprsPolicyGroups = lens _lefprsPolicyGroups (\ s a -> s{_lefprsPolicyGroups = a}) . _Default . _Coerce;
lefprsPolicyRoles :: Lens' ListEntitiesForPolicyResponse [PolicyRole]
lefprsPolicyRoles = lens _lefprsPolicyRoles (\ s a -> s{_lefprsPolicyRoles = a}) . _Default . _Coerce;
lefprsMarker :: Lens' ListEntitiesForPolicyResponse (Maybe Text)
lefprsMarker = lens _lefprsMarker (\ s a -> s{_lefprsMarker = a});
lefprsPolicyUsers :: Lens' ListEntitiesForPolicyResponse [PolicyUser]
lefprsPolicyUsers = lens _lefprsPolicyUsers (\ s a -> s{_lefprsPolicyUsers = a}) . _Default . _Coerce;
lefprsIsTruncated :: Lens' ListEntitiesForPolicyResponse (Maybe Bool)
lefprsIsTruncated = lens _lefprsIsTruncated (\ s a -> s{_lefprsIsTruncated = a});
lefprsResponseStatus :: Lens' ListEntitiesForPolicyResponse Int
lefprsResponseStatus = lens _lefprsResponseStatus (\ s a -> s{_lefprsResponseStatus = a});