{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
module Aws.Iam.Commands.ListGroupPolicies
( ListGroupPolicies(..)
, ListGroupPoliciesResponse(..)
) where
import Aws.Core
import Aws.Iam.Core
import Aws.Iam.Internal
import Data.Text (Text)
import Data.Typeable
import Text.XML.Cursor (content, laxElement, ($//), (&/))
data ListGroupPolicies
= ListGroupPolicies {
lgpGroupName :: Text
, lgpMarker :: Maybe Text
, lgpMaxItems :: Maybe Integer
}
deriving (Eq, Ord, Show, Typeable)
instance SignQuery ListGroupPolicies where
type ServiceConfiguration ListGroupPolicies = IamConfiguration
signQuery ListGroupPolicies{..}
= iamAction' "ListGroupPolicies" $ [
Just ("GroupName", lgpGroupName)
] <> markedIter lgpMarker lgpMaxItems
data ListGroupPoliciesResponse
= ListGroupPoliciesResponse {
lgprPolicyNames :: [Text]
, lgprIsTruncated :: Bool
, lgprMarker :: Maybe Text
}
deriving (Eq, Ord, Show, Typeable)
instance ResponseConsumer ListGroupPolicies ListGroupPoliciesResponse where
type ResponseMetadata ListGroupPoliciesResponse = IamMetadata
responseConsumer _ _
= iamResponseConsumer $ \cursor -> do
(lgprIsTruncated, lgprMarker) <- markedIterResponse cursor
let lgprPolicyNames = cursor $// laxElement "member" &/ content
return ListGroupPoliciesResponse{..}
instance Transaction ListGroupPolicies ListGroupPoliciesResponse
instance IteratedTransaction ListGroupPolicies ListGroupPoliciesResponse where
nextIteratedRequest request response
= case lgprMarker response of
Nothing -> Nothing
Just marker -> Just $ request { lgpMarker = Just marker }
instance AsMemoryResponse ListGroupPoliciesResponse where
type MemoryResponse ListGroupPoliciesResponse = ListGroupPoliciesResponse
loadToMemory = return