module Network.AWS.IAM.ListEntitiesForPolicy
(
ListEntitiesForPolicy
, listEntitiesForPolicy
, lefpEntityFilter
, lefpMarker
, lefpMaxItems
, lefpPathPrefix
, lefpPolicyArn
, ListEntitiesForPolicyResponse
, listEntitiesForPolicyResponse
, lefprIsTruncated
, lefprMarker
, lefprPolicyGroups
, lefprPolicyRoles
, lefprPolicyUsers
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.IAM.Types
import qualified GHC.Exts
data ListEntitiesForPolicy = ListEntitiesForPolicy
{ _lefpEntityFilter :: Maybe EntityType
, _lefpMarker :: Maybe Text
, _lefpMaxItems :: Maybe Nat
, _lefpPathPrefix :: Maybe Text
, _lefpPolicyArn :: Text
} deriving (Eq, Read, Show)
listEntitiesForPolicy :: Text
-> ListEntitiesForPolicy
listEntitiesForPolicy p1 = ListEntitiesForPolicy
{ _lefpPolicyArn = p1
, _lefpEntityFilter = Nothing
, _lefpPathPrefix = Nothing
, _lefpMarker = Nothing
, _lefpMaxItems = Nothing
}
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
lefpPathPrefix :: Lens' ListEntitiesForPolicy (Maybe Text)
lefpPathPrefix = lens _lefpPathPrefix (\s a -> s { _lefpPathPrefix = a })
lefpPolicyArn :: Lens' ListEntitiesForPolicy Text
lefpPolicyArn = lens _lefpPolicyArn (\s a -> s { _lefpPolicyArn = a })
data ListEntitiesForPolicyResponse = ListEntitiesForPolicyResponse
{ _lefprIsTruncated :: Maybe Bool
, _lefprMarker :: Maybe Text
, _lefprPolicyGroups :: List "member" PolicyGroup
, _lefprPolicyRoles :: List "member" PolicyRole
, _lefprPolicyUsers :: List "member" PolicyUser
} deriving (Eq, Read, Show)
listEntitiesForPolicyResponse :: ListEntitiesForPolicyResponse
listEntitiesForPolicyResponse = ListEntitiesForPolicyResponse
{ _lefprPolicyGroups = mempty
, _lefprPolicyUsers = mempty
, _lefprPolicyRoles = mempty
, _lefprIsTruncated = Nothing
, _lefprMarker = Nothing
}
lefprIsTruncated :: Lens' ListEntitiesForPolicyResponse (Maybe Bool)
lefprIsTruncated = lens _lefprIsTruncated (\s a -> s { _lefprIsTruncated = a })
lefprMarker :: Lens' ListEntitiesForPolicyResponse (Maybe Text)
lefprMarker = lens _lefprMarker (\s a -> s { _lefprMarker = a })
lefprPolicyGroups :: Lens' ListEntitiesForPolicyResponse [PolicyGroup]
lefprPolicyGroups =
lens _lefprPolicyGroups (\s a -> s { _lefprPolicyGroups = a })
. _List
lefprPolicyRoles :: Lens' ListEntitiesForPolicyResponse [PolicyRole]
lefprPolicyRoles = lens _lefprPolicyRoles (\s a -> s { _lefprPolicyRoles = a }) . _List
lefprPolicyUsers :: Lens' ListEntitiesForPolicyResponse [PolicyUser]
lefprPolicyUsers = lens _lefprPolicyUsers (\s a -> s { _lefprPolicyUsers = a }) . _List
instance ToPath ListEntitiesForPolicy where
toPath = const "/"
instance ToQuery ListEntitiesForPolicy where
toQuery ListEntitiesForPolicy{..} = mconcat
[ "EntityFilter" =? _lefpEntityFilter
, "Marker" =? _lefpMarker
, "MaxItems" =? _lefpMaxItems
, "PathPrefix" =? _lefpPathPrefix
, "PolicyArn" =? _lefpPolicyArn
]
instance ToHeaders ListEntitiesForPolicy
instance AWSRequest ListEntitiesForPolicy where
type Sv ListEntitiesForPolicy = IAM
type Rs ListEntitiesForPolicy = ListEntitiesForPolicyResponse
request = post "ListEntitiesForPolicy"
response = xmlResponse
instance FromXML ListEntitiesForPolicyResponse where
parseXML = withElement "ListEntitiesForPolicyResult" $ \x -> ListEntitiesForPolicyResponse
<$> x .@? "IsTruncated"
<*> x .@? "Marker"
<*> x .@? "PolicyGroups" .!@ mempty
<*> x .@? "PolicyRoles" .!@ mempty
<*> x .@? "PolicyUsers" .!@ mempty