module Aws.Iam.Commands.ListMfaDevices
( ListMfaDevices(..)
, ListMfaDevicesResponse(..)
) where
import Aws.Core
import Aws.Iam.Core
import Aws.Iam.Internal
import Control.Applicative
import Data.Text (Text)
import Data.Typeable
import Text.XML.Cursor (laxElement, ($//), (&|))
data ListMfaDevices = ListMfaDevices
{ lmfaUserName :: Maybe Text
, lmfaMarker :: Maybe Text
, lmfaMaxItems :: Maybe Integer
} deriving (Eq, Ord, Show, Typeable)
instance SignQuery ListMfaDevices where
type ServiceConfiguration ListMfaDevices = IamConfiguration
signQuery ListMfaDevices{..} = iamAction' "ListMFADevices"
([ ("UserName",) <$> lmfaUserName ]
<> markedIter lmfaMarker lmfaMaxItems)
data ListMfaDevicesResponse = ListMfaDevicesResponse
{ lmfarMfaDevices :: [MfaDevice]
, lmfarIsTruncated :: Bool
, lmfarMarker :: Maybe Text
} deriving (Eq, Ord, Show, Typeable)
instance ResponseConsumer ListMfaDevices ListMfaDevicesResponse where
type ResponseMetadata ListMfaDevicesResponse = IamMetadata
responseConsumer _req =
iamResponseConsumer $ \ cursor -> do
(lmfarIsTruncated, lmfarMarker) <- markedIterResponse cursor
lmfarMfaDevices <-
sequence $ cursor $// laxElement "member" &| parseMfaDevice
return ListMfaDevicesResponse{..}
instance Transaction ListMfaDevices ListMfaDevicesResponse
instance IteratedTransaction ListMfaDevices ListMfaDevicesResponse where
nextIteratedRequest request response
= case lmfarMarker response of
Nothing -> Nothing
Just marker -> Just $ request { lmfaMarker = Just marker }
instance AsMemoryResponse ListMfaDevicesResponse where
type MemoryResponse ListMfaDevicesResponse = ListMfaDevicesResponse
loadToMemory = return